]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Clist: The add() function will append a new value
authorPavel Tvrdik <pawel.tvrdik@gmail.com>
Thu, 13 Oct 2016 14:57:21 +0000 (16:57 +0200)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Thu, 13 Oct 2016 14:59:15 +0000 (16:59 +0200)
The add() function used to prepend a new community to clist, but after
this fix the add() function appends new community.

nest/a-set.c

index fde34cabc1bf3eaf409665a755a2df0d430621f4..bd244e2e3662338cd3e3fc6a3baa81fac57acc29 100644 (file)
@@ -244,9 +244,13 @@ int_set_add(struct linpool *pool, struct adata *list, u32 val)
   len = list ? list->length : 0;
   res = lp_alloc(pool, sizeof(struct adata) + len + 4);
   res->length = len + 4;
-  * (u32 *) res->data = val;
+
   if (list)
-    memcpy((char *) res->data + 4, list->data, list->length);
+    memcpy(res->data, list->data, list->length);
+
+  u32 *c = (u32 *) (res->data + len);
+  *c = val;
+
   return res;
 }