Skip to content

Conversation

@KanjiMonster
Copy link
Contributor

When updating a route targeting a nexthoup group with id changing its nexthop to a single nexthop, we treat this as an update and instead add that nexthop to the group instead of replacing the route in the cache.

So e.g. with

nexthop id 10 fe80::1
nexthop id 11 fe80::2
nexthop id 12 fe80::3
nexthop id 20 grp 10/11

adding a route

dst 2001:db8:1:/64 nhid 20

libnl will store this as 2001:db8:1:/64 via fe80::1, fe80::2

if we now update the route with

dst 2001:db8:1:/64 nhid 12

libnl will see a new route with a single nexthop. Since the existing route for dst 2001:db8:1:/64 is a multipath route, and the new route has a single nexthop, libnl assumes this is a new nexthop for the route, and merges it to 2001:db8:1:/64 via fe80::1, fe80::2, fe80::3 instead of replacing it.

Fix this by checking the nhid of the routes, and only merge if they match.

Fixes: 29b7137 ("route cache: Fix handling of ipv6 multipath routes")

When updating a route targeting a nexthoup group with id changing its
nexthop to a single nexthop, we treat this as an update and instead
add that nexthop to the group instead of replacing the route in the
cache.

So e.g. with

nexthop id 10 fe80::1 dev eth1
nexthop id 11 fe80::2 dev eth2
nexthop id 12 fe80::3 dev eth3
nexthop id 20 grp 10/11

adding a route
dst 2001:db8:1:/64 nhid 20

libnl will store this as 2001:db8:1:/64 via fe80::1, fe80::2

if we now update the route with

dst 2001:db8:1:/64 nhid 12

libnl will see a new route with a single nexthop. Since the existing
route for dst 2001:db8:1:/64 is a multipath route, and the new route has
a single nexthop, libnl assumes this is a new nexthop for the route, and
merges it to 2001:db8:1:/64 via fe80::1, fe80::2, fe80::3 instead of
replacing it.

Fix this by checking the nhid of the routes, and only merge if they
match.

Fixes: 29b7137 ("route cache: Fix handling of ipv6 multipath routes")
Signed-off-by: Jonas Gorski <[email protected]>
thom311 pushed a commit that referenced this pull request Dec 23, 2025
When updating a route targeting a nexthoup group with id changing its
nexthop to a single nexthop, we treat this as an update and instead
add that nexthop to the group instead of replacing the route in the
cache.

So e.g. with

nexthop id 10 fe80::1 dev eth1
nexthop id 11 fe80::2 dev eth2
nexthop id 12 fe80::3 dev eth3
nexthop id 20 grp 10/11

adding a route
dst 2001:db8:1:/64 nhid 20

libnl will store this as 2001:db8:1:/64 via fe80::1, fe80::2

if we now update the route with

dst 2001:db8:1:/64 nhid 12

libnl will see a new route with a single nexthop. Since the existing
route for dst 2001:db8:1:/64 is a multipath route, and the new route has
a single nexthop, libnl assumes this is a new nexthop for the route, and
merges it to 2001:db8:1:/64 via fe80::1, fe80::2, fe80::3 instead of
replacing it.

Fix this by checking the nhid of the routes, and only merge if they
match.

Fixes: 29b7137 ("route cache: Fix handling of ipv6 multipath routes")
Signed-off-by: Jonas Gorski <[email protected]>

#449
@thom311
Copy link
Owner

thom311 commented Dec 23, 2025

merged. Thank you for the patch!!

@thom311 thom311 closed this Dec 23, 2025
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.

2 participants