]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fix some failed asserts due to add_tail()
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 24 Nov 2020 02:42:23 +0000 (03:42 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 24 Nov 2020 02:42:23 +0000 (03:42 +0100)
When config structures are copied due to template application,
we need to reset list node structure before calling add_tail().

Thanks to Mikael Magnusson for patches.

conf/conf.c
nest/proto.c
proto/static/static.c

index b21d5213ad198a4347ce81a183cbeaf478880378..6f64b5416c59029b43ee1d10beafd919b897140e 100644 (file)
@@ -573,6 +573,7 @@ cfg_copy_list(list *dest, list *src, unsigned node_size)
   {
     dn = cfg_alloc(node_size);
     memcpy(dn, sn, node_size);
+    memset(dn, 0, sizeof(node));
     add_tail(dest, dn);
   }
 }
index 41b3a6b9ce37e1df2921a9ab6755eeddc12fa287..748601c36064e38fde105e8d973ad3d936516571 100644 (file)
@@ -626,6 +626,7 @@ channel_copy_config(struct channel_config *src, struct proto_config *proto)
   struct channel_config *dst = cfg_alloc(src->channel->config_size);
 
   memcpy(dst, src, src->channel->config_size);
+  memset(&dst->n, 0, sizeof(node));
   add_tail(&proto->channels, &dst->n);
   CALL(src->channel->copy_config, dst, src);
 
index 7b22d49b3c83e2ed51da1018026ebf5dbb03fb7e..941e916f8a3f3b9d610184ee23442189d8f753ad 100644 (file)
@@ -643,6 +643,7 @@ static_copy_config(struct proto_config *dest, struct proto_config *src)
     {
       dnh = cfg_alloc(sizeof(struct static_route));
       memcpy(dnh, snh, sizeof(struct static_route));
+      memset(&dnh->n, 0, sizeof(node));
 
       if (!drt)
        add_tail(&d->routes, &(dnh->n));