From: Steven Barth Date: Thu, 6 Dec 2012 20:52:40 +0000 (+0000) Subject: ipv6-support: next iteration * Introduce mode 6rd * Introduce mode 6to4 * Fix announc... X-Git-Tag: reboot~12090 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=82576f0ca3dd1be61e9aea6468854f1ec7e1e696;p=openwrt%2Fstaging%2Fchunkeey.git 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 SVN-Revision: 34542 --- diff --git a/package/network/ipv6/ipv6-support/Makefile b/package/network/ipv6/ipv6-support/Makefile index 21d5c00f95..c921105c9e 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 1d19a681d4..b9428dd330 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 4fc22d0fab..853918b22d 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 479ed680a7..37173781a4 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 }