diff options
author | Amold Lad <amol.lad@4rf.com> | 2021-03-19 11:53:53 +0100 |
---|---|---|
committer | Reuben Dowle <reuben.dowle@4rf.com> | 2021-03-28 23:17:19 +0200 |
commit | bcf5673d611289c6d117b68e7bfd1d62aea6393c (patch) | |
tree | 414063c393eb31486d73fdfeec3b7464a1688eda /nhrpd | |
parent | nhrpd: Remove unecessary new line from debug messages (diff) | |
download | frr-bcf5673d611289c6d117b68e7bfd1d62aea6393c.tar.xz frr-bcf5673d611289c6d117b68e7bfd1d62aea6393c.zip |
nhrpd: Display post-nat NBMA for local addresses
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
Diffstat (limited to 'nhrpd')
-rw-r--r-- | nhrpd/nhrp_vty.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index 08900cfc6..a634d2df1 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -645,19 +645,36 @@ static void show_ip_nhrp_cache(struct nhrp_cache *c, void *pctx) ctx->count++; sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])); - if (c->cur.peer) - sockunion2str(&c->cur.peer->vc->remote.nbma, - buf[1], sizeof(buf[1])); - else - snprintf(buf[1], sizeof(buf[1]), "-"); + if (c->cur.type == NHRP_CACHE_LOCAL) { + struct nhrp_interface *nifp = c->ifp->info; - if (c->cur.peer - && sockunion_family(&c->cur.remote_nbma_claimed) != AF_UNSPEC) - sockunion2str(&c->cur.remote_nbma_claimed, - buf[2], sizeof(buf[2])); + if (sockunion_family(&nifp->nbma) != AF_UNSPEC) { + sockunion2str(&nifp->nbma, buf[1], sizeof(buf[1])); + sockunion2str(&nifp->nbma, buf[2], sizeof(buf[2])); + } + else { + snprintf(buf[1], sizeof(buf[1]), "-"); + snprintf(buf[2], sizeof(buf[2]), "-"); + } - else - snprintf(buf[2], sizeof(buf[2]), "-"); + /* if we are behind NAT then update NBMA field */ + if (sockunion_family(&nifp->nat_nbma) != AF_UNSPEC) + sockunion2str(&nifp->nat_nbma, buf[1], sizeof(buf[1])); + } else { + if (c->cur.peer) + sockunion2str(&c->cur.peer->vc->remote.nbma, + buf[1], sizeof(buf[1])); + else + snprintf(buf[1], sizeof(buf[1]), "-"); + + if (c->cur.peer + && sockunion_family(&c->cur.remote_nbma_claimed) + != AF_UNSPEC) + sockunion2str(&c->cur.remote_nbma_claimed, + buf[2], sizeof(buf[2])); + else + snprintf(buf[2], sizeof(buf[2]), "-"); + } if (ctx->json) { json = json_object_new_object(); |