diff --git a/ipv6/6tunnel/Makefile b/ipv6/6tunnel/Makefile index 315075141..64afbff24 100644 --- a/ipv6/6tunnel/Makefile +++ b/ipv6/6tunnel/Makefile @@ -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)) diff --git a/ipv6/6tunnel/files/6bridge.conf b/ipv6/6tunnel/files/6bridge.conf new file mode 100644 index 000000000..e2980ad65 --- /dev/null +++ b/ipv6/6tunnel/files/6bridge.conf @@ -0,0 +1,2 @@ +config 6bridge + option bridge 'bripv6' diff --git a/ipv6/6tunnel/files/6bridge.init b/ipv6/6tunnel/files/6bridge.init new file mode 100755 index 000000000..2f6ad4a7d --- /dev/null +++ b/ipv6/6tunnel/files/6bridge.init @@ -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 +}