net/mwan3: registrate SIGUSR1 trap on interface down event

If interface is getting down by netifd (unplug ethernet cable)
mwan3track will not recognize this change. It will also generate an
additional down event when he notice does his tracking interface is offline.

Mwan3track will now be informed by a signal (trap) USR1 during down event
that the interface is already down. An additional down event will not be
generated.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2017-04-06 15:41:05 +02:00
parent 84df06e0dc
commit b216fd3642
3 changed files with 34 additions and 0 deletions
+17
View File
@@ -399,6 +399,23 @@ mwan3_track()
fi
}
mwan3_track_signal()
{
local pid status
if [ -f "/var/run/mwan3track-${1}.pid" ]; then
pid="$(cat "/var/run/mwan3track-${1}.pid")"
status="$(pgrep -f mwan3track | grep "${pid}")"
if [ "${status}" != "" ]; then
kill -USR1 "${pid}"
else
$LOG warn "Unable to send signal USR1 to mwan3track on interface $1 with pid ${pid}"
fi
else
$LOG warn "Unable to find \"/var/run/mwan3track-${1}.pid\" file for mwan3track on interface $1"
fi
}
mwan3_set_policy()
{
local iface_count id iface family metric probability weight