]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP export table src fix
authorMaria Matejka <mq@ucw.cz>
Wed, 12 Feb 2025 20:29:10 +0000 (21:29 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 25 Feb 2025 13:40:46 +0000 (14:40 +0100)
When exchanging routes in BGP export table, we forgot to update
the src in cases of add path off. This led to falsely claiming another
origin of that route in export table dump and also holding protocols
in the flush state because of their srcs being kept in the export tables.

proto/bgp/attrs.c

index db654234343e3af0eb63c11ee0926c0672e6b262..01bc883407d989f73d308f37032e46b1197d3b78 100644 (file)
@@ -1843,7 +1843,17 @@ bgp_get_prefix(struct bgp_ptx_private *c, struct netindex *ni, struct rte_src *s
   /* Find existing */
   struct bgp_prefix *px = bgp_find_prefix(c, ni, src, add_path_tx);
   if (px)
+  {
+    /* If sending only best path, we have to exchange the stored src */
+    if (px->src != src)
+    {
+      rt_unlock_source(px->src);
+      rt_lock_source(src);
+      px->src = src;
+    }
+
     return px;
+  }
 
   /* Allocate new prefix */
   px = sl_alloc(c->prefix_slab);