meshwizard: add option addchannelbefore
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_olsrd_interface.sh
index f9f07aa..edb5eea 100755 (executable)
@@ -4,7 +4,7 @@
 
 net=$1
 
-. /etc/functions.sh
+. /lib/functions.sh
 . $dir/functions.sh
 
 # Rename interface for $netrenamed
@@ -44,3 +44,17 @@ if [ -n "$dhcprange" ]; then
                uci_commitverbose "Setup HNA for network $dhcprange" olsrd
        fi
 fi
+
+# Set Hna entry for ipv6 net for static ipv6 config
+uci -q delete olsrd.${netrenamed}static
+if [ "$ipv6_enabled" = "1" ] && [ "$ipv6_config" = "static" ]; then
+       local v6range="$(uci -q get meshwizard.netconfig.$net\_ip6addr)"
+       local v6net="$(echo $v6range | cut -d '/' -f 1)"
+       local v6mask="$(echo $v6range | cut -d '/' -f 2)"
+       if [ -n "$v6net" ] && [ -n "$v6mask" ]; then
+               uci set olsrd.${netrenamed}static="Hna6"
+               uci set olsrd.${netrenamed}static.netaddr="$v6net"
+               uci set olsrd.${netrenamed}static.prefix="$v6mask"
+               uci_commitverbose "Setup HNA for network $v6range" olsrd
+       fi
+fi