diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index 48c3aebc165b64..29d5a4a301ccb5 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 PKG_VERSION:=2.12.2 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=Florian Eckert PKG_LICENSE:=GPL-2.0 diff --git a/net/mwan3/files/lib/mwan3/common.sh b/net/mwan3/files/lib/mwan3/common.sh index 3f6805b63fc7ea..2a0408f310cdaf 100644 --- a/net/mwan3/files/lib/mwan3/common.sh +++ b/net/mwan3/files/lib/mwan3/common.sh @@ -187,6 +187,9 @@ mwan3_init() route_modifiers="$route_modifiers s/ linkdown / /; s/ linkdown$/ /;" route_modifiers="$route_modifiers s/expires [0-9]\+sec//;" route_modifiers="$route_modifiers s/error [0-9]\+//;" + # With nexthop_compat_mode the kernel dumps nhid plus via/dev. Replaying both + # nhid and its expansion is rejected; retain ID-only routes unmodified. + route_modifiers="$route_modifiers / nhid [0-9]\+/ { / via \| dev / s/ nhid [0-9]\+//; };" MWAN3_ROUTE_LINE_EXP="$route_modifiers ${source_routing:+s/default\(.*\) from [^ ]*/default\1/;} p" # mark mask constants diff --git a/net/mwan3/test.sh b/net/mwan3/test.sh index c3982c6d33f6b8..7a18dd02b5d5f2 100755 --- a/net/mwan3/test.sh +++ b/net/mwan3/test.sh @@ -37,3 +37,29 @@ actual=$(sanitize_route "$ipv6_route") echo "actual: '$actual'" >&2 exit 1 } + +# The kernel's expanded nexthop dump must be replayable without nhid. +# These parser checks require no extra tools or changes to the routing tables. +check_nexthop_route() +{ + actual=$(sanitize_route "$1") + [ "$actual" = "$2" ] || { + echo "failed to normalize nexthop route: '$1'" >&2 + echo "expected: '$2'" >&2 + echo "actual: '$actual'" >&2 + exit 1 + } +} + +check_nexthop_route \ + '198.51.100.0/24 nhid 7 via 192.0.2.1 dev eth0 proto static metric 20' \ + '198.51.100.0/24 via 192.0.2.1 dev eth0 proto static metric 20' +check_nexthop_route \ + '2001:db8:2::/64 nhid 8 via fe80::1 dev eth0 proto static metric 30 pref medium' \ + '2001:db8:2::/64 via fe80::1 dev eth0 proto static metric 30 pref medium' +check_nexthop_route '192.0.2.0/24 nhid 9 dev eth0 scope link' \ + '192.0.2.0/24 dev eth0 scope link' +check_nexthop_route '198.51.100.0/24 nhid 7 proto static metric 20' \ + '198.51.100.0/24 nhid 7 proto static metric 20' +check_nexthop_route '198.51.100.0/24 via 192.0.2.1 dev eth0 proto static metric 20' \ + '198.51.100.0/24 via 192.0.2.1 dev eth0 proto static metric 20'