]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Relax the same prefix and nexthop to be valid
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 27 Sep 2024 07:52:55 +0000 (10:52 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 1 Oct 2024 18:07:54 +0000 (21:07 +0300)
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 <donatas@opensourcerouting.org>
bgpd/bgp_nht.c

index 8719af56b3f561073b02898cbb0ad462bf1fdc35..49042e8c238a966312a9c57a964347c846ce188a 100644 (file)
@@ -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;
                }