From b6e9debc1b97f9e4be70fb51404831ed870d844a Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 22 Jun 2017 11:48:01 +0200 Subject: [PATCH 1/3] 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 --- net/mwan3/files/etc/hotplug.d/iface/15-mwan3 | 3 +++ net/mwan3/files/lib/mwan3/mwan3.sh | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 index e3fd16cef..ca8f24daf 100644 --- a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 +++ b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 @@ -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 diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index 3798d7eb0..f4c55a96e 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -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 From 99229475b767d74595e46738fe04977ddcfb59d4 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 22 Jun 2017 11:53:35 +0200 Subject: [PATCH 2/3] net/mwan3: simplify tracking status statement command Signed-off-by: Florian Eckert --- net/mwan3/files/lib/mwan3/mwan3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index f4c55a96e..5681f3ec5 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -738,7 +738,7 @@ mwan3_report_iface_status() config_list_foreach $1 track_ip mwan3_list_track_ips if [ -n "$track_ips" ]; then - if [ -n "$(ps -w | grep mwan3track | grep -v grep | sed '/.*\/usr\/sbin\/mwan3track \([^ ]*\) .*$/!d;s//\1/' | awk '$1 == "'$1'"')" ]; then + if [ -n "$(pgrep -f "mwan3track $1")" ]; then tracking="active" else tracking="down" From 085a76bebf0c0df32d64a73af5bf63248e44efdd Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 22 Jun 2017 11:54:12 +0200 Subject: [PATCH 3/3] net/mwan3: update version Signed-off-by: Florian Eckert --- net/mwan3/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index 394a642f9..8bd1e2f11 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 -PKG_VERSION:=2.5.2 +PKG_VERSION:=2.5.3 PKG_RELEASE:=5 PKG_MAINTAINER:=Florian Eckert PKG_LICENSE:=GPLv2