Merge pull request #16700 from louis-6wind/fix-nhrp-output

nhrpd: fix show ip nhrp output
This commit is contained in:
Donatas Abraitis 2024-11-28 17:16:24 +02:00 committed by GitHub
commit 8e1231d061
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -933,6 +933,10 @@ static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
if (ctx->afi != family2afi(sockunion_family(&c->remote_addr))) if (ctx->afi != family2afi(sockunion_family(&c->remote_addr)))
return; return;
if (ctx->count && !ctx->json)
vty_out(ctx->vty, "\n");
ctx->count++;
sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])); sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0]));
if (c->cur.peer) if (c->cur.peer)
sockunion2str(&c->cur.peer->vc->remote.nbma, buf[1], sockunion2str(&c->cur.peer->vc->remote.nbma, buf[1],
@ -985,8 +989,6 @@ static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC) if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC)
vty_out(ctx->vty, "NBMA-NAT-OA-Address: %s\n", buf[2]); vty_out(ctx->vty, "NBMA-NAT-OA-Address: %s\n", buf[2]);
vty_out(ctx->vty, "\n\n");
} }
DEFUN(show_ip_nhrp, show_ip_nhrp_cmd, DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
@ -1030,7 +1032,6 @@ DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
else else
json_object_string_add(json_vrf, "status", "ok"); json_object_string_add(json_vrf, "status", "ok");
ctx.count++;
FOR_ALL_INTERFACES (vrf, ifp) FOR_ALL_INTERFACES (vrf, ifp)
nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx); nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx);
} }