mwan3: fix race condition on mwan3 restart

This adjustment of the locks fixes the race condition when a mwan3
hotplug script and a mwan3 command are running at the same time.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 2dac1bcdc9)
This commit is contained in:
Florian Eckert
2020-07-22 09:19:55 +02:00
parent 5bfc1c9cfd
commit 294e7503b5
4 changed files with 47 additions and 16 deletions
+9 -5
View File
@@ -12,19 +12,24 @@ if [ "$ACTION" == "ifup" ]; then
[ -n "$DEVICE" ] || exit 3
fi
mwan3_lock "$ACTION" "$INTERFACE"
config_load mwan3
config_get_bool enabled globals 'enabled' '0'
[ ${enabled} -gt 0 ] || exit 0
[ ${enabled} -gt 0 ] || {
mwan3_unlock "$ACTION" "$INTERFACE"
exit 0
}
mwan3_lock "$ACTION" "$INTERFACE"
mwan3_init
mwan3_set_connected_iptables
mwan3_set_custom_ipset
mwan3_unlock "$ACTION" "$INTERFACE"
config_get enabled $INTERFACE enabled 0
config_get initial_state $INTERFACE initial_state "online"
[ "$enabled" == "1" ] || exit 0
[ "${enabled}" == "1" ] || {
mwan3_unlock "$ACTION" "$INTERFACE"
exit 0
}
if [ "$ACTION" == "ifup" ]; then
config_get family $INTERFACE family ipv4
@@ -58,7 +63,6 @@ else
running=1
fi
mwan3_lock "$ACTION" "$INTERFACE"
$LOG notice "Execute "$ACTION" event on interface $INTERFACE (${DEVICE:-unknown})"
case "$ACTION" in