]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: bmp_route_update, replace bgp_bmp_get with bgp_bmp_find
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 29 Oct 2024 21:28:01 +0000 (22:28 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 30 Dec 2024 14:13:38 +0000 (15:13 +0100)
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 <philippe.guibert@6wind.com>
bgpd/bgp_bmp.c

index f71e13c522f08fc18431d7af05d23f2cc4efc84f..019ea2669dbf3ea658821fe5f770f85fe2051e61 100644 (file)
@@ -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;