Provide an IPv6 bridging script

git-svn-id: svn://svn.openwrt.org/openwrt/packages@9802 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2007-12-19 08:30:28 +00:00
parent ff9cb2f646
commit 0dea9a8b97
3 changed files with 57 additions and 0 deletions

View File

@ -53,8 +53,10 @@ define Package/6tunnel/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/6tunnel $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/6tunnel.conf $(1)/etc/config/6tunnel
$(INSTALL_DATA) ./files/6bridge.conf $(1)/etc/config/6bridge
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/6tunnel.init $(1)/etc/init.d/6tunnel
$(INSTALL_BIN) ./files/6bridge.init $(1)/etc/init.d/6bridge
endef
$(eval $(call BuildPackage,6tunnel))

View File

@ -0,0 +1,2 @@
config 6bridge
option bridge 'bripv6'

53
ipv6/6tunnel/files/6bridge.init Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh /etc/rc.common
START=46
STOP=46
start_service() {
local section="$1"
include /lib/network
scan_interfaces
config_load /var/state/network
config_get LAN lan ifname
config_get WAN wan ifname
config_get bridge "$section" bridge
brctl addbr $bridge
brctl addif $bridge $lan
brctl addif $bridge $wan
brctl setfd $bridge 0
ebtables -t broute -A BROUTING -i $wan -p ! ipv6 -j DROP
ifconfig $bridge up
}
stop_service() {
local section="$1"
include /lib/network
scan_interfaces
config_load /var/state/network
config_get LAN lan ifname
config_get WAN wan ifname
config_get bridge "$section" bridge
ifconfig $bridge down
ebtables -t broute -F
brctl delif $bridge $wan
brctl delif $bridge $lan
brctl delbr $bridge
}
start() {
if ! [ -f /proc/net/if_inet6 ]; then
echo "IPv6 not enabled, install kmod-ipv6";
exit 1;
fi
config_load "6bridge"
config_foreach start_service 6bridge
}
stop () {
config_load "6bridge"
config_foreach stop_service 6bridge
}