summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-04-20 13:56:04 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-04 15:39:21 +0200
commit8ebac84bc8d51e2404ce6d6dc5e35fb261830596 (patch)
treeddf072a6ba02df9647f02e9203a8e4b3f214e108 /nest
parent337c04c45e1472d6d9b531a3c55f1f2d30ebf308 (diff)
Moved advertising router info (FROM attribute) to eattrs
Diffstat (limited to 'nest')
-rw-r--r--nest/rt-attr.c9
-rw-r--r--nest/rt-show.c5
-rw-r--r--nest/rt-table.c5
3 files changed, 13 insertions, 6 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index e5d87b53..87f54b0d 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -70,6 +70,11 @@ struct ea_class ea_gen_preference = {
.type = T_INT,
};
+struct ea_class ea_gen_from = {
+ .name = "from",
+ .type = T_IP,
+};
+
const char * const rta_src_names[RTS_MAX] = {
[RTS_STATIC] = "static",
[RTS_INHERIT] = "inherit",
@@ -1229,7 +1234,6 @@ rta_hash(rta *a)
#define MIX(f) mem_hash_mix(&h, &(a->f), sizeof(a->f));
#define BMIX(f) mem_hash_mix_num(&h, a->f);
MIX(hostentry);
- MIX(from);
BMIX(source);
BMIX(scope);
BMIX(dest);
@@ -1244,7 +1248,6 @@ rta_same(rta *x, rta *y)
return (x->source == y->source &&
x->scope == y->scope &&
x->dest == y->dest &&
- ipa_equal(x->from, y->from) &&
x->hostentry == y->hostentry &&
nexthop_same(&(x->nh), &(y->nh)) &&
ea_same(x->eattrs, y->eattrs));
@@ -1398,7 +1401,6 @@ rta_dump(rta *a)
rtd[a->dest], a->hash_key);
if (!a->cached)
debug(" !CACHED");
- debug(" <-%I", a->from);
if (a->dest == RTD_UNICAST)
for (struct nexthop *nh = &(a->nh); nh; nh = nh->next)
{
@@ -1475,6 +1477,7 @@ rta_init(void)
ea_register_init(&ea_gen_preference);
ea_register_init(&ea_gen_igp_metric);
+ ea_register_init(&ea_gen_from);
}
/*
diff --git a/nest/rt-show.c b/nest/rt-show.c
index 1c764d8c..be4c0186 100644
--- a/nest/rt-show.c
+++ b/nest/rt-show.c
@@ -48,8 +48,9 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
struct nexthop *nh;
tm_format_time(tm, &config->tf_route, e->lastmod);
- if (ipa_nonzero(a->from) && !ipa_equal(a->from, a->nh.gw))
- bsprintf(from, " from %I", a->from);
+ ip_addr a_from = ea_get_ip(a->eattrs, &ea_gen_from, IPA_NONE);
+ if (ipa_nonzero(a_from) && !ipa_equal(a_from, a->nh.gw))
+ bsprintf(from, " from %I", a_from);
else
from[0] = 0;
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 919576bd..e8b04e0b 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -2596,7 +2596,10 @@ rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, rta *a, i
u32 orig_b = ea_get_int(rb->attrs->eattrs, "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(a->from, rb->attrs->from)))
+ 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)
+ )))
return 0;