Browse Source

net/mwan3: fix /var/state issue in 14-mwan3 hotplug

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>
lilik-openwrt-22.03
Florian Eckert 7 years ago
parent
commit
a8ccaa1f0f
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      net/mwan3/files/etc/hotplug.d/iface/14-mwan3

+ 2
- 2
net/mwan3/files/etc/hotplug.d/iface/14-mwan3 View File

@ -22,7 +22,7 @@ config_get local_source globals local_source 'none'
} }
mwan3_lock 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}" != "" ] && { [ "${src_ip}" != "" ] && {
ip route del default via "${src_ip}" dev lo 1>/dev/null 2>&1 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 ip addr del "${src_ip}/32" dev lo 1>/dev/null 2>&1
@ -37,7 +37,7 @@ usleep 10000
else else
ip addr add "${src_ip}/32" dev lo ip addr add "${src_ip}/32" dev lo
ip route add default via "${src_ip}" 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 fi
} }
mwan3_unlock mwan3_unlock


Loading…
Cancel
Save