summaryrefslogtreecommitdiff
path: root/nest/rt-attr.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-05-15 18:09:30 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-30 14:39:09 +0200
commit950775f6fa3d569a9d7cd05e33538d35e895d688 (patch)
tree81b4b23d5695e209301b252d0d282b05a0d67ac1 /nest/rt-attr.c
parent4fe9881d625f10e44109a649e369a413bd98de71 (diff)
Route destination field merged with nexthop attribute; splitting flowspec validation result out.
As there is either a nexthop or another destination specification (or othing in case of ROAs and Flowspec), it may be merged together. This code is somehow quirky and should be replaced in future by better implementation of nexthop. Also flowspec validation result has its own attribute now as it doesn't have anything to do with route nexthop.
Diffstat (limited to 'nest/rt-attr.c')
-rw-r--r--nest/rt-attr.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index cf3ab659..b5be936b 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -166,6 +166,12 @@ const char * rta_dest_names[RTD_MAX] = {
[RTD_PROHIBIT] = "prohibited",
};
+struct ea_class ea_gen_flowspec_valid = {
+ .name = "flowspec_valid",
+ .type = T_ENUM_FLOWSPEC_VALID,
+ .readonly = 1,
+};
+
pool *rta_pool;
static slab *rta_slab;
@@ -1246,20 +1252,13 @@ rta_alloc_hash(void)
static inline uint
rta_hash(rta *a)
{
- u64 h;
- mem_hash_init(&h);
-#define BMIX(f) mem_hash_mix_num(&h, a->f);
- BMIX(dest);
-#undef MIX
-
- return mem_hash_value(&h) ^ ea_hash(a->eattrs);
+ return ea_hash(a->eattrs);
}
static inline int
rta_same(rta *x, rta *y)
{
- return (x->dest == y->dest &&
- ea_same(x->eattrs, y->eattrs));
+ return ea_same(x->eattrs, y->eattrs);
}
static rta *
@@ -1382,10 +1381,8 @@ rta_do_cow(rta *o, linpool *lp)
void
rta_dump(rta *a)
{
- static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
-
- debug("uc=%d %s h=%04x",
- a->uc, rtd[a->dest], a->hash_key);
+ debug("uc=%d h=%04x",
+ a->uc, a->hash_key);
if (!a->cached)
debug(" !CACHED");
if (a->eattrs)
@@ -1449,6 +1446,7 @@ rta_init(void)
ea_register_init(&ea_gen_source);
ea_register_init(&ea_gen_nexthop);
ea_register_init(&ea_gen_hostentry);
+ ea_register_init(&ea_gen_flowspec_valid);
}
/*