ipv6-support: * Automatically detect and propagate MTU from upstream interfaces ...
authorSteven Barth <cyrus@openwrt.org>
Thu, 27 Dec 2012 14:10:17 +0000 (14:10 +0000)
committerSteven Barth <cyrus@openwrt.org>
Thu, 27 Dec 2012 14:10:17 +0000 (14:10 +0000)
SVN-Revision: 34896

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 76c97c209818a106073677cb6ae00253d2e05d55..a8df354783caff1b2e5f1a3f1e13c94a996c3a20 100644 (file)
@@ -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
index 7e69b3f6bdca1431453986b3f11a6e6c601196c1..e9e88cf26ea3aeaa5257b4f222d5c653e410d314 100755 (executable)
@@ -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
 
 
index ce85dbe8b6c14ebd0b224ea248c8f9e689f51be0..7385eebfb4384052bd2559b66ebefbe7089f306b 100644 (file)
@@ -1,5 +1,6 @@
 config global global
        option ula_prefix       auto
+       option site_border      1
 
 config interface wan
        option mode             dhcpv6
index 261ff1e8b396a231af740b1c46c4094f44ad9a3a..405cc32ad72437b2897961de7fb374b5552e57a5 100644 (file)
@@ -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"
 }