summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_nexthop.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-07-21 21:42:51 +0200
committerDonald Sharp <sharpd@nvidia.com>2022-07-22 15:09:39 +0200
commit35aae5c9bcf91703b74464d2b0dca6504bd37e39 (patch)
tree3360bcc2919ac5b153589f4118935072486af686 /bgpd/bgp_nexthop.c
parentMerge pull request #11658 from Jafaral/up-rel8.3 (diff)
downloadfrr-35aae5c9bcf91703b74464d2b0dca6504bd37e39.tar.xz
frr-35aae5c9bcf91703b74464d2b0dca6504bd37e39.zip
bgpd: LL peers need bnc's per peer
FRR should create a bnc per peer. Not have one's that write over others. Currently when FRR has multiple Interface based peering, BGP wa creating a single BNC. This is insufficient in that we were accidently overwriting the one LL with other data. This causes issues when there are multiple and there is weird starting issues with those interfaces that you are peering over. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r--bgpd/bgp_nexthop.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index c6043807d..e1fcc743e 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -56,6 +56,11 @@ int bgp_nexthop_cache_compare(const struct bgp_nexthop_cache *a,
if (a->srte_color > b->srte_color)
return 1;
+ if (a->ifindex < b->ifindex)
+ return -1;
+ if (a->ifindex > b->ifindex)
+ return 1;
+
return prefix_cmp(&a->prefix, &b->prefix);
}
@@ -70,13 +75,15 @@ void bnc_nexthop_free(struct bgp_nexthop_cache *bnc)
}
struct bgp_nexthop_cache *bnc_new(struct bgp_nexthop_cache_head *tree,
- struct prefix *prefix, uint32_t srte_color)
+ struct prefix *prefix, uint32_t srte_color,
+ ifindex_t ifindex)
{
struct bgp_nexthop_cache *bnc;
bnc = XCALLOC(MTYPE_BGP_NEXTHOP_CACHE,
sizeof(struct bgp_nexthop_cache));
bnc->prefix = *prefix;
+ bnc->ifindex = ifindex;
bnc->srte_color = srte_color;
bnc->tree = tree;
LIST_INIT(&(bnc->paths));
@@ -106,7 +113,8 @@ void bnc_free(struct bgp_nexthop_cache *bnc)
}
struct bgp_nexthop_cache *bnc_find(struct bgp_nexthop_cache_head *tree,
- struct prefix *prefix, uint32_t srte_color)
+ struct prefix *prefix, uint32_t srte_color,
+ ifindex_t ifindex)
{
struct bgp_nexthop_cache bnc = {};
@@ -115,6 +123,7 @@ struct bgp_nexthop_cache *bnc_find(struct bgp_nexthop_cache_head *tree,
bnc.prefix = *prefix;
bnc.srte_color = srte_color;
+ bnc.ifindex = ifindex;
return bgp_nexthop_cache_find(tree, &bnc);
}
@@ -915,7 +924,7 @@ static int show_ip_bgp_nexthop_table(struct vty *vty, const char *name,
}
tree = import_table ? &bgp->import_check_table
: &bgp->nexthop_cache_table;
- bnc = bnc_find(tree[family2afi(nhop.family)], &nhop, 0);
+ bnc = bnc_find(tree[family2afi(nhop.family)], &nhop, 0, 0);
if (!bnc) {
vty_out(vty, "specified nexthop does not have entry\n");
return CMD_SUCCESS;