summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2021-08-08 13:27:41 +0200
committerGitHub <noreply@github.com>2021-08-08 13:27:41 +0200
commit2570a9f16531ff1307cd6bcda2250ace49b1cf76 (patch)
treeffcea479c198644f2658820453558a0cb191345c /nhrpd
parentMerge pull request #8870 from anlancs/master-fix-reload-service (diff)
parentnhrpd: Clear cache when shortcuts are cleared (diff)
downloadfrr-2570a9f16531ff1307cd6bcda2250ace49b1cf76.tar.xz
frr-2570a9f16531ff1307cd6bcda2250ace49b1cf76.zip
Merge pull request #8262 from reubendowle/fixes/nhrp-misc-fixes
nhrp misc fixes
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/nhrp_shortcut.c4
-rw-r--r--nhrpd/nhrp_vty.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c
index 56861551e..0905ceb72 100644
--- a/nhrpd/nhrp_shortcut.c
+++ b/nhrpd/nhrp_shortcut.c
@@ -427,8 +427,10 @@ static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s)
* */
/* FIXME: push CIE for each local protocol address */
cie = nhrp_cie_push(zb, NHRP_CODE_SUCCESS, NULL, NULL);
- cie->prefix_length = 0xff;
if_ad = &nifp->afi[family2afi(sockunion_family(&s->addr))];
+ cie->prefix_length = (if_ad->flags & NHRP_IFF_REG_NO_UNIQUE)
+ ? 8 * sockunion_get_addrlen(&s->addr)
+ : 0xff;
cie->holding_time = htons(if_ad->holdtime);
cie->mtu = htons(if_ad->mtu);
debugf(NHRP_DEBUG_COMMON,
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c
index 8441d278f..60ce1e652 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) {