Merge pull request #8262 from reubendowle/fixes/nhrp-misc-fixes

nhrp misc fixes
This commit is contained in:
Donald Sharp 2021-08-08 07:27:41 -04:00 committed by GitHub
commit 2570a9f165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -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,

View File

@ -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) {