summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorAmol Lad <amol.lad@4rf.com>2021-03-24 04:39:27 +0100
committerReuben Dowle <reuben.dowle@4rf.com>2021-05-18 04:27:05 +0200
commit2b55509d6c376d578e63fdc2013f071bedb1f3e4 (patch)
tree69b9698b51813b7fb389120f75967664c9b81a9b /nhrpd
parentnhrpd: Set prefix correctly in resolution request (diff)
downloadfrr-2b55509d6c376d578e63fdc2013f071bedb1f3e4.tar.xz
frr-2b55509d6c376d578e63fdc2013f071bedb1f3e4.zip
nhrpd: Clear cache when shortcuts are cleared
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>
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/nhrp_vty.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c
index a03225250..707bb4b44 100644
--- a/nhrpd/nhrp_vty.c
+++ b/nhrpd/nhrp_vty.c
@@ -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) {