summaryrefslogtreecommitdiff
path: root/proto/babel/babel.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto/babel/babel.c')
-rw-r--r--proto/babel/babel.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index f3456369..65d2567e 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, };
rte e0 = {
.attrs = &a0,
@@ -693,12 +690,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);
rte e0 = {
.attrs = &a0,
@@ -2266,9 +2262,13 @@ babel_kick_timer(struct babel_proto *p)
static int
babel_preexport(struct channel *c, struct rte *new)
{
- 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->eattrs, &ea_gen_nexthop);
+ struct nexthop_adata *nhad = (void *) ea->u.ptr;
+ if (!NEXTHOP_IS_REACHABLE(nhad))
return -1;
return 0;