static int
- babel_preexport(struct channel *c, struct rte *new)
+ babel_preexport(struct channel *C, struct rte *new)
{
- if (new->src->proto != c->proto)
- struct rta *a = new->attrs;
++ if (new->src->proto != C->proto)
+ return 0;
+
/* Reject our own unreachable routes */
- if ((a->dest == RTD_UNREACHABLE) && (new->src->proto == C->proto))
+ eattr *ea = ea_find(new->attrs, &ea_gen_nexthop);
+ struct nexthop_adata *nhad = (void *) ea->u.ptr;
+ if (!NEXTHOP_IS_REACHABLE(nhad))
return -1;
return 0;
}
static int
- pipe_preexport(struct channel *c, rte *e)
+ pipe_preexport(struct channel *C, rte *e)
{
- struct pipe_proto *p = (void *) c->proto;
- struct proto *pp = e->sender->proto;
++ struct pipe_proto *p = (void *) C->proto;
- if (pp == C->proto)
- return -1; /* Avoid local loops automatically */
+ /* Avoid direct loopbacks */
- if (e->sender == c->in_req.hook)
++ if (e->sender == C->in_req.hook)
+ return -1;
+
+ /* Indirection check */
+ uint max_generation = ((struct pipe_config *) p->p.cf)->max_generation;
+ if (e->generation >= max_generation)
+ {
+ log_rl(&p->rl_gen, L_ERR "Route overpiped (%u hops of %u configured in %s) in table %s: %N %s/%u:%u",
- e->generation, max_generation, c->proto->name,
- c->table->name, e->net, e->src->proto->name, e->src->private_id, e->src->global_id);
++ e->generation, max_generation, C->proto->name,
++ C->table->name, e->net, e->src->proto->name, e->src->private_id, e->src->global_id);
+
+ return -1;
+ }
return 0;
}
*/
static int
- krt_preexport(struct channel *c, rte *e)
+ krt_preexport(struct channel *C, rte *e)
{
- if (e->src->proto == c->proto)
- // struct krt_proto *p = (struct krt_proto *) P;
+ if (e->src->proto == C->proto)
return -1;
if (!krt_capable(e))