net/mwan3: add connected/disconnected ACTION to mwan3track
authorFlorian Eckert <redacted>
Tue, 6 Mar 2018 14:44:50 +0000 (15:44 +0100)
committerFlorian Eckert <redacted>
Fri, 16 Mar 2018 13:44:04 +0000 (14:44 +0100)
Add a new ACTIONs:

* connected ACTION is called once if mwan3track reach all configured track_ips
* disconnected ACTION is called once if mwan3track is unable to reach the track_ips

The connected/disconnected will called only by mwan3track in opposite
the ACTIONs ifup/ifdown will also be called by netifd.

Signed-off-by: Florian Eckert <redacted>
net/mwan3/files/usr/sbin/mwan3track

index 2e6f0ffddfc12680c2043d33b8e3b2496ba56010..e8080b59c02772c0b56c0378ea472ae10209acfc 100755 (executable)
@@ -142,6 +142,7 @@ main() {
                                echo "offline" > /var/run/mwan3track/$1/STATUS
                                $LOG notice "Interface $1 ($2) is offline"
                                env -i ACTION=ifdown INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface
+                               env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
                                score=0
                        fi
                else
@@ -162,6 +163,7 @@ main() {
                        if [ $score -eq $up ]; then
                                $LOG notice "Interface $1 ($2) is online"
                                echo "online" > /var/run/mwan3track/$1/STATUS
+                               env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
                                env -i ACTION=ifup INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface
                                exit 0
                        fi
git clone https://git.99rst.org/PROJECT