From c032d532556ab4e1cbef9862f7eb9100dbd1126e Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 20 Sep 2024 08:47:56 +0200 Subject: bgpd: bmp, handle imported bgp instances for route updates Upon route update, the list of available BGP instances that import the BGP instance where this updates comes from, is checked. For each eligible BGP instance, the route update is sent. Signed-off-by: Philippe Guibert --- bgpd/bgp_bmp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index d1f2083f7..91d566f3e 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -3216,6 +3216,8 @@ static int bmp_route_update(struct bgp *bgp, afi_t afi, safi_t safi, struct bmp_bgp *bmpbgp; struct bmp_targets *bt; int ret = 0; + struct bgp *bgp_vrf; + struct listnode *node; /* this should never happen */ if (!updated_route) { @@ -3223,13 +3225,18 @@ static int bmp_route_update(struct bgp *bgp, afi_t afi, safi_t safi, return 0; } - bmpbgp = bmp_bgp_find(bgp); - if (!bmpbgp) - return 0; - - frr_each (bmp_targets, &bmpbgp->targets, bt) - if (CHECK_FLAG(bt->afimon[afi][safi], BMP_MON_LOC_RIB)) + for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, bgp_vrf)) { + bmpbgp = bmp_bgp_find(bgp_vrf); + if (!bmpbgp) + continue; + frr_each (bmp_targets, &bmpbgp->targets, bt) { + if (!CHECK_FLAG(bt->afimon[afi][safi], BMP_MON_LOC_RIB)) + continue; + if (bgp_vrf != bgp && !bmp_imported_bgp_find(bt, bgp->name)) + continue; ret = bmp_route_update_bgpbmp(bt, afi, safi, bn, old_route, new_route); + } + } return ret; } -- cgit v1.2.3