Skip to content

mwan3: omit nexthop IDs when replaying expanded single nexthops - #30803

Open
ZyPulse-zy wants to merge 1 commit into
openwrt:masterfrom
ZyPulse-zy:fix/mwan3-expanded-nexthop
Open

ZyPulse-zy wants to merge 1 commit into
openwrt:masterfrom
ZyPulse-zy:fix/mwan3-expanded-nexthop

Conversation

@ZyPulse-zy

Copy link
Copy Markdown

Default nexthop compatibility dumps contain both nhid and the expanded via/dev definition. Replaying that line makes iproute2 reject the route with "Nexthop specification and nexthop id are mutually exclusive", breaking mwan3 startup, ifup and monitor-handler copies.

Remove the redundant ID only when the route contains an inline via/dev nexthop. Preserve valid ID-only routes and the remaining route attributes. Increment PKG_RELEASE. The kernel's nexthop compatibility mode emits route notifications on nexthop changes, so the existing expanded-route monitor model can continue following gateway updates: https://docs.kernel.org/networking/ip-sysctl.html

Maintainer: @feckert

Validation:

  • Original actual functions reproduce the route installation rejection.
  • Fixed actual functions pass 45 checks under both bash and BusyBox ash: IPv4/IPv6 startup synchronization, ifup, monitor-handler replacement/deletion, source/protocol/metric/onlink attributes, WAN-specific/shared routes, ID-only replay and legacy flag handling.
  • Independent CI passes the original failure and both fixed-shell kernel runs, including verification of the final Signed-off-by commit.
  • The qualcommax/ipq60xx AArch64/musl SDK builds the APK. Extracted package shell sources match the fix and pass the same 45 BusyBox ash checks against the host kernel in a private namespace. No package was installed on a router.

Run-test environment: host Linux 7.0.0-38, iproute2 6.19.0; independent Ubuntu CI. Device: none. UCI/network status/ipset I/O is bounded fixture data; kernel route operations are real. Tests refuse to run outside a distinct network namespace and generate no packets. Multiline/multipath groups, resilient/encapsulated nexthops and the running daemon loop are outside this regression's coverage.

  • Reviewed CONTRIBUTING.md.
  • Signed-off-by uses the authorized contributor identity.

Developed with AI assistance and validated as described.

Fixes #27066

Copilot AI balanced review requested due to automatic review settings October 18, 2026 00:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Default nexthop compatibility dumps include nhid together with via/dev
fields. iproute2 rejects replaying both, so startup, ifup and
route-monitor copies fail. Remove the redundant nhid only when an inline
nexthop is present; preserve valid ID-only routes.

Add an isolated actual-function/kernel regression covering IPv4/IPv6
route copying, gateway updates, deletion, route attributes, shared
routes, ID-only replay and legacy flags. All 45 checks pass with BusyBox
ash, including shell sources extracted from the actual AArch64/musl
SDK-built APK.

Signed-off-by: Yuen Su <zypulsecore@gmail.com>
@github-actions
github-actions Bot force-pushed the fix/mwan3-expanded-nexthop branch from 6c3efeb to c9436da Compare October 18, 2026 00:51
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]\+//;"
# iproute2 expands nexthop objects into via/dev fields. Replaying both

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (optional): the kernel adds the via/dev expansion to the dump when nexthop_compat_mode is on, not iproute2. The PR body and README say the same thing.

Suggested change
# iproute2 expands nexthop objects into via/dev fields. Replaying both
# With nexthop_compat_mode the kernel dumps nhid plus its via/dev

Generated by Claude Code

@@ -0,0 +1,150 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: CI never runs this script: it needs root, a separate netns and host iproute2, and net/mwan3/test.sh doesn't call it. The other in-tree suites (net/pbr/tests/run_tests.sh, net/adblock-fast/tests/) are shell-based. Should this test (and the host-specific notes in tests/README.md) live in the tree, or only in the PR description?


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mwan3: Error: Nexthop specification and nexthop id are mutually exclusive.

3 participants