Use common function to toggle ip address in /var/state/mwan3.
Change also to use toggle function and not set function. If ip address
is often changed every change is saved to /var/state/mwan3.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
}
mwan3_lock
-src_ip=$(uci -q -P /var/state get mwan3.globals.src_ip 2>/dev/null)
+src_ip=$(uci_get_state mwan3 globals src_ip)
[ "${src_ip}" != "" ] && {
ip route del default via "${src_ip}" dev lo 1>/dev/null 2>&1
ip addr del "${src_ip}/32" dev lo 1>/dev/null 2>&1
else
ip addr add "${src_ip}/32" dev lo
ip route add default via "${src_ip}" dev lo
- uci -q -P /var/state set mwan3.globals.src_ip="${src_ip}"
+ uci_toggle_state mwan3 globals src_ip "${src_ip}"
fi
}
mwan3_unlock