Merge pull request #14996 from TDT-AG/pr/20210302-mwan3

mwan3: add connecting and disconnecting event to mwan3track
This commit is contained in:
Florian Eckert 2021-03-16 14:07:05 +01:00 committed by GitHub
commit ef5921360d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mwan3 PKG_NAME:=mwan3
PKG_VERSION:=2.10.7 PKG_VERSION:=2.10.8
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>, \ PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>, \
Aaron Goodman <aaronjg@alumni.stanford.edu> Aaron Goodman <aaronjg@alumni.stanford.edu>

View file

@ -128,6 +128,24 @@ connected() {
env -i FIRSTCONNECT=$1 ACTION="connected" INTERFACE="$INTERFACE" DEVICE="$DEVICE" /sbin/hotplug-call iface env -i FIRSTCONNECT=$1 ACTION="connected" INTERFACE="$INTERFACE" DEVICE="$DEVICE" /sbin/hotplug-call iface
} }
disconnecting() {
if [ "$STATUS" != "disconnecting" ] ; then
STATUS="disconnecting"
echo "disconnecting" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
LOG notice "Interface $INTERFACE ($DEVICE) is disconnecting"
env -i ACTION="disconnecting" INTERFACE="$INTERFACE" DEVICE="$DEVICE" /sbin/hotplug-call iface
fi
}
connecting() {
if [ "$STATUS" != "connecting" ] ; then
STATUS="connecting"
echo "connecting" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
LOG notice "Interface $INTERFACE ($DEVICE) is connecting"
env -i ACTION="connecting" INTERFACE="$INTERFACE" DEVICE="$DEVICE" /sbin/hotplug-call iface
fi
}
disabled() { disabled() {
STATUS='disabled' STATUS='disabled'
echo "disabled" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS echo "disabled" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
@ -326,6 +344,7 @@ main() {
score=0 score=0
[ ${keep_failure_interval} -eq 1 ] && sleep_time=$failure_interval [ ${keep_failure_interval} -eq 1 ] && sleep_time=$failure_interval
else else
disconnecting
sleep_time=$failure_interval sleep_time=$failure_interval
fi fi
@ -335,6 +354,7 @@ main() {
fi fi
else else
if [ $score -lt $((down+up)) ] && [ $lost -gt 0 ]; then if [ $score -lt $((down+up)) ] && [ $lost -gt 0 ]; then
connecting
LOG info "Lost $((lost*count)) ping(s) on interface $INTERFACE ($DEVICE). Current score: $score" LOG info "Lost $((lost*count)) ping(s) on interface $INTERFACE ($DEVICE). Current score: $score"
fi fi
@ -345,6 +365,7 @@ main() {
echo "online" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS echo "online" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
score=$((down+up)) score=$((down+up))
elif [ $score -le $up ]; then elif [ $score -le $up ]; then
connecting
sleep_time=$recovery_interval sleep_time=$recovery_interval
fi fi