diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2012-03-23 01:17:02 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2012-03-23 17:22:13 +0100 |
commit | 9ba2798c65c02254ec000ab03a76fbbaae1ddc97 (patch) | |
tree | 51f2a88061dd0f4adc122a122370658b4a557e18 /sysdep/unix/krt.c | |
parent | 72aed1a00ba9e18116d6fd907f7e1a36d0a0a583 (diff) |
Adds krt_metric linux route attribute.
Diffstat (limited to 'sysdep/unix/krt.c')
-rw-r--r-- | sysdep/unix/krt.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index de1188a1..f4bfca78 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -907,22 +907,36 @@ krt_shutdown(struct proto *P) return PS_DOWN; } -struct ea_list * +static struct ea_list * krt_make_tmp_attrs(struct rte *rt, struct linpool *pool) { - struct ea_list *l = lp_alloc(pool, sizeof(struct ea_list) + 1 * sizeof(eattr)); + struct ea_list *l = lp_alloc(pool, sizeof(struct ea_list) + 2 * sizeof(eattr)); l->next = NULL; l->flags = EALF_SORTED; - l->count = 1; + 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; } +static void +krt_store_tmp_attrs(struct rte *rt, struct ea_list *attrs) +{ + /* EA_KRT_SOURCE is read-only */ + rt->u.krt.metric = ea_get_int(attrs, EA_KRT_METRIC, 0); +} + + static struct proto * krt_init(struct proto_config *c) { @@ -930,6 +944,7 @@ krt_init(struct proto_config *c) p->p.accept_ra_types = RA_OPTIMAL; p->p.make_tmp_attrs = krt_make_tmp_attrs; + p->p.store_tmp_attrs = krt_store_tmp_attrs; p->p.import_control = krt_import_control; p->p.rt_notify = krt_notify; @@ -973,6 +988,10 @@ krt_get_attr(eattr * a, byte * buf, int buflen UNUSED) bsprintf(buf, "source"); return GA_NAME; + case EA_KRT_METRIC: + bsprintf(buf, "metric"); + return GA_NAME; + case EA_KRT_PREFSRC: bsprintf(buf, "prefsrc"); return GA_NAME; |