Browse Source

net/mwan3: add lock for mwan3 hotplug script

If more then one interface get up/down at once mwan3 could be in a
undefined state, because more then one mwan3 hotplug script are running
and editing the iptables.

Lock the critical section should solve this issue.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
lilik-openwrt-22.03
Florian Eckert 7 years ago
parent
commit
b6e9debc1b
2 changed files with 11 additions and 0 deletions
  1. +3
    -0
      net/mwan3/files/etc/hotplug.d/iface/15-mwan3
  2. +8
    -0
      net/mwan3/files/lib/mwan3/mwan3.sh

+ 3
- 0
net/mwan3/files/etc/hotplug.d/iface/15-mwan3 View File

@ -38,6 +38,7 @@ if [ "$ACTION" == "ifup" ]; then
[ -n "$gateway" ] || exit 9
fi
mwan3_lock
$LOG notice "$ACTION interface $INTERFACE (${DEVICE:-unknown})"
case "$ACTION" in
@ -64,4 +65,6 @@ case "$ACTION" in
;;
esac
mwan3_unlock
exit 0

+ 8
- 0
net/mwan3/files/lib/mwan3/mwan3.sh View File

@ -8,6 +8,14 @@ IPT6="ip6tables -t mangle -w"
LOG="logger -t mwan3 -p"
CONNTRACK_FILE="/proc/net/nf_conntrack"
mwan3_lock() {
lock /var/run/mwan3.lock
}
mwan3_unlock() {
lock -u /var/run/mwan3.lock
}
mwan3_get_iface_id()
{
local _tmp _iface _iface_count


Loading…
Cancel
Save