]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP Export Table: Fixed route source objects leaking when prefix best routes is updated
authorMaria Matejka <mq@ucw.cz>
Wed, 8 Mar 2023 18:28:31 +0000 (19:28 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Apr 2023 15:00:58 +0000 (17:00 +0200)
proto/bgp/attrs.c

index 8dc5ac3e046b832812b1237b30cb40a1329e962f..1c934301a7c6129d56f3775ca199a1031002d38c 100644 (file)
@@ -1702,7 +1702,16 @@ bgp_get_prefix(struct bgp_pending_tx *c, const net_addr *net, struct rte_src *sr
   struct bgp_prefix *px = HASH_FIND(c->prefix_hash, PXH, net, path_id_hash, hash);
 
   if (px)
+  {
+    if (!add_path_tx && (path_id != px->path_id))
+    {
+      rt_unlock_source(rt_find_source_global(px->path_id));
+      rt_lock_source(src);
+      px->path_id = path_id;
+    }
+
     return px;
+  }
 
   if (c->prefix_slab)
     px = sl_alloc(c->prefix_slab);