From 83ef4411d0f72fc6f137b189173d99ad0769cbef Mon Sep 17 00:00:00 2001 From: cyrus Date: Thu, 6 Dec 2012 20:52:40 +0000 Subject: ipv6-support: next iteration * Introduce mode 6rd * Introduce mode 6to4 * Fix announcement of DNS-Servers received from DHCPv6 * Fix some corner-cases in relaying behaviour git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34542 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/network/ipv6/ipv6-support/Makefile | 2 +- package/network/ipv6/ipv6-support/files/dhcpv6.sh | 3 +- .../ipv6/ipv6-support/files/network6.config | 6 ---- package/network/ipv6/ipv6-support/files/support.sh | 36 +++++++++++++++++++--- 4 files changed, 35 insertions(+), 12 deletions(-) (limited to 'package/network/ipv6/ipv6-support') diff --git a/package/network/ipv6/ipv6-support/Makefile b/package/network/ipv6/ipv6-support/Makefile index 21d5c00f9..c921105c9 100644 --- a/package/network/ipv6/ipv6-support/Makefile +++ b/package/network/ipv6/ipv6-support/Makefile @@ -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 diff --git a/package/network/ipv6/ipv6-support/files/dhcpv6.sh b/package/network/ipv6/ipv6-support/files/dhcpv6.sh index 1d19a681d..b9428dd33 100755 --- a/package/network/ipv6/ipv6-support/files/dhcpv6.sh +++ b/package/network/ipv6/ipv6-support/files/dhcpv6.sh @@ -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 diff --git a/package/network/ipv6/ipv6-support/files/network6.config b/package/network/ipv6/ipv6-support/files/network6.config index 4fc22d0fa..853918b22 100644 --- a/package/network/ipv6/ipv6-support/files/network6.config +++ b/package/network/ipv6/ipv6-support/files/network6.config @@ -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 - diff --git a/package/network/ipv6/ipv6-support/files/support.sh b/package/network/ipv6/ipv6-support/files/support.sh index 479ed680a..37173781a 100644 --- a/package/network/ipv6/ipv6-support/files/support.sh +++ b/package/network/ipv6/ipv6-support/files/support.sh @@ -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 } -- cgit v1.2.3