From 4f1e85bd8cc8133e978e94bdccded514582e1aa3 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 6 Mar 2018 15:44:50 +0100 Subject: [PATCH 1/5] net/mwan3: add connected/disconnected ACTION to mwan3track Add a new ACTIONs: * connected ACTION is called once if mwan3track reach all configured track_ips * disconnected ACTION is called once if mwan3track is unable to reach the track_ips The connected/disconnected will called only by mwan3track in opposite the ACTIONs ifup/ifdown will also be called by netifd. Signed-off-by: Florian Eckert --- net/mwan3/files/usr/sbin/mwan3track | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 2e6f0ffdd..e8080b59c 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -142,6 +142,7 @@ main() { echo "offline" > /var/run/mwan3track/$1/STATUS $LOG notice "Interface $1 ($2) is offline" env -i ACTION=ifdown INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface + env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface score=0 fi else @@ -162,6 +163,7 @@ main() { if [ $score -eq $up ]; then $LOG notice "Interface $1 ($2) is online" echo "online" > /var/run/mwan3track/$1/STATUS + env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface env -i ACTION=ifup INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface exit 0 fi From 7c178353f0984189c1a1a507585a827b70b65ec7 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 14 Mar 2018 10:25:14 +0100 Subject: [PATCH 2/5] net/mwan3: remove unused local variables Remove unused local variables 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 7a4f1f2c8..e59f7c9b2 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -58,7 +58,7 @@ mwan3_id2mask() mwan3_init() { local bitcnt - local mmdefault mmblackhole mmunreachable + local mmdefault [ -d $MWAN3_STATUS_DIR ] || mkdir -p $MWAN3_STATUS_DIR/iface_state From 270245e6d47162d5b2400381e6ba66b528241ef4 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 14 Mar 2018 11:57:02 +0100 Subject: [PATCH 3/5] net/mwan3: deviate max interface value from mmx_mask value We need always three of the firewall mask value for * default routing table * blackhole * unreachable the other will be used for the interfaces. * If we have set the mmx_mask to max 0xFF00 (8 bit set) we could use max 252 interfaces. * If we have set the mmx_mask to min 0x0E00 (3 bit set) we could use max 4 interfaces. Only the ones are counting from the firewall mask value. Minimal three firewall mask bit vaules must be set. Maximal eight firewall mask bit vaules could be set. Table overview mmx_mask value bits vs. max interfaces mmx_mask value bits set 1 -> not usefull mmx_mask value bits set 2 -> not usefull mmx_mask value bits set 3 -> 4 Interfaces (mask example 0x0E) mmx_mask value bits set 4 -> 12 Interfaces mmx_mask value bits set 5 -> 28 Interfaces mmx_mask value bits set 6 -> 60 Interfaces mmx_mask value bits set 7 -> 124 Interfaces mmx_mask value bits set 8 -> 252 Interfaces (mask example 0xFF) Signed-off-by: Florian Eckert --- net/mwan3/files/lib/mwan3/mwan3.sh | 8 ++++++++ net/mwan3/files/usr/sbin/mwan3 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index e59f7c9b2..275723008 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -10,6 +10,7 @@ CONNTRACK_FILE="/proc/net/nf_conntrack" MWAN3_STATUS_DIR="/var/run/mwan3" MWAN3TRACK_STATUS_DIR="/var/run/mwan3track" +MWAN3_INTERFACE_MAX="" DEFAULT_LOWEST_METRIC=256 MMX_MASK="" MMX_DEFAULT="" @@ -65,11 +66,18 @@ mwan3_init() # mwan3's MARKing mask (at least 3 bits should be set) if [ -e "${MWAN3_STATUS_DIR}/mmx_mask" ]; then MMX_MASK=$(cat "${MWAN3_STATUS_DIR}/mmx_mask") + MWAN3_INTERFACE_MAX=$(uci_get_state mwan3 globals iface_max) else config_load mwan3 config_get MMX_MASK globals mmx_mask '0xff00' echo "$MMX_MASK" > "${MWAN3_STATUS_DIR}/mmx_mask" $LOG notice "Using firewall mask ${MMX_MASK}" + + bitcnt=$(mwan3_count_one_bits MMX_MASK) + mmdefault=$(((1<0) if($i+0<255) {print;break}}'); do + for route in $(seq 1 $MWAN3_INTERFACE_MAX); do $IP route flush table $route &> /dev/null done From ae70008ed7e552b10d645e9eb27ff18a671138cb Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 16 Mar 2018 14:36:24 +0100 Subject: [PATCH 4/5] net/mwan3: update hint in mwan3.user for connected/disconnected Signed-off-by: Florian Eckert --- net/mwan3/files/etc/mwan3.user | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/mwan3/files/etc/mwan3.user b/net/mwan3/files/etc/mwan3.user index 3c1f9fb7a..39989ab9b 100644 --- a/net/mwan3/files/etc/mwan3.user +++ b/net/mwan3/files/etc/mwan3.user @@ -7,6 +7,10 @@ # # There are three main environment variables that are passed to this script. # -# $ACTION Either "ifup" or "ifdown" +# $ACTION +# Is called by netifd and mwan3track +# Is called by netifd and mwan3track +# Is only called by mwan3track if tracking was successful +# Is only called by mwan3track if tracking has failed # $INTERFACE Name of the interface which went up or down (e.g. "wan" or "wwan") # $DEVICE Physical device name which interface went up or down (e.g. "eth0" or "wwan0") From 3c2e05d4409cb858e327a30ab76b01340aff33fd Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 16 Mar 2018 14:00:39 +0100 Subject: [PATCH 5/5] net/mwan3: update version to 2.6.11 Signed-off-by: Florian Eckert --- net/mwan3/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index c3bf5ee68..b1a2bec94 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 -PKG_VERSION:=2.6.10 -PKG_RELEASE:=2 +PKG_VERSION:=2.6.11 +PKG_RELEASE:=1 PKG_MAINTAINER:=Florian Eckert PKG_LICENSE:=GPLv2