Toggle the 6RD interface only when the 6rd UCI configuration has been updated or when the DHCPv4 client gets in the bound state. By doing so no RA's will be send in quick succession on the LAN after every DHCPv4 renew as described in https://lists.openwrt.org/pipermail/openwrt-devel/2013-November/022296.html
Signed-off-by: Hans Dedecker <[email protected]> --- .../config/netifd/files/lib/netifd/dhcp.script | 34 +++++++++++++------- 1 files changed, 22 insertions(+), 12 deletions(-) diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script index 50163da..446ac2e 100755 --- a/package/network/config/netifd/files/lib/netifd/dhcp.script +++ b/package/network/config/netifd/files/lib/netifd/dhcp.script @@ -36,27 +36,37 @@ setup_interface () { proto_send_update "$INTERFACE" if [ -n "$IFACE6RD" -a -n "$ip6rd" ]; then - local v4mask="${ip6rd%% *}" + local ip4prefixlen="${ip6rd%% *}" ip6rd="${ip6rd#* }" - local ip6rdprefixlen="${ip6rd%% *}" + local ip6prefixlen="${ip6rd%% *}" ip6rd="${ip6rd#* }" - local ip6rdprefix="${ip6rd%% *}" + local ip6prefix="${ip6rd%% *}" ip6rd="${ip6rd#* }" - local ip6rdbr="${ip6rd%% *}" + local peeraddr="${ip6rd%% *}" + local event="$1" + local set_uci=0 + for i in peeraddr ip6prefix ip6prefixlen ip4prefixlen; do + if ! uci get network.$IFACE6RD.$i &>/dev/null || + eval "[ $(uci get network.$IFACE6RD.$i) != \$$i ]"; then + set_uci=1 + break + fi + done + + [ "$set_uci" -eq 1 ] && { uci -q batch <<-EOF >/dev/null set network.$IFACE6RD.proto=6rd set network.$IFACE6RD.auto=0 -set network.$IFACE6RD.peeraddr=$ip6rdbr -set network.$IFACE6RD.ip4prefixlen=$v4mask -set network.$IFACE6RD.ip6prefix=$ip6rdprefix -set network.$IFACE6RD.ip6prefixlen=$ip6rdprefixlen +set network.$IFACE6RD.peeraddr=$peeraddr +set network.$IFACE6RD.ip4prefixlen=$ip4prefixlen +set network.$IFACE6RD.ip6prefix=$ip6prefix +set network.$IFACE6RD.ip6prefixlen=$ip6prefixlen commit network EOF + } - ifdown "$IFACE6RD" - /etc/init.d/network reload - ifup "$IFACE6RD" + [ "$set_uci" -eq 1 ] || [ "$event" == bound ] && ifup "$IFACE6RD" fi # TODO @@ -76,7 +86,7 @@ case "$1" in deconfig_interface ;; renew|bound) - setup_interface + setup_interface "$1" ;; esac -- 1.7.1 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
