summaryrefslogtreecommitdiff
path: root/bgpd/bgp_nht.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2024-03-29 12:07:14 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2024-03-29 17:20:31 +0100
commite20faa9fe0dee04d46d67cfabf195c7eb071dcbf (patch)
tree88c4ed524f0dfc27c870cb12a62b5a54a56d789f /bgpd/bgp_nht.c
parentd5f17cd51e6e5fcef4c8b8509a3538d655dadf36 (diff)
bgpd: add resolved_prefix visibility on nht
The nexthop tracking never displays the prefix that has been used in ZEBRA to resolve its nexthop. This information will be useful if some decision has to be taken regarding any loops, that is to say if for instance a BGP prefix is resolved over a prefix in ZEBRA that is exactly the same. Store the value in bgp nexthop context, and display it. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_nht.c')
-rw-r--r--bgpd/bgp_nht.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 786d07c5a9..20a285b9d9 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -626,6 +626,8 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
} else if (nhr->nexthop_num) {
struct peer *peer = bnc->nht_info;
+ prefix_copy(&bnc->resolved_prefix, &nhr->prefix);
+
/* notify bgp fsm if nbr ip goes from invalid->valid */
if (!bnc->nexthop_num)
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
@@ -731,6 +733,7 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
}
}
} else {
+ memset(&bnc->resolved_prefix, 0, sizeof(bnc->resolved_prefix));
bnc->flags &= ~BGP_NEXTHOP_EVPN_INCOMPLETE;
bnc->flags &= ~BGP_NEXTHOP_VALID;
bnc->flags &= ~BGP_NEXTHOP_LABELED_VALID;