]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: bmp locrib monitoring unlock node after lookup
authorMaxou <maxence.younsi@insa-lyon.fr>
Fri, 12 Aug 2022 14:45:05 +0000 (16:45 +0200)
committerMaxence Younsi <mx.yns@outlook.fr>
Sat, 4 Nov 2023 11:17:48 +0000 (12:17 +0100)
bgp_afi_node_lookup calls bgp_node_lookup which locks the node, unlocking it safely after function is finished

Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
bgpd/bgp_bmp.c

index 820720df55f8f450dc079b3675ff35f4e9d97520..f52c069f3cdb7da61f2c1621e49493ae9129b543 100644 (file)
@@ -1213,7 +1213,7 @@ static inline struct bmp_queue_entry *bmp_pull_locrib(struct bmp *bmp)
                                   &bmp->locrib_queuepos);
 }
 
-/* TODO BMP_MON_LOCRIB  find a way to merge properly this function with
+/* TODO BMP_MON_LOCRIB find a way to merge properly this function with
  * bmp_wrqueue or abstract it if possible
  */
 static bool bmp_wrqueue_locrib(struct bmp *bmp, struct pullwr *pullwr)
@@ -1221,7 +1221,7 @@ static bool bmp_wrqueue_locrib(struct bmp *bmp, struct pullwr *pullwr)
 
        struct bmp_queue_entry *bqe;
        struct peer *peer;
-       struct bgp_dest *bn;
+       struct bgp_dest *bn = NULL;
        bool written = false;
 
        bqe = bmp_pull_locrib(bmp);
@@ -1274,10 +1274,6 @@ static bool bmp_wrqueue_locrib(struct bmp *bmp, struct pullwr *pullwr)
                                 &bqe->p, prd);
 
        struct bgp_path_info *bpi;
-
-       struct bgp_path_info *pathinfo = NULL;
-       pathinfo = bgp_dest_get_bgp_path_info(bn);
-
        for (bpi = bn ? bgp_dest_get_bgp_path_info(bn) : NULL; bpi;
             bpi = bpi->next) {
                if (!CHECK_FLAG(bpi->flags, BGP_PATH_SELECTED))
@@ -1294,6 +1290,10 @@ static bool bmp_wrqueue_locrib(struct bmp *bmp, struct pullwr *pullwr)
 out:
        if (!bqe->refcount)
                XFREE(MTYPE_BMP_QUEUE, bqe);
+
+       if (bn)
+               bgp_dest_unlock_node(bn);
+
        return written;
 }