summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-11-25 15:44:00 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-11-25 15:48:22 +0100
commit246586771296d1c42a012c06bdc75b36a7ce0b4f (patch)
tree3409df5853e08c0905297691a851f2c998c59240
parent62d57b9bdf82cc978f889f0118c8aa19ae999a3d (diff)
BGP: Zero the newly allocated bucket structure
This fixes an issue with dirty node passed to add_tail(). Thanks to Andreas Rammhold for the initial patch.
-rw-r--r--proto/bgp/attrs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 828bc118..b2c37301 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -1477,6 +1477,7 @@ bgp_get_bucket(struct bgp_channel *c, ea_list *new)
/* Create the bucket */
b = mb_alloc(c->pool, size);
+ *b = (struct bgp_bucket) { };
init_list(&b->prefixes);
b->hash = hash;
@@ -1601,9 +1602,7 @@ bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id)
else
px = mb_alloc(c->pool, sizeof(struct bgp_prefix) + net->length);
- px->buck_node.next = NULL;
- px->buck_node.prev = NULL;
- px->next = NULL;
+ *px = (struct bgp_prefix) { };
px->hash = hash;
px->path_id = path_id;
net_copy(px->net, net);