From 0dea9a8b97041d9c69b6c3f131677f0ec6e6d8bc Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 19 Dec 2007 08:30:28 +0000 Subject: [PATCH] Provide an IPv6 bridging script git-svn-id: svn://svn.openwrt.org/openwrt/packages@9802 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ipv6/6tunnel/Makefile | 2 ++ ipv6/6tunnel/files/6bridge.conf | 2 ++ ipv6/6tunnel/files/6bridge.init | 53 +++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 ipv6/6tunnel/files/6bridge.conf create mode 100755 ipv6/6tunnel/files/6bridge.init 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 +}