summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y2
-rw-r--r--nest/rt-attr.c160
-rw-r--r--nest/rt-dev.c10
-rw-r--r--nest/rt-show.c12
-rw-r--r--nest/rt-table.c108
-rw-r--r--nest/rt.h12
6 files changed, 98 insertions, 206 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 7c68a09a..2d73b4c7 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -850,7 +850,7 @@ CF_CLI(DUMP INTERFACES,,, [[Dump interface information]])
CF_CLI(DUMP NEIGHBORS,,, [[Dump neighbor cache]])
{ neigh_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP ATTRIBUTES,,, [[Dump attribute cache]])
-{ rta_dump_all(); cli_msg(0, ""); } ;
+{ ea_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP ROUTES,,, [[Dump routes]])
{ rt_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP TABLES,,, [[Dump table connections]])
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index f548a575..31e2057e 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -180,7 +180,6 @@ const char * flowspec_valid_names[FLOWSPEC__MAX] = {
pool *rta_pool;
-static slab *rta_slab;
static slab *rte_src_slab;
static struct idm src_ids;
@@ -949,17 +948,6 @@ ea_list_unref(ea_list *l)
}
}
-static inline void
-ea_free(ea_list *o)
-{
- if (o)
- {
- ea_list_unref(o);
- ASSERT(!o->next);
- mb_free(o);
- }
-}
-
void
ea_format_bitfield(const struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max)
{
@@ -1056,7 +1044,7 @@ ea_show_lc_set(struct cli *c, const struct adata *ad, byte *pos, byte *buf, byte
* If the protocol defining the attribute provides its own
* get_attr() hook, it's consulted first.
*/
-void
+static void
ea_show(struct cli *c, const eattr *e)
{
const struct adata *ad = (e->type & EAF_EMBEDDED) ? NULL : e->u.ptr;
@@ -1147,10 +1135,11 @@ ea_dump(ea_list *e)
}
while (e)
{
- debug("[%c%c%c]",
+ debug("[%c%c%c] uc=%d h=%08x",
(e->flags & EALF_SORTED) ? 'S' : 's',
(e->flags & EALF_BISECT) ? 'B' : 'b',
- (e->flags & EALF_CACHED) ? 'C' : 'c');
+ (e->flags & EALF_CACHED) ? 'C' : 'c',
+ e->uc, e->hash_key);
for(i=0; i<e->count; i++)
{
eattr *a = &e->attrs[i];
@@ -1242,12 +1231,12 @@ static uint rta_cache_count;
static uint rta_cache_size = 32;
static uint rta_cache_limit;
static uint rta_cache_mask;
-static rta **rta_hash_table;
+static ea_list **rta_hash_table;
static void
rta_alloc_hash(void)
{
- rta_hash_table = mb_allocz(rta_pool, sizeof(rta *) * rta_cache_size);
+ rta_hash_table = mb_allocz(rta_pool, sizeof(ea_list *) * rta_cache_size);
if (rta_cache_size < 32768)
rta_cache_limit = rta_cache_size * 2;
else
@@ -1255,44 +1244,14 @@ rta_alloc_hash(void)
rta_cache_mask = rta_cache_size - 1;
}
-static inline uint
-rta_hash(rta *a)
-{
- return ea_hash(a->eattrs);
-}
-
-static inline int
-rta_same(rta *x, rta *y)
-{
- return ea_same(x->eattrs, y->eattrs);
-}
-
-static rta *
-rta_copy(rta *o)
-{
- rta *r = sl_alloc(rta_slab);
-
- memcpy(r, o, rta_size(o));
- r->uc = 1;
- if (!r->eattrs)
- return r;
-
- uint elen = ea_list_size(o->eattrs);
- r->eattrs = mb_alloc(rta_pool, elen);
- ea_list_copy(r->eattrs, o->eattrs, elen);
- ea_list_ref(r->eattrs);
- r->eattrs->flags |= EALF_CACHED;
- return r;
-}
-
static inline void
-rta_insert(rta *r)
+rta_insert(ea_list *r)
{
uint h = r->hash_key & rta_cache_mask;
- r->next = rta_hash_table[h];
- if (r->next)
- r->next->pprev = &r->next;
- r->pprev = &rta_hash_table[h];
+ r->next_hash = rta_hash_table[h];
+ if (r->next_hash)
+ r->next_hash->pprev_hash = &r->next_hash;
+ r->pprev_hash = &rta_hash_table[h];
rta_hash_table[h] = r;
}
@@ -1301,8 +1260,8 @@ rta_rehash(void)
{
uint ohs = rta_cache_size;
uint h;
- rta *r, *n;
- rta **oht = rta_hash_table;
+ ea_list *r, *n;
+ ea_list **oht = rta_hash_table;
rta_cache_size = 2*rta_cache_size;
DBG("Rehashing rta cache from %d to %d entries.\n", ohs, rta_cache_size);
@@ -1310,7 +1269,7 @@ rta_rehash(void)
for(h=0; h<ohs; h++)
for(r=oht[h]; r; r=n)
{
- n = r->next;
+ n = r->next_hash;
rta_insert(r);
}
mb_free(oht);
@@ -1329,24 +1288,29 @@ rta_rehash(void)
* The extended attribute lists attached to the &rta are automatically
* converted to the normalized form.
*/
-rta *
-rta_lookup(rta *o)
+ea_list *
+ea_lookup(ea_list *o)
{
- rta *r;
+ ea_list *r;
uint h;
- ASSERT(!o->cached);
- if (o->eattrs)
- o->eattrs = ea_normalize(o->eattrs);
+ ASSERT(!ea_is_cached(o));
+ o = ea_normalize(o);
+ h = ea_hash(o);
+
+ for(r=rta_hash_table[h & rta_cache_mask]; r; r=r->next_hash)
+ if (r->hash_key == h && ea_same(r, o))
+ return ea_clone(r);
- h = rta_hash(o);
- for(r=rta_hash_table[h & rta_cache_mask]; r; r=r->next)
- if (r->hash_key == h && rta_same(r, o))
- return rta_clone(r);
+ uint elen = ea_list_size(o);
+ r = mb_alloc(rta_pool, elen);
+ ea_list_copy(r, o, elen);
+ ea_list_ref(r);
- r = rta_copy(o);
+ r->flags |= EALF_CACHED;
r->hash_key = h;
- r->cached = 1;
+ r->uc = 1;
+
rta_insert(r);
if (++rta_cache_count > rta_cache_limit)
@@ -1356,46 +1320,17 @@ rta_lookup(rta *o)
}
void
-rta__free(rta *a)
+ea__free(ea_list *a)
{
- ASSERT(rta_cache_count && a->cached);
+ ASSERT(rta_cache_count && ea_is_cached(a));
rta_cache_count--;
- *a->pprev = a->next;
- if (a->next)
- a->next->pprev = a->pprev;
- ea_free(a->eattrs);
- a->cached = 0;
- sl_free(a);
-}
-
-rta *
-rta_do_cow(rta *o, linpool *lp)
-{
- rta *r = lp_alloc(lp, rta_size(o));
- memcpy(r, o, rta_size(o));
- r->cached = 0;
- r->uc = 0;
- return r;
-}
+ *a->pprev_hash = a->next_hash;
+ if (a->next_hash)
+ a->next_hash->pprev_hash = a->pprev_hash;
-/**
- * rta_dump - dump route attributes
- * @a: attribute structure to dump
- *
- * This function takes a &rta and dumps its contents to the debug output.
- */
-void
-rta_dump(rta *a)
-{
- debug("uc=%d h=%04x",
- a->uc, a->hash_key);
- if (!a->cached)
- debug(" !CACHED");
- if (a->eattrs)
- {
- debug(" EA: ");
- ea_dump(a->eattrs);
- }
+ ASSERT(!a->next);
+ ea_list_unref(a);
+ mb_free(a);
}
/**
@@ -1405,26 +1340,23 @@ rta_dump(rta *a)
* to the debug output.
*/
void
-rta_dump_all(void)
+ea_dump_all(void)
{
- rta *a;
- uint h;
-
debug("Route attribute cache (%d entries, rehash at %d):\n", rta_cache_count, rta_cache_limit);
- for(h=0; h<rta_cache_size; h++)
- for(a=rta_hash_table[h]; a; a=a->next)
+ for (uint h=0; h < rta_cache_size; h++)
+ for (ea_list *a = rta_hash_table[h]; a; a = a->next_hash)
{
debug("%p ", a);
- rta_dump(a);
+ ea_dump(a);
debug("\n");
}
debug("\n");
}
void
-rta_show(struct cli *c, rta *a)
+ea_show_list(struct cli *c, ea_list *eal)
{
- for(ea_list *eal = a->eattrs; eal; eal=eal->next)
+ for( ; eal; eal=eal->next)
for(int i=0; i<eal->count; i++)
ea_show(c, &eal->attrs[i]);
}
@@ -1440,8 +1372,6 @@ rta_init(void)
{
rta_pool = rp_new(&root_pool, "Attributes");
- rta_slab = sl_new(rta_pool, sizeof(rta));
-
rta_alloc_hash();
rte_src_init();
ea_class_init();
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index fa224f9a..7f45985f 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -79,18 +79,18 @@ 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);
rte e0 = {
- .attrs = rta_lookup(&a0),
+ .attrs = ea,
.src = src,
};
diff --git a/nest/rt-show.c b/nest/rt-show.c
index cc5a9a10..f3852d17 100644
--- a/nest/rt-show.c
+++ b/nest/rt-show.c
@@ -42,25 +42,25 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
{
byte from[IPA_MAX_TEXT_LENGTH+8];
byte tm[TM_DATETIME_BUFFER_SIZE], info[256];
- rta *a = e->attrs;
+ ea_list *a = e->attrs;
int sync_error = d->kernel ? krt_get_sync_error(d->kernel, e) : 0;
void (*get_route_info)(struct rte *, byte *buf);
eattr *nhea = net_type_match(e->net, NB_DEST) ?
- ea_find(a->eattrs, &ea_gen_nexthop) : NULL;
+ ea_find(a, &ea_gen_nexthop) : NULL;
struct nexthop_adata *nhad = nhea ? (struct nexthop_adata *) nhea->u.ptr : NULL;
int dest = nhad ? (NEXTHOP_IS_REACHABLE(nhad) ? RTD_UNICAST : nhad->dest) : RTD_NONE;
int flowspec_valid = net_is_flow(e->net) ? rt_get_flowspec_valid(e) : FLOWSPEC_UNKNOWN;
tm_format_time(tm, &config->tf_route, e->lastmod);
- ip_addr a_from = ea_get_ip(a->eattrs, &ea_gen_from, IPA_NONE);
+ ip_addr a_from = ea_get_ip(a, &ea_gen_from, IPA_NONE);
if (ipa_nonzero(a_from) && (!nhad || !ipa_equal(a_from, nhad->nh.gw)))
bsprintf(from, " from %I", a_from);
else
from[0] = 0;
/* Need to normalize the extended attributes */
- if (d->verbose && !rta_is_cached(a) && a->eattrs)
- a->eattrs = ea_normalize(a->eattrs);
+ if (d->verbose && !rta_is_cached(a) && a)
+ a = ea_normalize(a);
get_route_info = e->src->proto->proto->get_route_info;
if (get_route_info)
@@ -102,7 +102,7 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
}
if (d->verbose)
- rta_show(c, a);
+ ea_show_list(c, a);
}
static uint
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 946f4021..1631e00f 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -603,7 +603,7 @@ rte_store(const rte *r, net *net, rtable *tab)
rt_lock_source(e->rte.src);
- if (e->rte.attrs->cached)
+ if (ea_is_cached(e->rte.attrs))
e->rte.attrs = rta_clone(e->rte.attrs);
else
e->rte.attrs = rta_lookup(e->rte.attrs);
@@ -986,7 +986,7 @@ rt_export_merged(struct channel *c, struct rte **feed, uint count, linpool *pool
if (!tmp || !rte_is_reachable(tmp))
continue;
- eattr *nhea = ea_find(tmp->attrs->eattrs, &ea_gen_nexthop);
+ eattr *nhea = ea_find(tmp->attrs, &ea_gen_nexthop);
ASSERT_DIE(nhea);
if (nhs)
@@ -997,13 +997,12 @@ rt_export_merged(struct channel *c, struct rte **feed, uint count, linpool *pool
if (nhs)
{
- eattr *nhea = ea_find(best->attrs->eattrs, &ea_gen_nexthop);
+ eattr *nhea = ea_find(best->attrs, &ea_gen_nexthop);
ASSERT_DIE(nhea);
nhs = nexthop_merge(nhs, (struct nexthop_adata *) nhea->u.ptr, c->merge_limit, pool);
- best->attrs = rta_cow(best->attrs, pool);
- ea_set_attr(&best->attrs->eattrs,
+ ea_set_attr(&best->attrs,
EA_LITERAL_DIRECT_ADATA(&ea_gen_nexthop, 0, &nhs->ad));
}
@@ -1228,7 +1227,7 @@ rte_validate(struct channel *ch, rte *e)
if (net_type_match(n, NB_DEST))
{
- eattr *nhea = ea_find(e->attrs->eattrs, &ea_gen_nexthop);
+ eattr *nhea = ea_find(e->attrs, &ea_gen_nexthop);
int dest = nhea_dest(nhea);
if (dest == RTD_NONE)
@@ -1246,7 +1245,7 @@ rte_validate(struct channel *ch, rte *e)
return 0;
}
}
- else if (ea_find(e->attrs->eattrs, &ea_gen_nexthop))
+ else if (ea_find(e->attrs, &ea_gen_nexthop))
{
log(L_WARN "Ignoring route %N having a nexthop attribute received via %s",
n, ch->proto->name);
@@ -1884,7 +1883,7 @@ rte_dump(struct rte_storage *e)
{
debug("%-1N ", e->rte.net);
debug("PF=%02x ", e->rte.pflags);
- rta_dump(e->rte.attrs);
+ ea_dump(e->rte.attrs);
debug("\n");
}
@@ -2541,21 +2540,21 @@ ea_set_hostentry(ea_list **to, struct rtable *dep, struct rtable *tab, ip_addr g
static void
-rta_apply_hostentry(rta *a, struct hostentry_adata *head)
+rta_apply_hostentry(ea_list **to, struct hostentry_adata *head)
{
struct hostentry *he = head->he;
u32 *labels = head->labels;
u32 lnum = (u32 *) (head->ad.data + head->ad.length) - labels;
- ea_set_attr_u32(&a->eattrs, &ea_gen_igp_metric, 0, he->igp_metric);
+ ea_set_attr_u32(to, &ea_gen_igp_metric, 0, he->igp_metric);
if (!he->src)
{
- ea_set_dest(&a->eattrs, 0, RTD_UNREACHABLE);
+ ea_set_dest(to, 0, RTD_UNREACHABLE);
return;
}
- eattr *he_nh_ea = ea_find(he->src->eattrs, &ea_gen_nexthop);
+ eattr *he_nh_ea = ea_find(he->src, &ea_gen_nexthop);
ASSERT_DIE(he_nh_ea);
struct nexthop_adata *nhad = (struct nexthop_adata *) he_nh_ea->u.ptr;
@@ -2564,7 +2563,7 @@ rta_apply_hostentry(rta *a, struct hostentry_adata *head)
if ((idest != RTD_UNICAST) ||
!lnum && he->nexthop_linkable)
{ /* Just link the nexthop chain, no label append happens. */
- ea_copy_attr(&a->eattrs, he->src->eattrs, &ea_gen_nexthop);
+ ea_copy_attr(to, he->src, &ea_gen_nexthop);
return;
}
@@ -2591,7 +2590,7 @@ rta_apply_hostentry(rta *a, struct hostentry_adata *head)
.dest = RTD_UNREACHABLE,
};
- ea_set_attr_data(&a->eattrs, &ea_gen_nexthop, 0, &nha.ad.data, nha.ad.length);
+ ea_set_attr_data(to, &ea_gen_nexthop, 0, &nha.ad.data, nha.ad.length);
return;
}
@@ -2625,22 +2624,22 @@ rta_apply_hostentry(rta *a, struct hostentry_adata *head)
/* Fix final length */
new->ad.length = (void *) dest - (void *) new->ad.data;
- ea_set_attr(&a->eattrs, EA_LITERAL_DIRECT_ADATA(
+ ea_set_attr(to, EA_LITERAL_DIRECT_ADATA(
&ea_gen_nexthop, 0, &new->ad));
}
static inline struct hostentry_adata *
-rta_next_hop_outdated(rta *a)
+rta_next_hop_outdated(ea_list *a)
{
/* First retrieve the hostentry */
- eattr *heea = ea_find(a->eattrs, &ea_gen_hostentry);
+ eattr *heea = ea_find(a, &ea_gen_hostentry);
if (!heea)
return NULL;
struct hostentry_adata *head = (struct hostentry_adata *) heea->u.ptr;
/* If no nexthop is present, we have to create one */
- eattr *a_nh_ea = ea_find(a->eattrs, &ea_gen_nexthop);
+ eattr *a_nh_ea = ea_find(a, &ea_gen_nexthop);
if (!a_nh_ea)
return head;
@@ -2651,10 +2650,10 @@ rta_next_hop_outdated(rta *a)
return NEXTHOP_IS_REACHABLE(nhad) ? head : NULL;
/* Comparing our nexthop with the hostentry nexthop */
- eattr *he_nh_ea = ea_find(head->he->src->eattrs, &ea_gen_nexthop);
+ eattr *he_nh_ea = ea_find(head->he->src, &ea_gen_nexthop);
return (
- (ea_get_int(a->eattrs, &ea_gen_igp_metric, IGP_METRIC_UNKNOWN) != head->he->igp_metric) ||
+ (ea_get_int(a, &ea_gen_igp_metric, IGP_METRIC_UNKNOWN) != head->he->igp_metric) ||
(!head->he->nexthop_linkable) ||
(!he_nh_ea != !a_nh_ea) ||
(he_nh_ea && a_nh_ea && !adata_same(he_nh_ea->u.ptr, a_nh_ea->u.ptr)))
@@ -2668,12 +2667,8 @@ rt_next_hop_update_rte(rtable *tab, net *n, rte *old)
if (!head)
return NULL;
- rta a = *old->attrs;
- a.cached = 0;
- rta_apply_hostentry(&a, head);
-
rte e0 = *old;
- e0.attrs = &a;
+ rta_apply_hostentry(&e0.attrs, head);
return rte_store(&e0, n, tab);
}
@@ -2681,21 +2676,13 @@ rt_next_hop_update_rte(rtable *tab, net *n, rte *old)
static inline void
rt_next_hop_resolve_rte(rte *r)
{
- eattr *heea = ea_find(r->attrs->eattrs, &ea_gen_hostentry);
+ eattr *heea = ea_find(r->attrs, &ea_gen_hostentry);
if (!heea)
return;
struct hostentry_adata *head = (struct hostentry_adata *) heea->u.ptr;
- if (r->attrs->cached)
- {
- rta *a = tmp_alloc(RTA_MAX_SIZE);
- *a = *r->attrs;
- a->cached = 0;
- r->attrs = a;
- }
-
- rta_apply_hostentry(r->attrs, head);
+ rta_apply_hostentry(&r->attrs, head);
}
#ifdef CONFIG_BGP
@@ -2721,23 +2708,23 @@ net_flow_has_dst_prefix(const net_addr *n)
}
static inline int
-rta_as_path_is_empty(rta *a)
+rta_as_path_is_empty(ea_list *a)
{
- eattr *e = ea_find(a->eattrs, "bgp_path");
+ eattr *e = ea_find(a, "bgp_path");
return !e || (as_path_getlen(e->u.ptr) == 0);
}
static inline u32
-rta_get_first_asn(rta *a)
+rta_get_first_asn(ea_list *a)
{
- eattr *e = ea_find(a->eattrs, "bgp_path");
+ eattr *e = ea_find(a, "bgp_path");
u32 asn;
return (e && as_path_get_first_regular(e->u.ptr, &asn)) ? asn : 0;
}
static inline enum flowspec_valid
-rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, rta *a, int interior)
+rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, ea_list *a, int interior)
{
ASSERT(rt_is_ip(tab_ip));
ASSERT(rt_is_flow(tab_flow));
@@ -2774,13 +2761,13 @@ rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, rta *a, i
return FLOWSPEC_INVALID;
/* Find ORIGINATOR_ID values */
- u32 orig_a = ea_get_int(a->eattrs, "bgp_originator_id", 0);
- u32 orig_b = ea_get_int(rb->attrs->eattrs, "bgp_originator_id", 0);
+ u32 orig_a = ea_get_int(a, "bgp_originator_id", 0);
+ u32 orig_b = ea_get_int(rb->attrs, "bgp_originator_id", 0);
/* Originator is either ORIGINATOR_ID (if present), or BGP neighbor address (if not) */
if ((orig_a != orig_b) || (!orig_a && !orig_b && !ipa_equal(
- ea_get_ip(a->eattrs, &ea_gen_from, IPA_NONE),
- ea_get_ip(rb->attrs->eattrs, &ea_gen_from, IPA_NONE)
+ ea_get_ip(a, &ea_gen_from, IPA_NONE),
+ ea_get_ip(rb->attrs, &ea_gen_from, IPA_NONE)
)))
return FLOWSPEC_INVALID;
@@ -2834,15 +2821,8 @@ rt_flowspec_update_rte(rtable *tab, net *n, rte *r)
if (old == valid)
return NULL;
- rta *a = alloca(RTA_MAX_SIZE);
- *a = *r->attrs;
- a->cached = 0;
-
- ea_set_attr_u32(&a->eattrs, &ea_gen_flowspec_valid, 0, valid);
-
- rte new;
- memcpy(&new, r, sizeof(rte));
- new.attrs = a;
+ rte new = *r;
+ ea_set_attr_u32(&new.attrs, &ea_gen_flowspec_valid, 0, valid);
return rte_store(&new, n, tab);
#else
@@ -2873,18 +2853,10 @@ rt_flowspec_resolve_rte(rte *r, struct channel *c)
if (valid == old)
return;
- if (r->attrs->cached)
- {
- rta *a = tmp_alloc(RTA_MAX_SIZE);
- *a = *r->attrs;
- a->cached = 0;
- r->attrs = a;
- }
-
if (valid == FLOWSPEC_UNKNOWN)
- ea_unset_attr(&r->attrs->eattrs, 0, &ea_gen_flowspec_valid);
+ ea_unset_attr(&r->attrs, 0, &ea_gen_flowspec_valid);
else
- ea_set_attr_u32(&r->attrs->eattrs, &ea_gen_flowspec_valid, 0, valid);
+ ea_set_attr_u32(&r->attrs, &ea_gen_flowspec_valid, 0, valid);
#endif
}
@@ -3652,7 +3624,7 @@ if_local_addr(ip_addr a, struct iface *i)
u32
rt_get_igp_metric(const rte *rt)
{
- eattr *ea = ea_find(rt->attrs->eattrs, "igp_metric");
+ eattr *ea = ea_find(rt->attrs, "igp_metric");
if (ea)
return ea->u.data;
@@ -3669,7 +3641,7 @@ rt_get_igp_metric(const rte *rt)
static int
rt_update_hostentry(rtable *tab, struct hostentry *he)
{
- rta *old_src = he->src;
+ ea_list *old_src = he->src;
int direct = 0;
int pxlen = 0;
@@ -3684,10 +3656,10 @@ rt_update_hostentry(rtable *tab, struct hostentry *he)
if (n)
{
struct rte_storage *e = n->routes;
- rta *a = e->rte.attrs;
+ ea_list *a = e->rte.attrs;
pxlen = n->n.addr->pxlen;
- if (ea_find(a->eattrs, &ea_gen_hostentry))
+ if (ea_find(a, &ea_gen_hostentry))
{
/* Recursive route should not depend on another recursive route */
log(L_WARN "Next hop address %I resolvable through recursive route for %N",
@@ -3695,7 +3667,7 @@ rt_update_hostentry(rtable *tab, struct hostentry *he)
goto done;
}
- eattr *nhea = ea_find(a->eattrs, &ea_gen_nexthop);
+ eattr *nhea = ea_find(a, &ea_gen_nexthop);
ASSERT_DIE(nhea);
struct nexthop_adata *nhad = (void *) nhea->u.ptr;
diff --git a/nest/rt.h b/nest/rt.h
index eb868aa7..32bba6a6 100644
--- a/nest/rt.h
+++ b/nest/rt.h
@@ -147,7 +147,7 @@ struct hostentry {
struct hostentry *next; /* Next in hash chain */
unsigned hash_key; /* Hash key */
unsigned uc; /* Use count */
- struct rta *src; /* Source rta entry */
+ ea_list *src; /* Source attributes */
byte nexthop_linkable; /* Nexthop list is completely non-device */
u32 igp_metric; /* Chosen route IGP metric */
};
@@ -448,16 +448,6 @@ struct hostentry_adata {
void
ea_set_hostentry(ea_list **to, struct rtable *dep, struct rtable *tab, ip_addr gw, ip_addr ll, u32 lnum, u32 labels[lnum]);
-/*
-struct hostentry * rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep);
-void rta_apply_hostentry(rta *a, struct hostentry *he, u32 lnum, u32 labels[lnum]);
-
-static inline void
-rta_set_recursive_next_hop(rtable *dep, rta *a, rtable *tab, ip_addr gw, ip_addr ll, u32 lnum, u32 labels[lnum])
-{
- rta_apply_hostentry(a, rt_get_hostentry(tab, gw, ll, dep), lnum, labels);
-}
-*/
/*
* Default protocol preferences