mwan3: fix bugs introduced in 815e83d4 4721/head
authorMarcin Jurkowski <marcin1j@gmail.com>
Thu, 17 Aug 2017 11:20:10 +0000 (13:20 +0200)
committerMarcin Jurkowski <marcin1j@gmail.com>
Thu, 17 Aug 2017 11:20:10 +0000 (13:20 +0200)
Fixes the following bugs introduced in commit 815e83d4:
 - hotplug: invalid parameter order when initial interface state is "online",
   mwan3track expects initial state to be the third argument
 - hotplug: missing source ip address when initial interface state is "offline"
 - mwan3track: source ip address should be the fourth argument

Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
net/mwan3/files/etc/hotplug.d/iface/15-mwan3
net/mwan3/files/usr/sbin/mwan3track

index f9638e62b5989e5a0d954b343655a48790c933f5..83b5f70e0432a9b3bb33718cd75336fd5f19596d 100644 (file)
@@ -68,13 +68,13 @@ case "$ACTION" in
                if [ ${running} -eq 1 -a "${status}" = "online" ]; then
                        mwan3_create_iface_rules $INTERFACE $DEVICE
                        mwan3_create_iface_route $INTERFACE $DEVICE
-                       mwan3_track $INTERFACE $DEVICE ${src_ip} "online"
+                       mwan3_track $INTERFACE $DEVICE "online" "$src_ip"
                        mwan3_set_policies_iptables
                        mwan3_set_user_rules
                        mwan3_flush_conntrack $INTERFACE $DEVICE "ifup"
                else
                        $LOG notice "Starting tracker on interface $INTERFACE (${DEVICE:-unknown})"
-                       mwan3_track $INTERFACE $DEVICE "offline"
+                       mwan3_track $INTERFACE $DEVICE "offline" "$src_ip"
                fi
        ;;
        ifdown)
index bdb793b592d2e80fe9b8e40514bac3133f54e19e..91136e8f878014fca079acdc78a84b8bcd268a2f 100755 (executable)
@@ -52,6 +52,7 @@ main() {
        INTERFACE=$1
        DEVICE=$2
        STATUS=$3
+       SRC_IP=$4
        mkdir -p /var/run/mwan3track/$1
        trap clean_up SIGINT SIGTERM
        trap if_down SIGUSR1
@@ -93,11 +94,11 @@ main() {
                for track_ip in $track_ips; do
                        case "$track_method" in
                                ping)
-                                       ping -I $2 -c $count -W $timeout -s $size -q $track_ip &> /dev/null ;;
+                                       ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null ;;
                                arping)
-                                       arping -I $2 -c $count -w $timeout -q $track_ip &> /dev/null ;;
+                                       arping -I $DEVICE -c $count -w $timeout -q $track_ip &> /dev/null ;;
                                httping)
-                                       httping -y $3 -c $count -t $timeout -q $track_ip &> /dev/null ;;
+                                       httping -y $SRC_IP -c $count -t $timeout -q $track_ip &> /dev/null ;;
                        esac
                        if [ $? -eq 0 ]; then
                                let host_up_count++