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/protocol.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/protocol.h')
-rw-r--r-- | nest/protocol.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/nest/protocol.h b/nest/protocol.h index 6c04071b..56d66ed5 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -194,8 +194,8 @@ struct proto { * ifa_notify Notify protocol about interface address changes. * rt_notify Notify protocol about routing table updates. * neigh_notify Notify protocol about neighbor cache events. - * make_tmp_attrs Construct ea_list from private attrs stored in rta. - * store_tmp_attrs Store private attrs back to rta. The route MUST NOT be cached. + * make_tmp_attrs Add attributes to rta from from private attrs stored in rte. The route and rta MUST NOT be cached. + * store_tmp_attrs Store private attrs back to rte and undef added attributes. The route and rta MUST NOT be cached. * preexport Called as the first step of the route exporting process. * It can construct a new rte, add private attributes and * decide whether the route shall be exported: 1=yes, -1=no, @@ -211,8 +211,8 @@ struct proto { void (*ifa_notify)(struct proto *, unsigned flags, struct ifa *a); void (*rt_notify)(struct proto *, struct channel *, struct network *net, struct rte *new, struct rte *old); void (*neigh_notify)(struct neighbor *neigh); - struct ea_list *(*make_tmp_attrs)(struct rte *rt, struct linpool *pool); - void (*store_tmp_attrs)(struct rte *rt); + void (*make_tmp_attrs)(struct rte *rt, struct linpool *pool); + void (*store_tmp_attrs)(struct rte *rt, struct linpool *pool); int (*preexport)(struct proto *, struct rte **rt, struct linpool *pool); void (*reload_routes)(struct channel *); void (*feed_begin)(struct channel *, int initial); @@ -297,18 +297,6 @@ proto_get_router_id(struct proto_config *pc) return pc->router_id ? pc->router_id : pc->global->router_id; } -static inline void -rte_make_tmp_attrs(struct rte **rt, struct linpool *pool) -{ - struct ea_list *(*mta)(struct rte *rt, struct linpool *pool); - mta = (*rt)->attrs->src->proto->make_tmp_attrs; - if (!mta) return; - *rt = rte_cow_rta(*rt, pool); - struct ea_list *ea = mta(*rt, pool); - ea->next = (*rt)->attrs->eattrs; - (*rt)->attrs->eattrs = ea; -} - extern pool *proto_pool; extern list proto_list; |