ipv6-support: next iteration * Introduce mode 6rd * Introduce mode 6to4 * Fix announc...
authorSteven Barth <cyrus@openwrt.org>
Thu, 6 Dec 2012 20:52:40 +0000 (20:52 +0000)
committerSteven Barth <cyrus@openwrt.org>
Thu, 6 Dec 2012 20:52:40 +0000 (20:52 +0000)
SVN-Revision: 34542

package/network/ipv6/ipv6-support/Makefile
package/network/ipv6/ipv6-support/files/dhcpv6.sh
package/network/ipv6/ipv6-support/files/network6.config
package/network/ipv6/ipv6-support/files/support.sh

index 21d5c00f9547ca9c92b4ebefa3f08f77dd99d34a..c921105c9e53c9315004d3d413a4baa1edc85483 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ipv6-support
-PKG_VERSION:=2012-12-03
+PKG_VERSION:=2012-12-06
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
index 1d19a681d4f3eadd70dcc36ea68042d91f650c7a..b9428dd330ae9d8261b36e2df656485006407110 100755 (executable)
@@ -39,8 +39,9 @@ config_get prefix_fallback "$network" prefix_fallback
 
 local peerdns
 config_get_bool peerdns "$network" peerdns 0
-[ "peerdns" -eq "1" ] && {
+[ "$peerdns" -eq "1" ] && {
        proto_init_update "*" 1
+       proto_set_keep 1
        for server in $RDNSS; do
                proto_add_dns_server "$server"
        done
index 4fc22d0fab004cd95555d6d609f8ebd92dd7091d..853918b22da8dd2bf301badaed4be36a7f0eba40 100644 (file)
@@ -5,14 +5,8 @@ config interface wan
        option prefix_fallback  relay
        option peerdns          1       
 
-
 config interface lan
        option mode             router
        option advertise_prefix 64
        option relay_master     wan
 
-
-config interface 6in4
-       option mode             static
-       list static_prefix      2001:DB8::/48
-
index 479ed680a769de7065cc8be469559d0ff94b4440..37173781a45b22f00fc03ff8484012307e320d02 100644 (file)
@@ -52,7 +52,6 @@ resolve_network_add() {
        local __section="$1"
        local __device="$2"
        local __return="$3"
-
        local __cdevice
        network_get_device __cdevice "$__section"
        [ "$__cdevice" != "$__device" ] && return
@@ -154,6 +153,10 @@ add_relay_slave() {
        # Disable any active distribution
        [ "$__cmode" == "router" ] && disable_router "$__section"
 
+       # Configure interface to accept RA and send RS
+       conf_set "$__device" accept_ra 2
+       conf_set "$__device" forwarding 2
+
        eval "$__return"'="$'"$__return"' '"$__device"'"'
 }
 
@@ -286,8 +289,8 @@ enable_static() {
                ula_prefix="fd$r1:$r2:$r3::/48"
 
                # Save prefix so it will be preserved across reboots
-               uci set network6.$network.ula_prefix=$ula_prefix
-               uci commit network6
+               uci_set network6 "$network" ula_prefix "$ula_prefix"
+               uci_commit network6
        }
 
        # Announce ULA
@@ -313,10 +316,15 @@ enable_router() {
 
        # Start RD & DHCPv6 service
        local pid="/var/run/ipv6-router-$network.pid"
-       start_service "/usr/sbin/6relayd -Rserver -Dserver . $device" "$pid"
+
+       # Start server
+       start_service "/usr/sbin/6relayd -S . $device" "$pid"
 
        # Try relaying if necessary
        restart_master_relay "$network"
+
+       # start relay if there are forced relay members
+       restart_relay "$network"
 }
 
 
@@ -355,6 +363,25 @@ enable_dhcpv6() {
 }
 
 
+enable_6to4() {
+       local network="$1"
+       local device="$2"
+       local mode="$3"
+
+       local prefixlen="48"
+       [ "$mode" == "6rd" ] && {
+               local ip4prefix=$(uci_get network "$network" ip4prefixlen 0)
+               local ip6prefix=$(uci_get network "$network" ip6prefixlen 32)
+               prefixlen=$(($ip6prefix + 32 - $ip4prefix))
+       }
+
+       local prefix=""
+       network_get_ipaddr6 prefix "$network"
+
+       announce_prefix "$prefix/$prefixlen" "$network"
+}
+
+
 enable_interface()
 {
        local network="$1"
@@ -370,5 +397,6 @@ enable_interface()
        [ "$mode" == "dhcpv6" -o "$mode" == "static" ] && enable_static "$network" "$device"
        [ "$mode" == "dhcpv6" ] && enable_dhcpv6 "$network" "$device"
        [ "$mode" == "router" ] && enable_router "$network" "$device"
+       [ "$mode" == "6to4" -o "$mode" == "6rd" ] && enable_6to4 "$network" "$device" "$mode"
        [ "$mode" == "relay" ] && restart_master_relay "$network" forced
 }