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.c12
-rw-r--r--nest/rt-show.c12
-rw-r--r--nest/rt-table.c88
-rw-r--r--nest/rt.h19
6 files changed, 103 insertions, 190 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 6a35cdd2..773673e8 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -849,7 +849,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 routing table]])
{ rt_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP PROTOCOLS,,, [[Dump protocol information]])
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index b5be936b..6927751f 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -174,7 +174,6 @@ struct ea_class ea_gen_flowspec_valid = {
pool *rta_pool;
-static slab *rta_slab;
static slab *rte_src_slab;
static struct idm src_ids;
@@ -943,17 +942,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)
{
@@ -1050,7 +1038,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;
@@ -1141,10 +1129,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];
@@ -1236,12 +1225,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
@@ -1249,44 +1238,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;
}
@@ -1295,8 +1254,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);
@@ -1304,7 +1263,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);
@@ -1323,24 +1282,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)
@@ -1350,46 +1314,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);
}
/**
@@ -1399,26 +1334,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]);
}
@@ -1434,8 +1366,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 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);
}
diff --git a/nest/rt-show.c b/nest/rt-show.c
index 0ad8f5c6..2cbc500a 100644
--- a/nest/rt-show.c
+++ b/nest/rt-show.c
@@ -42,23 +42,23 @@ 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 = ea_find(a->eattrs, &ea_gen_nexthop);
+ eattr *nhea = ea_find(a, &ea_gen_nexthop);
struct nexthop_adata *nhad = nhea ? (struct nexthop_adata *) nhea->u.ptr : NULL;
int dest = NEXTHOP_IS_REACHABLE(nhad) ? RTD_UNICAST : nhad->dest;
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)
@@ -99,7 +99,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 void
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 539e04d0..e3dab120 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -564,7 +564,7 @@ rte_find(net *net, struct rte_src *src)
* the protocol.
*/
rte *
-rte_get_temp(rta *a, struct rte_src *src)
+rte_get_temp(ea_list *a, struct rte_src *src)
{
rte *e = sl_alloc(rte_slab);
@@ -608,15 +608,15 @@ rte_do_cow(rte *r)
* Result: a pointer to the new writable &rte with writable &rta.
*/
rte *
-rte_cow_rta(rte *r, linpool *lp)
+rte_cow_rta(rte *r)
{
if (!rta_is_cached(r->attrs))
return r;
r = rte_cow(r);
- rta *a = rta_do_cow(r->attrs, lp);
+
+ /* This looks stupid but should DWIW. */
rta_free(r->attrs);
- r->attrs = a;
return r;
}
@@ -971,7 +971,7 @@ rt_export_merged(struct channel *c, net *net, rte **rt_free, linpool *pool, int
if (rte_is_reachable(rt))
{
- eattr *nhea = ea_find(rt->attrs->eattrs, &ea_gen_nexthop);
+ eattr *nhea = ea_find(rt->attrs, &ea_gen_nexthop);
ASSERT_DIE(nhea);
if (nhs)
@@ -987,13 +987,13 @@ rt_export_merged(struct channel *c, net *net, rte **rt_free, linpool *pool, int
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 = rte_cow_rta(best, pool);
- ea_set_attr(&best->attrs->eattrs,
+ best = rte_cow_rta(best);
+ ea_set_attr(&best->attrs,
EA_LITERAL_DIRECT_ADATA(&ea_gen_nexthop, 0, &nhs->ad));
}
@@ -1177,7 +1177,7 @@ rte_validate(rte *e)
return 0;
}
- 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 (net_type_match(n->n.addr, NB_DEST) == !dest)
@@ -1808,7 +1808,7 @@ rte_dump(rte *e)
net *n = e->net;
debug("%-1N ", n->n.addr);
debug("PF=%02x ", e->pflags);
- rta_dump(e->attrs);
+ ea_dump(e->attrs);
debug("\n");
}
@@ -2416,21 +2416,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;
@@ -2439,7 +2439,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;
}
@@ -2466,7 +2466,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;
}
@@ -2500,22 +2500,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;
@@ -2526,10 +2526,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)))
@@ -2543,13 +2543,12 @@ rt_next_hop_update_rte(rtable *tab UNUSED, rte *old)
if (!head)
return NULL;
- rta a = *old->attrs;
- a.cached = 0;
- rta_apply_hostentry(&a, head);
+ ea_list *ea = old->attrs;
+ rta_apply_hostentry(&ea, head);
rte *e = sl_alloc(rte_slab);
memcpy(e, old, sizeof(rte));
- e->attrs = rta_lookup(&a);
+ e->attrs = rta_lookup(ea);
rt_lock_source(e->src);
return e;
@@ -2579,23 +2578,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;
}
int
-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));
@@ -2632,13 +2631,13 @@ rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, rta *a, i
return 0;
/* 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 0;
@@ -2691,15 +2690,12 @@ rt_flowspec_update_rte(rtable *tab, rte *r)
if (old == valid)
return NULL;
- rta *a = alloca(RTA_MAX_SIZE);
- memcpy(a, r->attrs, rta_size(r->attrs));
- a->cached = 0;
-
- ea_set_attr_u32(&a->eattrs, &ea_gen_flowspec_valid, 0, valid);
+ ea_list *a = r->attrs;
+ ea_set_attr_u32(&a, &ea_gen_flowspec_valid, 0, valid);
rte *new = sl_alloc(rte_slab);
memcpy(new, r, sizeof(rte));
- new->attrs = rta_lookup(a);
+ new->attrs = ea_lookup(a);
return new;
#else
@@ -3506,7 +3502,7 @@ if_local_addr(ip_addr a, struct iface *i)
u32
rt_get_igp_metric(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;
@@ -3523,7 +3519,7 @@ rt_get_igp_metric(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;
@@ -3538,10 +3534,10 @@ rt_update_hostentry(rtable *tab, struct hostentry *he)
if (n)
{
rte *e = n->routes;
- rta *a = e->attrs;
+ ea_list *a = e->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",
@@ -3549,7 +3545,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 6f15fec6..f7cc164d 100644
--- a/nest/rt.h
+++ b/nest/rt.h
@@ -143,7 +143,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 */
};
@@ -185,7 +185,7 @@ static inline net *net_get(rtable *tab, const net_addr *addr) { return (net *) f
net *net_get(rtable *tab, const net_addr *addr);
net *net_route(rtable *tab, const net_addr *n);
rte *rte_find(net *net, struct rte_src *src);
-rte *rte_get_temp(struct rta *, struct rte_src *src);
+rte *rte_get_temp(ea_list *, struct rte_src *src);
void rte_update2(struct channel *c, const net_addr *n, rte *new, struct rte_src *src);
/* rte_update() moved to protocol.h to avoid dependency conflicts */
int rt_examine(rtable *t, net_addr *a, struct proto *p, const struct filter *filter);
@@ -198,7 +198,7 @@ void rte_dump(rte *);
void rte_free(rte *);
rte *rte_do_cow(rte *);
static inline rte * rte_cow(rte *r) { return (r->flags & REF_COW) ? rte_do_cow(r) : r; }
-rte *rte_cow_rta(rte *r, linpool *lp);
+rte *rte_cow_rta(rte *r);
void rt_dump(rtable *);
void rt_dump_all(void);
int rt_feed_channel(struct channel *c);
@@ -290,18 +290,7 @@ 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);
-}
-*/
-
-int rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, rta *a, int interior);
+int rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, ea_list *a, int interior);
/*