summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-03-08 19:28:31 +0100
committerMaria Matejka <mq@ucw.cz>2023-04-04 17:00:58 +0200
commit227352c4611a9024c93b22c94c7bbd9ac474effe (patch)
tree0acc4c16de5b7b8d78720504137ad127bf2d1d8b /proto/bgp
parent2898f8f1771dedf4e385a5c0333da03e55d5decb (diff)
BGP Export Table: Fixed route source objects leaking when prefix best routes is updated
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 8dc5ac3e..1c934301 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -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);