- # find delegation target
- local adv_interface
- config_get adv_interface "$cfg" adv_interface
-
- local adv_ifname
- config_get adv_ifname "${adv_interface:-lan}" ifname
-
- local adv_subnet=$(uci_get network "$cfg" adv_subnet)
-
- grep -qs "^ *$adv_ifname:" /proc/net/dev && {
- local subnet6="$prefix6:${adv_subnet:-1}::1/64"
-
- logger -t "$link" " * Advertising IPv6 subnet $subnet6 on ${adv_interface:-lan} ($adv_ifname)"
- ip -6 addr add $subnet6 dev $adv_ifname
- uci_set_state network "$cfg" adv_subnet "$subnet6"
- uci_set_state network "$cfg" adv_ifname "$adv_ifname"
-
- [ -f /etc/config/radvd ] && /etc/init.d/radvd enabled && {
- local sid="6to4_$cfg"
-
- uci -q batch <<-EOF
- revert radvd.iface_$sid
- revert radvd.prefix_$sid
- set radvd.iface_$sid=interface
- set radvd.iface_$sid.ignore=0
- set radvd.iface_$sid.interface=${adv_interface:-lan}
- set radvd.iface_$sid.IgnoreIfMissing=1
- set radvd.iface_$sid.AdvSendAdvert=1
- set radvd.iface_$sid.MaxRtrAdvInterval=30
- set radvd.prefix_$sid=prefix
- set radvd.prefix_$sid.ignore=0
- set radvd.prefix_$sid.interface=${adv_interface:-lan}
- set radvd.prefix_$sid.prefix=0:0:0:${adv_subnet:-1}::/64
- set radvd.prefix_$sid.AdvOnLink=1
- set radvd.prefix_$sid.AdvAutonomous=1
- set radvd.prefix_$sid.AdvValidLifetime=300
- set radvd.prefix_$sid.AdvPreferredLifetime=120
- set radvd.prefix_$sid.Base6to4Interface=$wancfg
- EOF
-
- /etc/init.d/radvd restart
+ local adv_subnets=""
+
+ for adv_interface in ${adv_interface:-lan}; do
+ local adv_ifname
+ config_get adv_ifname "${adv_interface:-lan}" ifname
+
+ grep -qs "^ *$adv_ifname:" /proc/net/dev && {
+ local subnet6="$(printf "%s:%x::1/64" "$prefix6" $adv_subnet)"
+
+ logger -t "$link" " * Advertising IPv6 subnet $subnet6 on ${adv_interface:-lan} ($adv_ifname)"
+ ip -6 addr add $subnet6 dev $adv_ifname
+
+ set_6to4_radvd_interface "$sid" "$adv_interface" "$mtu"
+ set_6to4_radvd_prefix "$sid" "$adv_interface" \
+ "$wancfg" "$(printf "0:0:0:%x::/64" $adv_subnet)" \
+ "$adv_valid_lifetime" "$adv_preferred_lifetime"
+
+ adv_subnets="${adv_subnets:+$adv_subnets }$adv_ifname:$subnet6"
+ adv_subnet=$(($adv_subnet + 1))