forked from Mirror/frr
nhrpd: fix sh ip nhrp opennhrp json counter
"show ip nhrp opennhrp json" counter is incorrect.
> root@nhs1:/# vtysh -c 'sh ip nhrp opennhrp json' | jq .
> {
> "attr": {
> "status": "ok",
> "entriesCount": 1 <=== NOK
> },
> "table": [
> {
> "type": "dynamic",
> "up": true,
> "used": false,
> "protocolAddress": "172.16.1.4",
> "protocolAddressSize": 32,
> "nbmaAddress": "192.168.2.4"
> },
> {
> "type": "dynamic",
> "up": true,
> "used": false,
> "protocolAddress": "172.16.1.5",
> "protocolAddressSize": 32,
> "nbmaAddress": "192.168.2.5"
> }
> ]
> }
>
Fixes: 87b9e98203
("nhrpd: add json support to show nhrp vty commands")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
5fecb1f425
commit
65d62d982e
|
@ -934,6 +934,8 @@ static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
|
|||
if (ctx->afi != family2afi(sockunion_family(&c->remote_addr)))
|
||||
return;
|
||||
|
||||
ctx->count++;
|
||||
|
||||
sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0]));
|
||||
if (c->cur.peer)
|
||||
sockunion2str(&c->cur.peer->vc->remote.nbma, buf[1],
|
||||
|
@ -1031,7 +1033,6 @@ DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
|
|||
else
|
||||
json_object_string_add(json_vrf, "status", "ok");
|
||||
|
||||
ctx.count++;
|
||||
FOR_ALL_INTERFACES (vrf, ifp)
|
||||
nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue