]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Nexthop tracking, route resolution recursive lookup
authorvdhingra <vdhingra@vmware.com>
Wed, 3 Feb 2021 13:58:12 +0000 (05:58 -0800)
committerIqra Siddiqui <imujeebsiddi@vmware.com>
Tue, 22 Feb 2022 17:28:00 +0000 (09:28 -0800)
Description:
===========
Change is intended for fixing the NHT resolution logic.
While recursively resolving nexthop, keep looking for a valid/useable route in the rib,
by not stopping at the first/most-specific route in the rib.

Consider the following set of events taking place on R1:
R1(config)# ip route 2.2.2.0/24 ens192
R1# sharp watch nexthop 2.2.2.32 connected
R1# show ip nht
2.2.2.32(Connected)
 resolved via static
 is directly connected, ens192
 Client list: sharp(fd 33)

-2.2.2.32 NHT is resolved over the above valid static route.

R1# sharp install routes 2.2.2.32 nexthop 2.2.2.32 1
R1# 2.2.2.32(Connected)
 resolved via static
 is directly connected, ens192
 Client list: sharp(fd 33)

-.32/32 comes which is going to resolve through itself, but since this is an invalid route,
it will be marked as inactive and will not affect the NHT.

R1# sharp install routes 2.2.2.31 nexthop 2.2.2.32 1
R1# 2.2.2.32(Connected)
 unresolved(Connected)
 Client list: sharp(fd 50)

-Now a .31/32 comes which will resolve over .32 route, but as per the current logic,
this will trigger the NHT check, in turn making the NHT unresolved.

-With fix, NHT should stay in resolved state as long as the valid static or connected route stays installed

Fix:
====
-While resolving nexthops, walk up the tree from the most-specific match,
walk up the tree without any ZEBRA_NHT_CONNECTED check.

Co-authored-by: Vishal Dhingra <vdhingra@vmware.com>
Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
zebra/zebra_rnh.c

index f5faaab71be2849645e313c79d7744c40618a948..8ca25359beb565f209c7d077df240f167f710fdb 100644 (file)
@@ -637,15 +637,11 @@ zebra_rnh_resolve_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi,
                if (re) {
                        *prn = rn;
                        return re;
-               }
-
-               if (!CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
+               } else {
+                       /* Resolve the nexthop recursively by finding matching
+                        * route with lower prefix length
+                        */
                        rn = rn->parent;
-               else {
-                       if (IS_ZEBRA_DEBUG_NHT_DETAILED)
-                               zlog_debug(
-                                       "        Nexthop must be connected, cannot recurse up");
-                       return NULL;
                }
        }