diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-03-14 17:22:22 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-03-14 17:31:40 +0100 |
commit | 875cc073b067f295cccc668008e10218f8e98dd3 (patch) | |
tree | 28f65beeab81c8b422dd9d7c18a4f4f331adeb31 /nest/route.h | |
parent | 9aa77fccebc4d84b5e1496884cd124d09893041b (diff) |
Nest: Update handling of temporary attributes
The temporary atttributes are no longer removed by ea_do_prune(), but
they are undefined by store_tmp_attrs() protocol hooks. This fixes
several bugs where temporary attributes were removed when they should
not or not removed when they should be. The flag EAF_TEMP is no longer
needed and was removed.
Update all protocol make_tmp_attrs() / store_tmp_attrs() hooks to use
helper functions and to handle unset attributes properly.
Also fix some related bugs like improper handling of empty eattr list.
Diffstat (limited to 'nest/route.h')
-rw-r--r-- | nest/route.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/nest/route.h b/nest/route.h index 3e835bb1..15aac8f6 100644 --- a/nest/route.h +++ b/nest/route.h @@ -308,8 +308,10 @@ void rte_free(rte *); rte *rte_do_cow(rte *); static inline rte * rte_cow(rte *r) { return (r->flags & REF_COW) ? rte_do_cow(r) : r; } rte *rte_cow_rta(rte *r, linpool *lp); -void rte_make_tmp_attr(struct rte *r, struct ea_list *e, uint id, uint type, u32 val); -uint rte_store_tmp_attr(struct rte *r, uint id); +void rte_init_tmp_attrs(struct rte *r, linpool *lp, uint max); +void rte_make_tmp_attr(struct rte *r, uint id, uint type, uintptr_t val); +void rte_make_tmp_attrs(struct rte **r, struct linpool *pool, struct rta **old_attrs); +uintptr_t rte_store_tmp_attr(struct rte *r, uint id); void rt_dump(rtable *); void rt_dump_all(void); int rt_feed_channel(struct channel *c); @@ -512,7 +514,6 @@ const char *ea_custom_name(uint ea); #define EAF_VAR_LENGTH 0x02 /* Attribute length is variable (part of type spec) */ #define EAF_ORIGINATED 0x20 /* The attribute has originated locally */ #define EAF_FRESH 0x40 /* An uncached attribute (e.g. modified in export filter) */ -#define EAF_TEMP 0x80 /* A temporary attribute (the one stored in the tmp attr list) */ typedef struct adata { uint length; /* Length of data */ @@ -542,6 +543,7 @@ typedef struct ea_list { #define EALF_SORTED 1 /* Attributes are sorted by code */ #define EALF_BISECT 2 /* Use interval bisection for searching */ #define EALF_CACHED 4 /* Attributes belonging to cached rta */ +#define EALF_TEMP 8 /* Temporary ea_list added by make_tmp_attrs hooks */ struct rte_src *rt_find_source(struct proto *p, u32 id); struct rte_src *rt_get_source(struct proto *p, u32 id); @@ -574,6 +576,8 @@ void ea_format_bitfield(struct eattr *a, byte *buf, int bufsize, const char **na ea = t; \ } \ ea_sort(ea); \ + if (ea->count == 0) \ + ea = NULL; \ } while(0) \ static inline eattr * |