summaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-10-11 09:01:38 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-10-11 09:01:38 +0000
commit998820411b91273bcd870a9e7ccb2d117435a499 (patch)
treeba40a647de9f2557d99e4f6bd1afe22f981eba9a /package/base-files
parent549710c30610c9e73612c87b3c6dc4cc7cef0d60 (diff)
Add 6tunnel configuration for tunnel brokers based configuration (not SiXXS), disabled by default
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9259 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/files/etc/config/6tunnel6
-rw-r--r--package/base-files/files/etc/init.d/6tunnel64
2 files changed, 70 insertions, 0 deletions
diff --git a/package/base-files/files/etc/config/6tunnel b/package/base-files/files/etc/config/6tunnel
new file mode 100644
index 000000000..efd8f817c
--- /dev/null
+++ b/package/base-files/files/etc/config/6tunnel
@@ -0,0 +1,6 @@
+config 6tunnel
+ option tnlifname 'sixbone'
+ option remoteip4 ''
+ option localip4 ''
+ option localip6 ''
+ option prefix '/64'
diff --git a/package/base-files/files/etc/init.d/6tunnel b/package/base-files/files/etc/init.d/6tunnel
new file mode 100644
index 000000000..cd4e1fc02
--- /dev/null
+++ b/package/base-files/files/etc/init.d/6tunnel
@@ -0,0 +1,64 @@
+#!/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 tnlifname "$section" tnlifname
+ config_get remoteip4 "$section" remoteip4
+ config_get localip4 "$section" localip4
+ config_get localip6 "$section" localip6
+ config_get prefix "$section" prefix
+
+ ip tunnel add $tnlifname mode sit remote $remoteip4 local $localip4 ttl 255
+ ifconfig $tnlifname up
+ ip addr add $localip6 dev $tnlifname
+ ip route add ::/0 dev $tnlifname
+ ip route add 2000::/3 dev $tnlifname
+ ip -6 addr add $prefix dev $LAN
+}
+
+stop_service() {
+ local section="$1"
+
+ include /lib/network
+ scan_interfaces
+ config_load /var/state/network
+
+ config_get LAN lan ifname
+ config_get tnlifname "$section" tnlifname
+ config_get remoteip4 "$section" remoteip4
+ config_get localip4 "$section" localip4
+ config_get localip6 "$section" localip6
+ config_get prefix "$section" prefix
+
+ ip -6 addr del $prefix dev $LAN
+ ip -6 ro del 2000::/3 dev $tnlifname
+ ip -6 ro del ::/0 dev $tnlifname
+ ip addr del $localip6 dev $tnlifname
+ ifconfig $tnlifname down
+ ip tunnel del $tnlifname
+}
+start() {
+ if ! [ -f /proc/net/if_inet6 ]; then
+ echo "IPv6 not enabled, install kmod-ipv6";
+ exit 1;
+ fi
+ if ! [ -x /sbin/ip ]; then
+ echo "ip is required to setup the tunnel";
+ exit 1;
+ fi
+ config_load "6tunnel"
+ config_foreach start_service 6tunnel
+}
+
+stop () {
+ config_load "6tunnel"
+ config_foreach stop_service 6tunnel
+}