Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: fix wrong nexthop status for kernel routes #17544

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

anlancs
Copy link
Contributor

@anlancs anlancs commented Dec 2, 2024

The kernel routes are wronlgy active even the nexthop interface is linkdown.

Use ip link set dev <interface> down on the other box to set the box's
nexthop interface linkdown. The kernel routes will be kept as linkdown,
but are still with active nexthop in zebra.

Add three changes for kernel routes in this commit:

  1. The active nexthop should be the operative interface.
  2. Don't uninstall the kernel routes from zebra even no active nexthops.
    (It doesn't affect the kernel routes' deletion from kernel netlink messages.)
  3. Update the kernel routes when the nexthop interface becomes up.

Before: (during nexthop interface is linkdown)

K>* 3.3.3.3/32 [0/0] via 88.88.88.1, enp2s0, weight 1, 00:00:14                                                                                                              

After: (during nexthop interface is linkdown)

K   3.3.3.3/32 [0/0] via 88.88.88.1, enp2s0 inactive, weight 1, 00:00:07                                                                                                     

@ton31337
Copy link
Member

ton31337 commented Dec 2, 2024

To me, it looks like separate commits should be used for these somewhat relative issues. Also, can you create a topotest covering this case?

Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

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

looks okay ... separate commits, clear the rest of @ton31337 's comments ...

@anlancs anlancs force-pushed the zebra/fix-plug-interface branch from b2834cd to 9b5738f Compare December 17, 2024 06:51
@frrbot frrbot bot added the tests Topotests, make check, etc label Dec 17, 2024
@github-actions github-actions bot added size/M and removed size/XS labels Dec 17, 2024
The kernel routes are wrongly selected even the nexthop interface is linkdown.

Use `ip link set dev <interface> down` on the other box to set the box's
nexthop interface linkdown. The kernel routes will be kept as `linkdown`,
but are still with active nexthop in `zebra`.

Add three changes/commits for kernel routes in this PR:

1) The active nexthop should be the operative interface.
2) Don't uninstall the kernel routes from `zebra` even no active nexthops.
   (It doesn't affect the kernel routes' deletion from kernel netlink messages.)
3) Update the kernel routes when the nexthop interface becomes up.

Before: (during nexthop interface is linkdown)
```
K>* 3.3.3.3/32 [0/0] via 88.88.88.1, enp2s0, weight 1, 00:00:14
```

After: (during nexthop interface is linkdown, with all three changes)
```
K   3.3.3.3/32 [0/0] via 88.88.88.1, enp2s0 inactive, weight 1, 00:00:07
```

This commit is 1st change:
Improve the judgment for "active" nexthop to be more accurate, the active
nexthop should be the operative interface.

Signed-off-by: anlan_cs <[email protected]>
After the nexthop check is fixed, zebra will wrongly uninstall the kernel routes
with inactive nexthop.

This commit would skip the uninstallation for kernel routes.

Signed-off-by: anlan_cs <[email protected]>
Just like `link down`, check all kernel routes when interface become up.
And, they maybe will be selected as the best one by zebra.

Signed-off-by: anlan_cs <[email protected]>
@anlancs anlancs force-pushed the zebra/fix-plug-interface branch from 9b5738f to 2f1bd3f Compare December 17, 2024 08:19
@anlancs
Copy link
Contributor Author

anlancs commented Dec 17, 2024

Done, thanks @ton31337 @riw777

@anlancs anlancs requested a review from riw777 December 17, 2024 11:51
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

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

looks good

@riw777 riw777 merged commit c8ba5b0 into FRRouting:master Dec 17, 2024
11 checks passed
@ykholod
Copy link

ykholod commented Dec 19, 2024

@riw777 Are there any plans to backport this fix to stable/10.2 branch?

@c-po
Copy link
Contributor

c-po commented Dec 22, 2024

@riw777 as stable/9.1 is affected, too - can this be backported there as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants