From: Steven Barth Date: Thu, 27 Dec 2012 14:10:17 +0000 (+0000) Subject: ipv6-support: * Automatically detect and propagate MTU from upstream interfaces ... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=01059c8914b9e125fbd93c64dba7dd92e6c9e81c;p=openwrt%2Fstaging%2Fyousong.git ipv6-support: * Automatically detect and propagate MTU from upstream interfaces * Add site-border feature (RFC 6204, ULA-4) * Fix a typo SVN-Revision: 34896 --- diff --git a/package/network/ipv6/ipv6-support/Makefile b/package/network/ipv6/ipv6-support/Makefile index 76c97c2098..a8df354783 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-23 +PKG_VERSION:=2012-12-27 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 7e69b3f6bd..e9e88cf26e 100755 --- a/package/network/ipv6/ipv6-support/files/dhcpv6.sh +++ b/package/network/ipv6/ipv6-support/files/dhcpv6.sh @@ -15,11 +15,11 @@ resolve_network network "$device" # Announce prefixes for prefix in $PREFIXES; do - announce_prefix "$prefix" "$network" + announce_prefix "$prefix" "$network" "$device" done for prefix in $PREFIXES_LOST; do - announce_prefix "$prefix" "$network" delprefix + announce_prefix "$prefix" "$network" "$device" delprefix done diff --git a/package/network/ipv6/ipv6-support/files/network6.config b/package/network/ipv6/ipv6-support/files/network6.config index ce85dbe8b6..7385eebfb4 100644 --- a/package/network/ipv6/ipv6-support/files/network6.config +++ b/package/network/ipv6/ipv6-support/files/network6.config @@ -1,5 +1,6 @@ config global global option ula_prefix auto + option site_border 1 config interface wan option mode dhcpv6 diff --git a/package/network/ipv6/ipv6-support/files/support.sh b/package/network/ipv6/ipv6-support/files/support.sh index 261ff1e8b3..405cc32ad7 100644 --- a/package/network/ipv6/ipv6-support/files/support.sh +++ b/package/network/ipv6/ipv6-support/files/support.sh @@ -11,7 +11,7 @@ conf_get() { local __return="$1" local __device="$2" local __option="$3" - local __value=$(cat "/proc/sys/net/ipv6/conf/$device/$option") + local __value=$(cat "/proc/sys/net/ipv6/conf/$__device/$__option") eval "$__return=$__value" } @@ -110,8 +110,9 @@ setup_npt_chain() { announce_prefix() { local prefix="$1" local network="$2" - local cmd="$3" - local type="$4" + local device="$3" + local cmd="$4" + local type="$5" local addr=$(echo "$prefix" | cut -d/ -f1) local rem=$(echo "$prefix" | cut -d/ -f2) @@ -142,6 +143,12 @@ announce_prefix() { [ "$prefix_action" == "npt" ] && msg="$msg"', "npt": 1' [ "$type" == "secondary" ] && msg="$msg"', "secondary": 1' + + # Detect MTU + local mtu + conf_get mtu "$device" mtu + msg="$msg"', "mtu": '"$mtu" + ubus call 6distributed "$cmd" "$msg}" } @@ -364,6 +371,7 @@ disable_interface() { enable_ula_prefix() { local network="$1" local ula="$2" + local device="$3" [ -z "$ula" ] && ula="global" # ULA-integration @@ -392,7 +400,7 @@ enable_ula_prefix() { } # Announce ULA - [ -n "$ula_prefix" ] && announce_prefix "$ula_prefix" "$network" newprefix secondary + [ -n "$ula_prefix" ] && announce_prefix "$ula_prefix" "$network" "$device" newprefix secondary } @@ -410,12 +418,12 @@ enable_static() { conf_set "$device" forwarding 1 # Enable ULA - enable_ula_prefix "$network" + enable_ula_prefix "$network" global "$device" # Compatibility (deprecated) - enable_ula_prefix "$network" "$network" + enable_ula_prefix "$network" "$network" "$device" # Announce all static prefixes - config_list_foreach "$network" static_prefix announce_prefix $network + config_list_foreach "$network" static_prefix announce_prefix "$network" "$device" # start relay if there are forced relay members restart_relay "$network" @@ -506,7 +514,7 @@ enable_6to4() { local prefix="" network_get_ipaddr6 prefix "$network" - announce_prefix "$prefix/$prefixlen" "$network" + announce_prefix "$prefix/$prefixlen" "$network" "$device" } @@ -529,4 +537,11 @@ enable_interface() [ "$mode" == "router" ] && enable_router "$network" "$device" [ "$mode" == "6to4" -o "$mode" == "6rd" ] && enable_6to4 "$network" "$device" "$mode" [ "$mode" == "relay" ] && restart_master_relay "$network" forced + + # Create / Delete site border + local site_border + local cmd="delulaborder" + config_get_bool site_border global site_border 0 + [ "$site_border" == "1" ] && cmd="newulaborder" + ubus call 6distributed "$cmd" }