diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-04-05 16:16:04 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-04-18 13:56:40 +0200 |
commit | 4278abfe272de64556c4d6df19efc0c853527851 (patch) | |
tree | c5797a702855412fc88c04c9f1a14f73c9c71555 /nest | |
parent | 3484cb9a654cab9bd2c2b1164528d3000a22a79e (diff) |
Check validity of dest w.r.t. net_type
Allow to define static roa/flow routes without dest.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/rt-table.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index 41f0f649..be764313 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -900,7 +900,6 @@ rte_validate(rte *e) int c; net *n = e->net; - // (n->n.pxlen > BITS_PER_IP_ADDRESS) || !ip_is_prefix(n->n.prefix,n->n.pxlen)) if (!net_validate(n->n.addr)) { log(L_WARN "Ignoring bogus prefix %N received via %s", @@ -916,12 +915,19 @@ rte_validate(rte *e) return 0; } + if (net_type_match(n->n.addr, NB_DEST) == !e->attrs->dest) + { + log(L_WARN "Ignoring route %N with invalid dest %d received via %s", + n->n.addr, e->attrs->dest, e->sender->proto->name); + return 0; + } + if ((e->attrs->dest == RTD_UNICAST) && !nexthop_is_sorted(&(e->attrs->nh))) - { - log(L_WARN "Ignoring unsorted multipath route %N received via %s", - n->n.addr, e->sender->proto->name); - return 0; - } + { + log(L_WARN "Ignoring unsorted multipath route %N received via %s", + n->n.addr, e->sender->proto->name); + return 0; + } return 1; } |