Skip to content

lib, zebra: Check for not being a blackhole route#15815

Merged
mjstapp merged 1 commit intoFRRouting:masterfrom
donaldsharp:blackhole_reinstall
Apr 23, 2024
Merged

lib, zebra: Check for not being a blackhole route#15815
mjstapp merged 1 commit intoFRRouting:masterfrom
donaldsharp:blackhole_reinstall

Conversation

@donaldsharp
Copy link
Member

In zebra_interface_nhg_reinstall zebra is checking that the nhg is a singleton and not a blackhole nhg. This was originally done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX, NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX. This was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6. These were both possible to be received and maintained from the upper level protocol for when a route is being recursively resolved. If we have gotten to this point in zebra_interface_nhg_reinstall the nexthop group has already been installed at least once and we know that it is actually a valid nexthop. What the test is really trying to do is ensure that we are not reinstalling a blackhole nexthop group( Which is not possible to even be here by the way, but safety first! ). So let's change to test for that instead.

In zebra_interface_nhg_reinstall zebra is checking that the
nhg is a singleton and not a blackhole nhg.  This was originally
done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX,
NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX.  This
was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.  These
were both possible to be received and maintained from the upper
level protocol for when a route is being recursively resolved.
If we have gotten to this point in zebra_interface_nhg_reinstall
the nexthop group has already been installed at least once
and we *know* that it is actually a valid nexthop.  What the
test is really trying to do is ensure that we are not reinstalling
a blackhole nexthop group( Which is not possible to even be
here by the way, but safety first! ).  So let's change
to test for that instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Copy link
Contributor

@mjstapp mjstapp left a comment

Choose a reason for hiding this comment

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

Nice catch - looks good to me

Copy link
Member

@pguibert6WIND pguibert6WIND left a comment

Choose a reason for hiding this comment

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

LGTM for blackhole cases.

It makes me think to an exception case handled in zebra_nhg.c about a resolved route pointing over the default route.

Do we have to add that kind of test in nhg_reinstall ?

[0] https://github.com/FRRouting/frr/blob/master/zebra/zebra_nhg.c#L2345

@Jafaral
Copy link
Member

Jafaral commented Apr 22, 2024

@Mergifyio backport stable/10.0 stable/9.1 stable/9.0 stable/8.5

@mergify
Copy link

mergify bot commented Apr 22, 2024

backport stable/10.0 stable/9.1 stable/9.0 stable/8.5

✅ Backports have been created

Details

@mjstapp mjstapp merged commit a4e60f3 into FRRouting:master Apr 23, 2024
donaldsharp added a commit that referenced this pull request Apr 23, 2024
lib, zebra: Check for not being a blackhole route (backport #15815)
donaldsharp added a commit that referenced this pull request Apr 23, 2024
lib, zebra: Check for not being a blackhole route (backport #15815)
donaldsharp added a commit that referenced this pull request Apr 23, 2024
lib, zebra: Check for not being a blackhole route (backport #15815)
donaldsharp added a commit that referenced this pull request Apr 23, 2024
lib, zebra: Check for not being a blackhole route (backport #15815)
@donaldsharp donaldsharp deleted the blackhole_reinstall branch July 30, 2025 17:16
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.

4 participants