Skip to content

Commit

Permalink
bgpd: Relax the same prefix and nexthop to be valid
Browse files Browse the repository at this point in the history
Treat as next-hop invalid if import check is enabled.

Fixes: 654a597 ("bgpd: prevent routes loop through itself")

Fixes: #16877

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
  • Loading branch information
ton31337 committed Oct 1, 2024
1 parent 2c6eb34 commit c66642d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bgpd/bgp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,11 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
&p.u.prefix6))
ifindex = pi->peer->connection->su.sin6.sin6_scope_id;

if (!is_bgp_static_route && orig_prefix
&& prefix_same(&p, orig_prefix)) {
if (!is_bgp_static_route && orig_prefix && prefix_same(&p, orig_prefix) &&
CHECK_FLAG(bgp_route->flags, BGP_FLAG_IMPORT_CHECK)) {
if (BGP_DEBUG(nht, NHT)) {
zlog_debug(
"%s(%pFX): prefix loops through itself",
__func__, &p);
zlog_debug("%s(%pFX): prefix loops through itself (import-check enabled)",
__func__, &p);
}
return 0;
}
Expand Down

0 comments on commit c66642d

Please sign in to comment.