mirror of
https://git.openwrt.org/feed/packages.git
synced 2024-06-20 23:58:38 +02:00
mwan3: fix linkdown routes not being added
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
This commit is contained in:
parent
6ccb14a379
commit
5691ff247f
|
@ -129,6 +129,9 @@ mwan3_init()
|
||||||
LOG debug "Max interface count is ${MWAN3_INTERFACE_MAX}"
|
LOG debug "Max interface count is ${MWAN3_INTERFACE_MAX}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# remove "linkdown", expiry and source based routing modifiers from route lines
|
||||||
|
MWAN3_ROUTE_LINE_EXP="s/linkdown //; s/expires [0-9]\+sec//;s/error [0-9]\+//; ${source_routing:+s/default\(.*\) from [^ ]*/default\1/;} p"
|
||||||
|
|
||||||
# mark mask constants
|
# mark mask constants
|
||||||
bitcnt=$(mwan3_count_one_bits MMX_MASK)
|
bitcnt=$(mwan3_count_one_bits MMX_MASK)
|
||||||
mmdefault=$(((1<<bitcnt)-1))
|
mmdefault=$(((1<<bitcnt)-1))
|
||||||
|
|
|
@ -413,7 +413,7 @@ mwan3_get_routes()
|
||||||
local source_routing
|
local source_routing
|
||||||
config_get_bool source_routing globals source_routing 0
|
config_get_bool source_routing globals source_routing 0
|
||||||
[ $source_routing -eq 0 ] && unset source_routing
|
[ $source_routing -eq 0 ] && unset source_routing
|
||||||
$IP route list table main | sed -ne "/^linkdown/T; s/expires \([0-9]\+\)sec//;s/error [0-9]\+//; ${source_routing:+s/default\(.*\) from [^ ]*/default\1/;} p" | uniq
|
$IP route list table main | sed -ne "$MWAN3_ROUTE_LINE_EXP" | uniq
|
||||||
}
|
}
|
||||||
|
|
||||||
mwan3_create_iface_route()
|
mwan3_create_iface_route()
|
||||||
|
|
|
@ -69,7 +69,7 @@ mwan3_add_all_routes()
|
||||||
|
|
||||||
mwan3_rtmon_route_handle()
|
mwan3_rtmon_route_handle()
|
||||||
{
|
{
|
||||||
local action route_line family tbl device line route_line_exp tid source_routing
|
local action route_line family tbl device line tid source_routing
|
||||||
|
|
||||||
route_line=${1##"Deleted "}
|
route_line=${1##"Deleted "}
|
||||||
route_family=$2
|
route_family=$2
|
||||||
|
@ -79,29 +79,25 @@ mwan3_rtmon_route_handle()
|
||||||
|
|
||||||
if [ "$route_line" = "$1" ]; then
|
if [ "$route_line" = "$1" ]; then
|
||||||
action="replace"
|
action="replace"
|
||||||
route_line_exp="s/expires \([0-9]\+\)sec//;s/error [0-9]\+//; ${source_routing:+s/default\(.*\) from [^ ]*/default\1/}"
|
|
||||||
$IPS -! add mwan3_connected_${route_family##ip} ${route_line%% *}
|
$IPS -! add mwan3_connected_${route_family##ip} ${route_line%% *}
|
||||||
else
|
else
|
||||||
action="del"
|
action="del"
|
||||||
route_line_exp="s/expires [0-9]\+sec//;s/error [0-9]\+//; ${source_routing:+s/default\(.*\) from [^ ]*/default\1/}"
|
|
||||||
mwan3_set_connected_${route_family}
|
mwan3_set_connected_${route_family}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${route_line##*linkdown*}" ]; then
|
||||||
|
LOG debug "attempting to add link on down interface - $route_line"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$route_family" = "ipv4" ]; then
|
if [ "$route_family" = "ipv4" ]; then
|
||||||
IP="$IP4"
|
IP="$IP4"
|
||||||
elif [ "$route_family" = "ipv6" ] && [ $NO_IPV6 -eq 0 ]; then
|
elif [ "$route_family" = "ipv6" ] && [ $NO_IPV6 -eq 0 ]; then
|
||||||
IP="$IP6"
|
IP="$IP6"
|
||||||
route_line=$(echo "$route_line" | sed "$route_line_exp")
|
|
||||||
else
|
else
|
||||||
LOG warn "route update called with invalid family - $route_family"
|
LOG warn "route update called with invalid family - $route_family"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
route_line=$(echo "$route_line" | sed -ne "$MWAN3_ROUTE_LINE_EXP")
|
||||||
# don't try to add routes when link has gone down
|
|
||||||
if [ -z "${route_line##linkdown*}" ]; then
|
|
||||||
LOG debug "not adding route due to linkdown - skipping $route_line"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
handle_route() {
|
handle_route() {
|
||||||
local iface=$1
|
local iface=$1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user