net/mwan3: mwan3track skip track ips if realibility is accomplished
authorFlorian Eckert <fe@dev.tdt.de>
Fri, 25 Aug 2017 09:42:32 +0000 (11:42 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 1 Sep 2017 08:59:49 +0000 (10:59 +0200)
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 <fe@dev.tdt.de>
net/mwan3/files/usr/sbin/mwan3track

index 91136e8f878014fca079acdc78a84b8bcd268a2f..0e1c4f2b86d657638addf64432bf64f10e6ec515 100755 (executable)
@@ -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