# Argument $1: network interface
net="$1"
-. /etc/functions.sh
+. /lib/functions.sh
. $dir/functions.sh
# Setup a (new) interface section for $net
-ipaddr=$(uci get meshwizard.netconfig.$net\_ip4addr)
+ipaddr=$(uci -q get meshwizard.netconfig.$net\_ip4addr)
+ip6addr=$(uci -q get meshwizard.netconfig.$net\_ip6addr)
[ -z "$ipaddr" ] && msg_missing_value meshwizard $net\_ip4addr
netmask=$(uci -q get meshwizard.netconfig.$net\_netmask)
# 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
+if [ "$ipv6_enabled" = 1 ]; then
+ if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
+ ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $netrenamed)"
uci set network.$netrenamed.ip6addr="${ip6addr}/112"
fi
+ if [ "$ipv6_config" = "static" ] && [ -n "$ip6addr" ]; then
+ uci set network.$netrenamed.ip6addr="$ip6addr"
+ fi
fi
uci_commitverbose "Setup interface $netrenamed" network