diff options
author | Maria Matejka <mq@ucw.cz> | 2022-05-15 18:09:30 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-30 14:39:09 +0200 |
commit | 950775f6fa3d569a9d7cd05e33538d35e895d688 (patch) | |
tree | 81b4b23d5695e209301b252d0d282b05a0d67ac1 /proto/babel/babel.c | |
parent | 4fe9881d625f10e44109a649e369a413bd98de71 (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 'proto/babel/babel.c')
-rw-r--r-- | proto/babel/babel.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 9a43f484..b90dcd3f 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -677,10 +677,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) } }; - rta a0 = { - .dest = RTD_UNICAST, - .eattrs = &eattrs.l, - }; + rta a0 = { .eattrs = &eattrs.l, }; rta *a = rta_lookup(&a0); rte *rte = rte_get_temp(a, p->p.main_source); @@ -691,12 +688,11 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) else if (e->valid && (e->router_id != p->router_id)) { /* Unreachable */ - rta a0 = { - .dest = RTD_UNREACHABLE, - }; + rta a0 = {}; ea_set_attr_u32(&a0.eattrs, &ea_gen_preference, 0, 1); ea_set_attr_u32(&a0.eattrs, &ea_gen_source, 0, RTS_BABEL); + ea_set_dest(&a0.eattrs, 0, RTD_UNREACHABLE); rta *a = rta_lookup(&a0); rte *rte = rte_get_temp(a, p->p.main_source); @@ -2263,9 +2259,13 @@ babel_kick_timer(struct babel_proto *p) static int babel_preexport(struct proto *P, struct rte *new) { - struct rta *a = new->attrs; + if (new->src->proto != P) + return 0; + /* Reject our own unreachable routes */ - if ((a->dest == RTD_UNREACHABLE) && (new->src->proto == P)) + eattr *ea = ea_find(new->attrs->eattrs, &ea_gen_nexthop); + struct nexthop_adata *nhad = (void *) ea->u.ptr; + if (!NEXTHOP_IS_REACHABLE(nhad)) return -1; return 0; |