From c66642d7f054a43e9843312d2155ae4e52c05ad8 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 27 Sep 2024 10:52:55 +0300 Subject: [PATCH] bgpd: Relax the same prefix and nexthop to be valid Treat as next-hop invalid if import check is enabled. Fixes: 654a5978f695087af062bfc9a382321fa2ccc4ae ("bgpd: prevent routes loop through itself") Fixes: https://github.com/FRRouting/frr/issues/16877 Signed-off-by: Donatas Abraitis --- bgpd/bgp_nht.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 8719af56b3..49042e8c23 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -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; } -- 2.39.5