]> git.proxmox.com Git - mirror_frr.git/commitdiff
nhrpd: Clear cache when shortcuts are cleared
authorAmol Lad <amol.lad@4rf.com>
Wed, 24 Mar 2021 03:39:27 +0000 (16:39 +1300)
committerReuben Dowle <reuben.dowle@4rf.com>
Tue, 18 May 2021 02:27:05 +0000 (14:27 +1200)
This is required because with the cache entry in place traffic will continue
via the shortcut path until the cache entry expires.

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
nhrpd/nhrp_vty.c

index a032252507682c2ec2769f5a8ef684a428e6cfcd..707bb4b44f06c8d30cd989f3a1241c175c121ca0 100644 (file)
@@ -1076,7 +1076,8 @@ static void clear_nhrp_cache(struct nhrp_cache *c, void *data)
        if (c->cur.type <= NHRP_CACHE_DYNAMIC) {
                nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL,
                                          NULL);
-               ctx->count++;
+               if (ctx)
+                       ctx->count++;
        }
 }
 
@@ -1106,6 +1107,12 @@ DEFUN(clear_nhrp, clear_nhrp_cmd,
                        nhrp_cache_foreach(ifp, clear_nhrp_cache, &ctx);
        } else {
                nhrp_shortcut_foreach(ctx.afi, clear_nhrp_shortcut, &ctx);
+               /* Clear cache also because when a shortcut is cleared then its
+                * cache entry should be cleared as well (otherwise traffic
+                * continues via the shortcut path)
+                */
+               FOR_ALL_INTERFACES (vrf, ifp)
+                       nhrp_cache_foreach(ifp, clear_nhrp_cache, NULL);
        }
 
        if (!ctx.count) {