From ec5542ab2bd192aca9efc97b2f613b849457b19e Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 25 Aug 2017 11:42:32 +0200 Subject: [PATCH 1/4] net/mwan3: mwan3track skip track ips if realibility is accomplished If enough tracking ip are pinged skip the reset. They are not needed anymore to mark the interface as up. Signed-off-by: Florian Eckert --- net/mwan3/files/usr/sbin/mwan3track | 30 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 91136e8f8..0e1c4f2b8 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -92,20 +92,24 @@ main() { sleep_time=$interval for track_ip in $track_ips; do - case "$track_method" in - ping) - ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null ;; - arping) - arping -I $DEVICE -c $count -w $timeout -q $track_ip &> /dev/null ;; - httping) - httping -y $SRC_IP -c $count -t $timeout -q $track_ip &> /dev/null ;; - esac - if [ $? -eq 0 ]; then - let host_up_count++ - echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip} + if [ $host_up_count -lt $reliability ]; then + case "$track_method" in + ping) + ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null ;; + arping) + arping -I $DEVICE -c $count -w $timeout -q $track_ip &> /dev/null ;; + httping) + httping -y $SRC_IP -c $count -t $timeout -q $track_ip &> /dev/null ;; + esac + if [ $? -eq 0 ]; then + let host_up_count++ + echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip} + else + let lost++ + echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip} + fi else - let lost++ - echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip} + echo "skipped" > /var/run/mwan3track/$1/TRACK_${track_ip} fi done From 0c678d39cc336c05693001ab912a4b2a343d2e80 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 30 Aug 2017 15:26:29 +0200 Subject: [PATCH 2/4] net/mwan3: if initial_state is offline set status to unknown To show that the status of the interface is neither offline nor online set the status to unknown. Signed-off-by: Florian Eckert --- net/mwan3/files/usr/sbin/mwan3track | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 0e1c4f2b8..e94ada815 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -81,8 +81,8 @@ main() { local sleep_time=0 local turn=0 - if [ "$STATUS" = "offline" ]; then - echo "offline" > /var/run/mwan3track/$1/STATUS + if [ "$STATUS" = "unknown" ]; then + echo "unknown" > /var/run/mwan3track/$1/STATUS score=0 else echo "online" > /var/run/mwan3track/$1/STATUS From a8ccaa1f0fba097cdb8a603e9b91824ce0ca972d Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 1 Sep 2017 10:01:34 +0200 Subject: [PATCH 3/4] 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 --- net/mwan3/files/etc/hotplug.d/iface/14-mwan3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mwan3/files/etc/hotplug.d/iface/14-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/14-mwan3 index 1ddf0acca..2c25b4f4c 100644 --- a/net/mwan3/files/etc/hotplug.d/iface/14-mwan3 +++ b/net/mwan3/files/etc/hotplug.d/iface/14-mwan3 @@ -22,7 +22,7 @@ config_get local_source globals local_source 'none' } 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}" != "" ] && { 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 @@ -37,7 +37,7 @@ usleep 10000 else ip addr add "${src_ip}/32" 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 } mwan3_unlock From faa86fe0f485ad78d4180d9e84288738a7514de7 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 1 Sep 2017 11:13:57 +0200 Subject: [PATCH 4/4] net/mwan3: update version 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 d5e1fbe5a..addae7e54 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 -PKG_VERSION:=2.6.3 -PKG_RELEASE:=2 +PKG_VERSION:=2.6.4 +PKG_RELEASE:=1 PKG_MAINTAINER:=Florian Eckert PKG_LICENSE:=GPLv2