diff options
| -rw-r--r-- | nhrpd/nhrp_shortcut.c | 4 | ||||
| -rw-r--r-- | nhrpd/nhrp_vty.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 56861551ea..0905ceb72a 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 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) { |
