diff options
author | Maria Matejka <mq@ucw.cz> | 2022-03-14 11:13:48 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-04-06 18:14:08 +0200 |
commit | 0f68515263e91dd49b2d845cdff35af40c064dc2 (patch) | |
tree | 8ae7a4859016173a191bd38e8d4aab160dc49825 /proto/bgp | |
parent | 63cf5d5d8c8e156a1f427614c8017ca71c32191c (diff) |
Unsetting route attributes without messing with type system
Diffstat (limited to 'proto/bgp')
-rw-r--r-- | proto/bgp/attrs.c | 4 | ||||
-rw-r--r-- | proto/bgp/bgp.h | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 0513dd7c..454686cf 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -106,7 +106,7 @@ bgp_set_attr(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintp ({ REPORT(msg, ## args); s->err_withdraw = 1; return; }) #define UNSET(a) \ - ({ a->type = EAF_TYPE_UNDEF; return; }) + ({ a->undef = 1; return; }) #define REJECT(msg, args...) \ ({ log(L_ERR "%s: " msg, s->proto->p.name, ## args); s->err_reject = 1; return; }) @@ -1161,7 +1161,7 @@ bgp_export_attr(struct bgp_export_state *s, eattr *a, ea_list *to) CALL(desc->export, s, a); /* Attribute might become undefined in hook */ - if ((a->type & EAF_TYPE_MASK) == EAF_TYPE_UNDEF) + if (a->undef) return; } else diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index bff49c3a..8a44514c 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -563,9 +563,7 @@ bgp_set_attr_data(ea_list **to, struct linpool *pool, uint code, uint flags, voi bgp_set_attr(to, pool, code, flags, (uintptr_t) a); } -static inline void -bgp_unset_attr(ea_list **to, struct linpool *pool, uint code) -{ eattr *e = bgp_set_attr(to, pool, code, 0, 0); e->type = EAF_TYPE_UNDEF; } +#define bgp_unset_attr(to, pool, code) ea_unset_attr(to, pool, 0, code) int bgp_encode_mp_reach_mrt(struct bgp_write_state *s, eattr *a, byte *buf, uint size); |