summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorMaria Jan Matejka <mq@jmq.cz>2018-06-29 17:23:27 +0200
committerMaria Jan Matejka <mq@jmq.cz>2018-06-29 17:26:28 +0200
commitdaf113ac66fb9dc83a904ce9bcc68e90830624d0 (patch)
tree5f14cb5301182eaf51a5ab04c60d055d44dbeac1 /proto/bgp
parentd8e816c150ebad08ff75ef34eb459a67a09a34d0 (diff)
BGP: Attribute set function merged with its common counterpart
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 8ecfaaa2..6580db57 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -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
+ );
}