diff options
author | Maria Matejka <mq@ucw.cz> | 2019-03-18 12:54:40 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2019-03-18 12:54:40 +0100 |
commit | 8d65add626b34256879a3e83855af3c0fa8ce4e7 (patch) | |
tree | dafa110c47bc328f4006d4298fd641e8210381b4 /sysdep/unix/krt.c | |
parent | 2f02c25e36f3946019c24dafe9b894a9e195350d (diff) | |
parent | 5d511948cddee415c2f0f1103bda0468a193f2d6 (diff) |
Merge branch 'master' into HEAD
Diffstat (limited to 'sysdep/unix/krt.c')
-rw-r--r-- | sysdep/unix/krt.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 24a4168d..2cec2cae 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -301,7 +301,7 @@ krt_learn_announce_update(struct krt_proto *p, rte *e) net *n = e->net; rta *aa = rta_clone(e->attrs); rte *ee = rte_get_temp(aa); - ee->pflags = 0; + ee->pflags = EA_ID_FLAG(EA_KRT_SOURCE) | EA_ID_FLAG(EA_KRT_METRIC); ee->u.krt = e->u.krt; rte_update(&p->p, n->n.addr, ee); } @@ -577,7 +577,7 @@ krt_export_net(struct krt_proto *p, net *net, rte **rt_free) if (filter == FILTER_REJECT) return NULL; - rte_make_tmp_attrs(&rt, krt_filter_lp); + rte_make_tmp_attrs(&rt, krt_filter_lp, NULL); /* We could run krt_preexport() here, but it is already handled by KRF_INSTALLED */ @@ -910,33 +910,20 @@ krt_scan_timer_kick(struct krt_proto *p) * Updates */ -static struct ea_list * -krt_make_tmp_attrs(rte *rt, struct linpool *pool) +static void +krt_make_tmp_attrs(struct rte *rt, struct linpool *pool) { - struct ea_list *l = lp_alloc(pool, sizeof(struct ea_list) + 2 * sizeof(eattr)); - - l->next = NULL; - l->flags = EALF_SORTED; - l->count = 2; - - l->attrs[0].id = EA_KRT_SOURCE; - l->attrs[0].flags = 0; - l->attrs[0].type = EAF_TYPE_INT | EAF_TEMP; - l->attrs[0].u.data = rt->u.krt.proto; - - l->attrs[1].id = EA_KRT_METRIC; - l->attrs[1].flags = 0; - l->attrs[1].type = EAF_TYPE_INT | EAF_TEMP; - l->attrs[1].u.data = rt->u.krt.metric; - - return l; + rte_init_tmp_attrs(rt, pool, 2); + rte_make_tmp_attr(rt, EA_KRT_SOURCE, EAF_TYPE_INT, rt->u.krt.proto); + rte_make_tmp_attr(rt, EA_KRT_METRIC, EAF_TYPE_INT, rt->u.krt.metric); } static void -krt_store_tmp_attrs(rte *rt) +krt_store_tmp_attrs(struct rte *rt, struct linpool *pool) { - /* EA_KRT_SOURCE is read-only */ - rt->u.krt.metric = ea_get_int(rt->attrs->eattrs, EA_KRT_METRIC, 0); + rte_init_tmp_attrs(rt, pool, 2); + rt->u.krt.proto = rte_store_tmp_attr(rt, EA_KRT_SOURCE); + rt->u.krt.metric = rte_store_tmp_attr(rt, EA_KRT_METRIC); } static int |