aboutsummaryrefslogtreecommitdiff
path: root/net/mwan3
diff options
context:
space:
mode:
authorAaron Goodman <aaronjg@stanford.edu>2020-10-24 12:53:15 -0400
committerAaron Goodman <aaronjg@stanford.edu>2020-10-27 21:40:06 -0400
commit8d4e202fa4aa7c3a549472ead942c976e218dd31 (patch)
treef239e9cb2f1e168aa8b60329a89839f802382fb8 /net/mwan3
parentc374711e609229cfdb572239259db20e1f06aceb (diff)
mwan3: fix mwan3 route handling
- support trailing route space from iproute2 - add routes even when iface is down - fix source_routing argument check - add quotes in logging to better detect issues with trailing spaces Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
Diffstat (limited to 'net/mwan3')
-rwxr-xr-xnet/mwan3/files/usr/sbin/mwan3rtmon16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/mwan3/files/usr/sbin/mwan3rtmon b/net/mwan3/files/usr/sbin/mwan3rtmon
index ee470837e..569b4d172 100755
--- a/net/mwan3/files/usr/sbin/mwan3rtmon
+++ b/net/mwan3/files/usr/sbin/mwan3rtmon
@@ -74,7 +74,7 @@ mwan3_rtmon_route_handle()
route_line=${1##"Deleted "}
route_family=$2
- config_get_boolean source_routing globals source_routing 0
+ config_get_bool source_routing globals source_routing 0
[ $source_routing -eq 0 ] && unset source_routing
if [ "$route_line" = "$1" ]; then
@@ -107,22 +107,22 @@ mwan3_rtmon_route_handle()
local iface=$1
tbl=$($IP route list table $tid 2>/dev/null)$'\n'
- if [ "$(cat /var/run/mwan3track/$iface/STATUS)" != "online" ]; then
- LOG debug "interface $iface is offline - skipping $route_line";
+ if [ -n "$iface" ] && [ "$(mwan3_get_mwan3track_status $iface)" != "active" ]; then
+ LOG debug "interface $iface is disabled - skipping '$route_line'";
return
fi
# check that action needs to be performed. May not need to take action if we
# got a delete event, but table was already flushed
if [ $action = "del" ] && [ -n "${tbl##*$route_line$'\n'*}" ]; then
- LOG debug "skipping already deleted route table $tid - skipping $route_line"
+ LOG debug "skipping already deleted route table $tid - skipping '$route_line'"
return
fi
network_get_device device "$iface"
- LOG debug "adjusting route $device: $IP route $action table $tid $route_line"
+ LOG debug "adjusting route $device: '$IP route $action table $tid $route_line'"
$IP route "$action" table $tid $route_line ||
- LOG warn "failed: $IP route $action table $tid $route_line"
+ LOG warn "failed: '$IP route $action table $tid $route_line'"
}
handle_route_cb(){
local iface=$1
@@ -163,9 +163,9 @@ main()
sh -c "echo \$\$; exec $IP monitor route" | {
read -r monitor_pid
trap_with_arg func_trap "$monitor_pid" SIGINT SIGTERM SIGKILL
- while read -r line; do
+ while IFS='' read -r line; do
[ -z "${line##*table*}" ] && continue
- LOG debug "handling route update $family $line"
+ LOG debug "handling route update $family '$line'"
mwan3_lock "service" "mwan3rtmon"
mwan3_rtmon_route_handle "$line" "$family"
mwan3_unlock "service" "mwan3rtmon"