]> 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>
Sun, 23 Feb 2025 19:26:22 +0000 (20:26 +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 b986ac8b822b9dbf380882fba8b04d9573303267..7ef81c38fcea339603a608a64720bf8b8198526f 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);