mwan3: support various interface tracking methods

Adds support for interface tracking using either ping, arping or
httping. This allows to track interface status on networks with filtered
ICMP traffic or simply to monitor data link layer etc.

To facilitate binding to a specified interface its IP address is passed
as a new mwan3track parameter. It's currently required by httping
and possibly by other tools that may be added in the future.

Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
This commit is contained in:
Marcin Jurkowski
2017-07-25 19:34:40 +02:00
parent df1f3a41c8
commit de4fc2b5de
4 changed files with 46 additions and 6 deletions
+5 -1
View File
@@ -23,15 +23,19 @@ if [ "$ACTION" == "ifup" ]; then
ubus call network.interface.${INTERFACE}_4 status &>/dev/null
if [ "$?" -eq "0" ]; then
network_get_gateway gateway ${INTERFACE}_4
network_get_ipaddr src_ip ${INTERFACE}_4
else
network_get_gateway gateway $INTERFACE
network_get_ipaddr src_ip ${INTERFACE}
fi
elif [ "$family" = "ipv6" ]; then
ubus call network.interface.${INTERFACE}_6 status &>/dev/null
if [ "$?" -eq "0" ]; then
network_get_gateway6 gateway ${INTERFACE}_6
network_get_ipaddr6 src_ip ${INTERFACE}_6
else
network_get_gateway6 gateway ${INTERFACE}
network_get_ipaddr6 src_ip ${INTERFACE}
fi
fi
@@ -48,7 +52,7 @@ case "$ACTION" in
mwan3_create_iface_rules $INTERFACE $DEVICE
mwan3_create_iface_iptables $INTERFACE $DEVICE
mwan3_create_iface_route $INTERFACE $DEVICE
mwan3_track $INTERFACE $DEVICE
mwan3_track $INTERFACE $DEVICE ${src_ip}
mwan3_set_policies_iptables
mwan3_set_user_rules
mwan3_flush_conntrack $INTERFACE $DEVICE "ifup"