]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: use NHRP routes as valid in nexthop check
authorMark Stapp <mjs@labn.net>
Wed, 28 Jun 2023 12:11:41 +0000 (08:11 -0400)
committerMark Stapp <mjs@labn.net>
Mon, 10 Jul 2023 20:43:53 +0000 (16:43 -0400)
Treat NHRP-installed routes as valid, as if they were
CONNECTED routes, when checking candidate routes'
nexthops for validity. This allows use of NHRP by an
IGP, for example, that doesn't normally want recursive
nexthop resolution.

Signed-off-by: Mark Stapp <mjs@labn.net>
zebra/rib.h
zebra/zebra_nhg.c

index 65cc1ffab91442bdf48959a8777b9daf11c9dcb9..64bbaf3e7694c6c49551aadb9d3fd3a33907cbc5 100644 (file)
@@ -167,6 +167,10 @@ struct route_entry {
 
 #define RIB_KERNEL_ROUTE(R) RKERNEL_ROUTE((R)->type)
 
+/* Define route types that are equivalent to "connected". */
+#define RIB_CONNECTED_ROUTE(R)                                                 \
+       ((R)->type == ZEBRA_ROUTE_CONNECT || (R)->type == ZEBRA_ROUTE_NHRP)
+
 /* meta-queue structure:
  * sub-queue 0: nexthop group objects
  * sub-queue 1: EVPN/VxLAN objects
index e44f6ee4e0fa532797ff4634fa4ff0724538c466..bb507893b0e591255670d35c8e95eabb67a4f9bf 100644 (file)
@@ -2392,7 +2392,10 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
                        continue;
                }
 
-               if ((match->type == ZEBRA_ROUTE_CONNECT) ||
+               /* If the candidate match's type is considered "connected",
+                * we consider it first.
+                */
+               if (RIB_CONNECTED_ROUTE(match) ||
                    (RIB_SYSTEM_ROUTE(match) && RSYSTEM_ROUTE(type))) {
                        match = zebra_nhg_connected_ifindex(rn, match,
                                                            nexthop->ifindex);
@@ -2413,6 +2416,10 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
                                return 0;
                        }
 
+                       /* NHRP special case: need to indicate onlink */
+                       if (match->type == ZEBRA_ROUTE_NHRP)
+                               SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);
+
                        if (IS_ZEBRA_DEBUG_NHG_DETAIL)
                                zlog_debug(
                                        "%s: CONNECT match %p (%pNG), newhop %pNHv",