mwan3: add nping to tracking method 7738/head
authorMichael Stoll <michael.stoll@meadow-robotics.com>
Tue, 4 Dec 2018 13:47:26 +0000 (14:47 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 21 Dec 2018 10:21:31 +0000 (11:21 +0100)
Signed-off-by: Michael Stoll <michael.stoll@meadow-robotics.com>
net/mwan3/Makefile
net/mwan3/files/usr/sbin/mwan3track

index b3ea84d905eedee116fdc58bdc30954d7e3241ed..23748eab966261fec9eb8fd755002d93bcbb3e72 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mwan3
-PKG_VERSION:=2.7.6
+PKG_VERSION:=2.7.7
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
 PKG_LICENSE:=GPLv2
index 4208784725fac630f00fc9ac36af1fd7781d1484..f268f90b25bdc07bbeaf7c1147b3ff2d9de56bc5 100755 (executable)
@@ -43,6 +43,12 @@ validate_track_method() {
                                return 1
                        }
                        ;;
+               nping-*)
+                       which nping 1>/dev/null 2>&1 || {
+                               $LOG warn "Missing nping. Please install nping package."
+                               return 1
+                       }
+                       ;;
                *)
                        $LOG warn "Unsupported tracking method: $track_method"
                        return 2
@@ -146,6 +152,18 @@ main() {
                                                httping -y $SRC_IP -c $count -t $timeout -q $track_ip &> /dev/null
                                                result=$?
                                        ;;
+                                       nping-tcp)
+                                               result=$(nping -e $DEVICE -c $count $track_ip --tcp | grep Lost | awk '{print $12}')
+                                       ;;
+                                       nping-udp)
+                                               result=$(nping -e $DEVICE -c $count $track_ip --udp | grep Lost | awk '{print $12}')
+                                       ;;
+                                       nping-icmp)
+                                               result=$(nping -e $DEVICE -c $count $track_ip --icmp | grep Lost | awk '{print $12}')
+                                       ;;
+                                       nping-arp)
+                                               result=$(nping -e $DEVICE -c $count $track_ip --arp | grep Lost | awk '{print $12}')
+                                       ;;
                                esac
                                if [ $check_quality -eq 0 ]; then
                                        if [ $result -eq 0 ]; then