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 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 diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 91136e8f8..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 @@ -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