mwan3: only send disconnected event if interface was connected before
Up to now on every interface down event a mwan3 disconnected event was send. This is wrong because if the interface was never connected, then a disconnected event should not get generated. This commit fixes this bug. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
a6606bed17
commit
997c0842ca
1 changed files with 11 additions and 3 deletions
|
@ -105,14 +105,22 @@ validate_wrap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnected() {
|
disconnected() {
|
||||||
|
local status="$(cat ${MWAN3TRACK_STATUS_DIR}/${INTERFACE}/STATUS)"
|
||||||
|
|
||||||
STATUS='offline'
|
STATUS='offline'
|
||||||
echo "offline" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
|
echo "offline" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
|
||||||
get_uptime > $MWAN3TRACK_STATUS_DIR/$INTERFACE/OFFLINE
|
get_uptime > $MWAN3TRACK_STATUS_DIR/$INTERFACE/OFFLINE
|
||||||
echo "0" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/ONLINE
|
echo "0" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/ONLINE
|
||||||
score=0
|
score=0
|
||||||
[ "$1" = 1 ] && return
|
[ "$1" = 1 ] && return
|
||||||
|
|
||||||
|
# Only execute disconnectd action if status was online or disconnecting
|
||||||
|
if [ "$status" = "online" ] || [ "$status" = "disconnecting" ]; then
|
||||||
LOG notice "Interface $INTERFACE ($DEVICE) is offline"
|
LOG notice "Interface $INTERFACE ($DEVICE) is offline"
|
||||||
env -i ACTION="disconnected" INTERFACE="$INTERFACE" DEVICE="$DEVICE" /sbin/hotplug-call iface
|
env -i ACTION="disconnected" INTERFACE="$INTERFACE" DEVICE="$DEVICE" /sbin/hotplug-call iface
|
||||||
|
else
|
||||||
|
LOG notice "Skip disconnected event for $INTERFACE ($DEVICE)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
connected() {
|
connected() {
|
||||||
|
@ -391,8 +399,8 @@ main() {
|
||||||
|
|
||||||
if [ "${IFDOWN_EVENT}" -eq 1 ]; then
|
if [ "${IFDOWN_EVENT}" -eq 1 ]; then
|
||||||
LOG debug "Register ifdown event on interface ${INTERFACE} (${DEVICE})"
|
LOG debug "Register ifdown event on interface ${INTERFACE} (${DEVICE})"
|
||||||
disabled
|
|
||||||
disconnected
|
disconnected
|
||||||
|
disabled
|
||||||
IFDOWN_EVENT=0
|
IFDOWN_EVENT=0
|
||||||
fi
|
fi
|
||||||
if [ "${IFUP_EVENT}" -eq 1 ]; then
|
if [ "${IFUP_EVENT}" -eq 1 ]; then
|
||||||
|
|
Loading…
Reference in a new issue