Skip to content

vrf: move multipath IPv6 default nexthops into VRF table - #1275

Open
locker95 wants to merge 2 commits into
containernetworking:mainfrom
locker95:fix/vrf-ipv6-ecmp-default-route
Open

vrf: move multipath IPv6 default nexthops into VRF table#1275
locker95 wants to merge 2 commits into
containernetworking:mainfrom
locker95:fix/vrf-ipv6-ecmp-default-route

Conversation

@locker95

Copy link
Copy Markdown

Summary

When IPAM installs an IPv6 default route (::/0) on a secondary interface while the primary interface already has one, the kernel merges them into a multipath/ECMP route. Those routes have LinkIndex == 0 and put the per-interface nexthops in MultiPath.

The VRF plugin was filtering with RT_FILTER_OIF, which only matches route.LinkIndex. Multipath defaults never matched, so the secondary nexthop was never saved and never reinstalled into the VRF table after enslavement.

This change:

  • lists universe-scope routes without the OIF filter
  • extracts nexthops that belong to the interface being moved (including multipath/ECMP)
  • reinstalls those into the VRF table as a normal single-hop route when only one nexthop remains

IPv4 was not reported as affected, but multipath handling is family-agnostic for correctness.

Test plan

  • Added unit tests for routeForInterface / routesForInterface covering single-hop, ECMP extract, multi-nexthop-on-same-if, and mixed lists
  • Added an integration-style test that builds an IPv6 ECMP default across two dummy ifaces and asserts ::/0 lands in the VRF table after cmdAdd
  • CI / Linux: go test ./plugins/meta/vrf/ (needs root/netns; not runnable on the macOS workspace used to develop this)

Fixes #1253

locker95 added 2 commits July 20, 2026 23:42
When a secondary interface gets an IPv6 default route while the primary
already has ::/0, the kernel merges them into an ECMP multipath route
with LinkIndex 0. The VRF plugin previously filtered routes with
RT_FILTER_OIF only, which never matches multipath routes, so the net1
nexthop was dropped and never reinstalled into the VRF table.

List universe-scope routes without the OIF filter, extract nexthops that
belong to the interface being enslaved (including multipath), and
reinstall those into the VRF table as before.

Fixes containernetworking#1253

Signed-off-by: Dean Chen <862469039@qq.com>
Sequential RouteAdd of two ::/0 with the same metric returns EEXIST
on some kernels instead of merging, which broke CI on Linux amd64.

Signed-off-by: Dean Chen <862469039@qq.com>
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.

vrf: IPv6 default route not moved to VRF table when ECMP route exists on primary interface

1 participant