contrib/meshwizard: Add initial support for ipv6 config (with auto-ipv6-ib and dhcpv6)
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_network.sh
index 1215c95..fc3ca9d 100755 (executable)
@@ -23,6 +23,19 @@ uci batch << EOF
        set network.$netrenamed.netmask="$netmask"
 EOF
 
+# Setup IPv6 for the interface
+local ip6addr
+if [ "$profile_ipv6" = 1 ]; then
+       if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+               # get interface mac
+               local device="$(uci -p/var/state -q get network.$netrenamed.ifname)"
+               if [ -n "device" ]; then
+                       ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $device)"
+               fi
+               uci set network.$netrenamed.ip6addr="${ip6addr}/112"
+       fi
+fi
+
 uci_commitverbose "Setup interface $netrenamed" network
 
 # setup dhcp alias/interface