]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Attribute set function merged with its common counterpart
authorMaria Jan Matejka <mq@jmq.cz>
Fri, 29 Jun 2018 15:23:27 +0000 (17:23 +0200)
committerMaria Jan Matejka <mq@jmq.cz>
Fri, 29 Jun 2018 15:26:28 +0000 (17:26 +0200)
proto/bgp/attrs.c

index 8ecfaaa2d06cec6ef8074bfe0d1d02acfe057f4f..6580db574644d4d06202215ea74d4a0c3d228b85 100644 (file)
@@ -84,24 +84,14 @@ bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintp
 {
   ASSERT(bgp_attr_known(code));
 
-  ea_list *a = lp_alloc(pool, sizeof(ea_list) + sizeof(eattr));
-  eattr *e = &a->attrs[0];
-
-  a->flags = EALF_SORTED;
-  a->count = 1;
-  a->next = *attrs;
-  *attrs = a;
-
-  e->id = EA_CODE(PROTOCOL_BGP, code);
-  e->type = bgp_attr_table[code].type;
-  e->flags = flags;
-
-  if (e->type & EAF_EMBEDDED)
-    e->u.data = (u32) val;
-  else
-    e->u.ptr = (struct adata *) val;
-
-  return e;
+  return ea_set_attr(
+      attrs,
+      pool,
+      EA_CODE(PROTOCOL_BGP, code),
+      flags,
+      bgp_attr_table[code].type,
+      val
+  );
 }