summaryrefslogtreecommitdiff
path: root/nhrpd/nhrp_vty.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2021-08-08 07:27:41 -0400
committerGitHub <noreply@github.com>2021-08-08 07:27:41 -0400
commit2570a9f16531ff1307cd6bcda2250ace49b1cf76 (patch)
treeffcea479c198644f2658820453558a0cb191345c /nhrpd/nhrp_vty.c
parenta66413a53b128894e4a13b00d0fcb319e01f07b2 (diff)
parent2b55509d6c376d578e63fdc2013f071bedb1f3e4 (diff)
Merge pull request #8262 from reubendowle/fixes/nhrp-misc-fixes
nhrp misc fixes
Diffstat (limited to 'nhrpd/nhrp_vty.c')
-rw-r--r--nhrpd/nhrp_vty.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c
index 8441d278fc..60ce1e6523 100644
--- a/nhrpd/nhrp_vty.c
+++ b/nhrpd/nhrp_vty.c
@@ -835,6 +835,7 @@ static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
ctx->count++;
c = s->cache;
+ buf2[0] = '\0';
if (c)
sockunion2str(&c->remote_addr, buf2, sizeof(buf2));
prefix2str(s->p, buf1, sizeof(buf1));
@@ -1066,7 +1067,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++;
}
}
@@ -1096,6 +1098,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) {