summaryrefslogtreecommitdiffstats
path: root/nhrpd/nhrp_cache.c
diff options
context:
space:
mode:
authorAmol Lad <amol.lad@4rf.com>2021-03-03 11:41:56 +0100
committerReuben Dowle <reuben.dowle@4rf.com>2021-03-18 04:35:41 +0100
commit85365e51f095db530a2dc0cc6521d3c9c5acb972 (patch)
treeb75c6935ab37ee547ef93d3faf1776cd2947b99d /nhrpd/nhrp_cache.c
parentnhrpd: add NHS details in NAT Extension header (diff)
downloadfrr-85365e51f095db530a2dc0cc6521d3c9c5acb972.tar.xz
frr-85365e51f095db530a2dc0cc6521d3c9c5acb972.zip
nhrpd: Add Claimed NBMA field in sh ip nhrp cache output
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
Diffstat (limited to 'nhrpd/nhrp_cache.c')
-rw-r--r--nhrpd/nhrp_cache.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c
index 259e58e25..a8b12a080 100644
--- a/nhrpd/nhrp_cache.c
+++ b/nhrpd/nhrp_cache.c
@@ -212,7 +212,7 @@ static int nhrp_cache_do_timeout(struct thread *t)
c->t_timeout = NULL;
if (c->cur.type != NHRP_CACHE_INVALID)
- nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL);
+ nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL, NULL);
return 0;
}
@@ -301,7 +301,7 @@ static void nhrp_cache_peer_notifier(struct notifier_block *n,
case NOTIFY_PEER_DOWN:
case NOTIFY_PEER_IFCONFIG_CHANGED:
notifier_call(&c->notifier_list, NOTIFY_CACHE_DOWN);
- nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL);
+ nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL, NULL);
break;
case NOTIFY_PEER_NBMA_CHANGING:
if (c->cur.type == NHRP_CACHE_DYNAMIC)
@@ -422,7 +422,7 @@ static void nhrp_cache_newpeer_notifier(struct notifier_block *n,
int nhrp_cache_update_binding(struct nhrp_cache *c, enum nhrp_cache_type type,
int holding_time, struct nhrp_peer *p,
- uint32_t mtu, union sockunion *nbma_oa)
+ uint32_t mtu, union sockunion *nbma_oa, union sockunion *nbma_claimed)
{
char buf[2][SU_ADDRSTRLEN];
@@ -464,6 +464,12 @@ int nhrp_cache_update_binding(struct nhrp_cache *c, enum nhrp_cache_type type,
memset(&c->cur.remote_nbma_natoa, 0,
sizeof(c->cur.remote_nbma_natoa));
+ if (nbma_claimed)
+ c->cur.remote_nbma_claimed = *nbma_claimed;
+ else
+ memset(&c->cur.remote_nbma_claimed, 0,
+ sizeof(c->cur.remote_nbma_claimed));
+
nhrp_peer_unref(p);
} else {
debugf(NHRP_DEBUG_COMMON,
@@ -478,6 +484,9 @@ int nhrp_cache_update_binding(struct nhrp_cache *c, enum nhrp_cache_type type,
if (nbma_oa)
c->new.remote_nbma_natoa = *nbma_oa;
+ if (nbma_claimed)
+ c->new.remote_nbma_claimed = *nbma_claimed;
+
if (holding_time > 0)
c->new.expires = monotime(NULL) + holding_time;
else if (holding_time < 0)