diff options
| author | Louis Scalbert <louis.scalbert@6wind.com> | 2024-08-30 17:50:40 +0200 |
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2024-10-17 11:24:50 +0200 |
| commit | 65d62d982eae072bf02fc80fe4c0a67c91af3c88 (patch) | |
| tree | a3cf24012b2c22c59f4a993ac2b9dcf56d3fc3b1 | |
| parent | 5fecb1f425507eb216abbf0424d7430640469b55 (diff) | |
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>
| -rw-r--r-- | nhrpd/nhrp_vty.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index f202576960..0fc3dee98d 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -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); } |
