diff options
author | Maria Matejka <mq@ucw.cz> | 2022-05-30 12:03:03 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-30 14:39:09 +0200 |
commit | 938742decc6e1d6d3a0375dd012b75172e747bbc (patch) | |
tree | a10d9eb2811af43075c2c5272ece7b3dbbb38cdf /nest/rt-dev.c | |
parent | 950775f6fa3d569a9d7cd05e33538d35e895d688 (diff) |
Squashing the route attribute structure into one level.
For now, all route attributes are stored as eattrs in ea_list. This
should make route manipulation easier and it also allows for a layered
approach of route attributes where updates from filters will be stored
as an overlay over the previous version.
Diffstat (limited to 'nest/rt-dev.c')
-rw-r--r-- | nest/rt-dev.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/nest/rt-dev.c b/nest/rt-dev.c index c50e018c..63f8a26b 100644 --- a/nest/rt-dev.c +++ b/nest/rt-dev.c @@ -71,7 +71,6 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad) } else if (flags & IF_CHANGE_UP) { - rta *a; rte *e; DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip); @@ -82,18 +81,17 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad) /* Use iface ID as local source ID */ struct rte_src *src = rt_get_source(P, ad->iface->index); - rta a0 = {}; + ea_list *ea = NULL; struct nexthop_adata nhad = { .nh = { .iface = ad->iface, }, .ad = { .length = (void *) NEXTHOP_NEXT(&nhad.nh) - (void *) nhad.ad.data, }, }; - ea_set_attr_u32(&a0.eattrs, &ea_gen_preference, 0, c->preference); - ea_set_attr_u32(&a0.eattrs, &ea_gen_source, 0, RTS_DEVICE); - ea_set_attr_data(&a0.eattrs, &ea_gen_nexthop, 0, nhad.ad.data, nhad.ad.length); + ea_set_attr_u32(&ea, &ea_gen_preference, 0, c->preference); + ea_set_attr_u32(&ea, &ea_gen_source, 0, RTS_DEVICE); + ea_set_attr_data(&ea, &ea_gen_nexthop, 0, nhad.ad.data, nhad.ad.length); - a = rta_lookup(&a0); - e = rte_get_temp(a, src); + e = rte_get_temp(rta_lookup(ea), src); e->pflags = 0; rte_update2(c, net, e, src); } |