From bb02fb186aa07865d4f152f3ff845637514d0a7f Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 29 Oct 2024 22:28:01 +0100 Subject: [PATCH] bgpd: bmp_route_update, replace bgp_bmp_get with bgp_bmp_find There is no need to create the bgp bmp instance, while there is no bmp target to send data to. Rewrite the code by using bgp_bmp_find() API instead. Signed-off-by: Philippe Guibert --- bgpd/bgp_bmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index f71e13c522..019ea2669d 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -3117,11 +3117,14 @@ static int bmp_route_update(struct bgp *bgp, afi_t afi, safi_t safi, return 0; } - struct bmp_bgp *bmpbgp = bmp_bgp_get(bgp); + struct bmp_bgp *bmpbgp = bmp_bgp_find(bgp); struct peer *peer = updated_route->peer; struct bmp_targets *bt; struct bmp *bmp; + if (!bmpbgp) + return 0; + frr_each (bmp_targets, &bmpbgp->targets, bt) { if (CHECK_FLAG(bt->afimon[afi][safi], BMP_MON_LOC_RIB)) { is_locribmon_enabled = true;