summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y10
-rw-r--r--nest/rt-attr.c17
-rw-r--r--nest/rt-dev.c1
-rw-r--r--nest/rt-show.c5
-rw-r--r--nest/rt-table.c5
5 files changed, 21 insertions, 17 deletions
diff --git a/nest/config.Y b/nest/config.Y
index e476e1bf..068a1d30 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -118,11 +118,11 @@ CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, SADR, MPLS)
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED, RPKI)
CF_KEYWORDS(PASSWORD, KEY, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, CHANNELS, INTERFACES)
CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512, BLAKE2S128, BLAKE2S256, BLAKE2B256, BLAKE2B512)
-CF_KEYWORDS(PRIMARY, STATS, COUNT, BY, FOR, IN, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE)
+CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, IN, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE)
CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION)
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, CLASS, DSCP)
CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, ROUTE, PROTOCOL, BASE, LOG, S, MS, US)
-CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
+CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, AS)
CF_KEYWORDS(MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE)
CF_KEYWORDS(CHECK, LINK)
CF_KEYWORDS(SORTED, TRIE, MIN, MAX, SETTLE, TIME)
@@ -660,7 +660,7 @@ r_args:
$$->addr = $3;
$$->addr_mode = RSD_ADDR_IN;
}
-| r_args TABLE CF_SYM_KNOWN {
+| r_args TABLE symbol_known {
cf_assert_symbol($3, SYM_TABLE);
$$ = $1;
rt_show_add_table($$, $3->table->table);
@@ -705,7 +705,7 @@ r_args:
$$ = $1;
$$->filtered = 1;
}
- | r_args export_mode CF_SYM_KNOWN {
+ | r_args export_mode symbol_known {
cf_assert_symbol($3, SYM_PROTO);
struct proto_config *c = (struct proto_config *) $3->proto;
$$ = $1;
@@ -722,7 +722,7 @@ r_args:
$$->export_channel = $3;
$$->tables_defined_by = RSD_TDB_INDIRECT;
}
- | r_args PROTOCOL CF_SYM_KNOWN {
+ | r_args PROTOCOL symbol_known {
cf_assert_symbol($3, SYM_PROTO);
struct proto_config *c = (struct proto_config *) $3->proto;
$$ = $1;
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index e5d87b53..a892bfd5 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,9 +1234,7 @@ 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);
#undef MIX
@@ -1242,9 +1245,7 @@ static inline int
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));
@@ -1393,12 +1394,11 @@ rta_dump(rta *a)
"RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" };
static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
- debug("uc=%d %s %s%s h=%04x",
- a->uc, rts[a->source], ip_scope_text(a->scope),
+ debug("uc=%d %s %s h=%04x",
+ a->uc, rts[a->source],
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)
{
@@ -1441,7 +1441,7 @@ rta_dump_all(void)
void
rta_show(struct cli *c, rta *a)
{
- cli_printf(c, -1008, "\tType: %s %s", rta_src_names[a->source], ip_scope_text(a->scope));
+ cli_printf(c, -1008, "\tType: %s", rta_src_names[a->source]);
for(ea_list *eal = a->eattrs; eal; eal=eal->next)
for(int i=0; i<eal->count; i++)
@@ -1475,6 +1475,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-dev.c b/nest/rt-dev.c
index 2d0c594f..5d4233dc 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -81,7 +81,6 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
rta a0 = {
.source = RTS_DEVICE,
- .scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
.nh.iface = ad->iface,
};
diff --git a/nest/rt-show.c b/nest/rt-show.c
index 6c5f32b1..6e3dce8a 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 e0c475b7..3d42c9de 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -2713,7 +2713,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;