Skip to content

Multiple local fix - #20798

Merged
mjstapp merged 2 commits into
FRRouting:masterfrom
donaldsharp:multiple_local_fix
Feb 13, 2026
Merged

Multiple local fix#20798
mjstapp merged 2 commits into
FRRouting:masterfrom
donaldsharp:multiple_local_fix

Conversation

@donaldsharp

Copy link
Copy Markdown
Member

See first commit, but explicilty fix the problem where when receiving multiple link up events FRR is creating multpile local routes when it should not be.

…anges

Currently when a interface is seeing multiple link up events in a row,
we are seeing multiple local routes in the rib:

r9# show ip route vrf all nexthop-group
% 2026/02/08 23:18:00.371

Codes: K - kernel route, C - connected, L - local, S - static,
       R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric, t - Table-Direct,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

IPv4 unicast VRF default:
C>* 11.1.5.0/30 (7) is directly connected, r9-eth0, weight 1, 00:01:52
L>* 11.1.5.2/32 (7) is directly connected, r9-eth0, weight 1, 00:01:52
B>* 50.1.1.7/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:51
B>* 50.1.1.8/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:51
L * 50.1.1.9/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
C * 50.1.1.9/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
L>* 50.1.1.9/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
B>* 50.1.1.10/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:50
L * 198.10.1.1/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
C * 198.10.1.1/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
L>* 198.10.1.1/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
B   198.10.1.1/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:46

Additionally FRR has made an improper choice about what route should also
be properly selected, because of this decision.  The problem stems from
rib_compare_routes in zebra_rib.c already handling the multiple same
connected routes being passed for processing but not for local routes
to be considered the same.  Modify the code to make local routes behave
the same here.  This is the new result:

r9# show ip route vrf all nexthop-group
% 2026/02/08 23:18:00.371

Codes: K - kernel route, C - connected, L - local, S - static,
       R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric, t - Table-Direct,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

IPv4 unicast VRF default:
C>* 11.1.5.0/30 (7) is directly connected, r9-eth0, weight 1, 00:01:52
L>* 11.1.5.2/32 (7) is directly connected, r9-eth0, weight 1, 00:01:52
B>* 50.1.1.7/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:51
B>* 50.1.1.8/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:51
C>* 50.1.1.9/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
L>* 50.1.1.9/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
B>* 50.1.1.10/32 [20/0] (10) via 11.1.5.1, r9-eth0, weight 1, 00:01:50
C>* 198.10.1.1/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46
L>* 198.10.1.1/32 (17) is directly connected, r9-eth1, weight 1, 00:01:46

Fixes: FRRouting#20337
Signed-off-by: Donald Sharp <sharpd@nvidia.com>

@mjstapp mjstapp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this fix - let's see how CI goes

@greptile-apps

greptile-apps Bot commented Feb 12, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR fixes a bug where multiple interface link-up events caused duplicate local routes in the RIB. The fix extends the route comparison logic in rib_compare_routes to treat ZEBRA_ROUTE_LOCAL routes the same way as ZEBRA_ROUTE_CONNECT routes - allowing multiple routes on the same interface to be considered equivalent.

Key changes:

  • Modified zebra/zebra_rib.c line 1650 to include ZEBRA_ROUTE_LOCAL in the condition that prevents duplicate routes on the same interface
  • Added test test_zebra_mtu_single_local_route_per_address that triggers interface events via MTU change and verifies only one local route exists per address
  • Test also includes minor formatting fixes (spacing/indentation)

The fix is minimal, targeted, and consistent with the existing pattern at line 1654 where both route types are already handled together.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a single-line fix that follows an established pattern in the codebase (line 1654), addresses a clear bug with well-documented behavior, and includes a comprehensive test to prevent regression
  • No files require special attention

Important Files Changed

Filename Overview
zebra/zebra_rib.c Added ZEBRA_ROUTE_LOCAL to route comparison logic to prevent duplicate local routes on interface events - consistent with existing pattern at line 1654
tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py Added comprehensive test to verify exactly one local route per address after MTU changes trigger interface events - validates the fix

…local routes

Show that the previous commit works properly and that when FRR receives
a change for a interface that causes multiple event up scenarios, to
treat the local routes as duplicate.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
@donaldsharp

Copy link
Copy Markdown
Member Author

@Mergifyio backport dev/10.6 stable/10.5 stable/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0

@mergify

mergify Bot commented Feb 13, 2026

Copy link
Copy Markdown

backport dev/10.6 stable/10.5 stable/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0

βœ… Backports have been created

Details

Cherry-pick of 23261aa has failed:

On branch mergify/bp/stable/10.2/pr-20798
Your branch is ahead of 'origin/stable/10.2' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 23261aa5b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   tests/topotests/zebra_multiple_connected/r1/frr.conf
	deleted:    tests/topotests/zebra_multiple_connected/r1/zebra.conf
	new file:   tests/topotests/zebra_multiple_connected/r2/frr.conf
	new file:   tests/topotests/zebra_multiple_connected/r3/frr.conf

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Cherry-pick of bf1312b has failed:

On branch mergify/bp/stable/10.1/pr-20798
Your branch is up to date with 'origin/stable/10.1'.

You are currently cherry-picking commit bf1312b8e.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   zebra/zebra_rib.c

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of 23261aa has failed:

On branch mergify/bp/stable/10.1/pr-20798
Your branch is ahead of 'origin/stable/10.1' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 23261aa5b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   tests/topotests/zebra_multiple_connected/r1/frr.conf
	deleted:    tests/topotests/zebra_multiple_connected/r1/zebra.conf
	new file:   tests/topotests/zebra_multiple_connected/r2/frr.conf
	new file:   tests/topotests/zebra_multiple_connected/r3/frr.conf

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Cherry-pick of bf1312b has failed:

On branch mergify/bp/stable/10.0/pr-20798
Your branch is up to date with 'origin/stable/10.0'.

You are currently cherry-picking commit bf1312b8e.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   zebra/zebra_rib.c

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of 23261aa has failed:

On branch mergify/bp/stable/10.0/pr-20798
Your branch is ahead of 'origin/stable/10.0' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 23261aa5b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   tests/topotests/zebra_multiple_connected/r1/frr.conf
	deleted:    tests/topotests/zebra_multiple_connected/r1/zebra.conf
	new file:   tests/topotests/zebra_multiple_connected/r2/frr.conf
	new file:   tests/topotests/zebra_multiple_connected/r3/frr.conf

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

donaldsharp added a commit that referenced this pull request Feb 13, 2026
donaldsharp added a commit that referenced this pull request Feb 13, 2026
donaldsharp added a commit that referenced this pull request Feb 13, 2026
@mattiaswal mattiaswal mentioned this pull request Mar 18, 2026
17 tasks
@donaldsharp
donaldsharp deleted the multiple_local_fix branch April 30, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants