mwan3: strip dead flag from copied routes - #30390
Conversation
18f1e6c to
9546df4
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit. The diagnosis is right — ip route replace does reject dead, and stripping it at end-of-line as well as mid-line is the correct scope. Two findings plus one optional nit.
The only one I would treat as blocking is the unanchored s/dead //: dead is valid hex, so the substitution also fires inside IPv6 address tokens and silently rewrites via fe80::dead dev eth0 into via fe80::dev eth0. The suggested anchored form keeps every assertion in the new test.sh passing unchanged, so it should be a drop-in.
The set -e placement in test.sh is a robustness issue rather than a defect on the current CI configs — all 10 Feeds Package Test Build jobs are green on this head, so ip6tables is evidently present there.
PKG_RELEASE 1 → 2 is right per the feed rules: an installed support file changed with no PKG_VERSION change. test-version.sh is already in place, so the new test.sh does not need one added.
Generated by Claude Code
The kernel marks routes using no-carrier devices as dead linkdown. mwan3 strips linkdown but passes dead to ip route, which rejects the copied route and leaves policy tables incomplete. Strip both flags, including at end of line, and add a runtime test. Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
9546df4 to
cc0231e
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit; no new issues found.
All three findings from the previous round are resolved in cc0231ece:
- Both flags now require a leading token boundary (
s/ dead / /,s/ dead$/ /), so the IPv6 next-hop mangling is gone. I ran the resulting sed program against the four flag orderings plus realistic kernel output and it behaves:fd00::/64 dev br-lan proto kernel metric 256 dead linkdown pref medium→fd00::/64 dev br-lan proto kernel metric 256 pref medium, andfd00:1::/64 via fe80::dead dev eth0 …passes through untouched. The added regression assertion covers exactly that case. set -enow sits after the. /lib/functions.sh/. /lib/mwan3/mwan3.shsourcing, so the unguardedcommand -v ip6tablesprobe incommon.shno longer aborts the test on a build without ip6tables. The remaining[ $source_routing -eq 1 ] && unset source_routinginsidemwan3_initis exempt fromset -e(non-final command of an AND-OR list), confirmed against ash, dash and bash, so runningmwan3_initunderset -eis safe.MWAN3_ROUTE_LINE_EXPis assembled in a single assignment, with no embedded tabs in the sed program.
The end-of-line substitutions leave a trailing space on the sanitized line, but that matches the pre-existing behaviour of s/offload// and s/expires [0-9]\+sec//, and both consumers (mwan3_get_routes | grep -qxF in mwan3rtmon, and the unquoted $IP route add … $route_line) compare or split post-sed output on both sides, so it is consistent.
PKG_RELEASE 1 → 2 remains correct, and test-version.sh is already present, so the new test.sh needs no companion. Only the three FormalityCheck runs have reported on this head (all green); the package build/test jobs have not run yet, so there is nothing CI-side to look at.
Generated by Claude Code
Description
Routes for devices without carrier may be reported as:
mwan3removeslinkdownbefore copying the route to its policy tables,but retains
dead.ip route replace table ...rejects that token with:The connected route is then missing from the WAN policy tables. Marked reply
traffic follows the table's default route back to the WAN instead of reaching
the LAN client.
Strip both flags, whether followed by whitespace or present at the end of the
line. Bump the package release because an installed support file changes.
Testing
deadandlinkdown, individually and in bothorders.
routes for link-down devices populate tables 1, 2, and 3 after the patch.
mwan3with the patch applied.package/mwan3/compilesuccessfully with the OpenWrt 25.12.5 SDK.