summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-05-26 23:43:13 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-05-26 23:43:13 +0200
commit4e8f8afc68cc7ba09ca42d989e47dbfcb17d2772 (patch)
treef05791f55d816e0b18219ff2ee98446db7dc11b1
parentc1632ad0f39f7221d649a9e469cacc38105528e2 (diff)
Babel: Set onlink flag for IPv4 routes with unreachable next hop
If the next hop of a route is not a reachable address, the route should be installed as onlink. This enables a configuration common in mesh networks where the mesh interface is assigned a /32 and babel handles the routing by installing onlink routes. Thanks to Toke Hoiland-Jorgensen for the patch.
-rw-r--r--proto/babel/babel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index ebd5f7cc..ba98598b 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -640,6 +640,14 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
.nh.iface = r->neigh->ifa->iface,
};
+ /*
+ * If we cannot find a reachable neighbour, set the entry to be onlink. This
+ * makes it possible to, e.g., assign /32 addresses on a mesh interface and
+ * have routing work.
+ */
+ if (!neigh_find(&p->p, r->next_hop, r->neigh->ifa->iface, 0))
+ a0.nh.flags = RNF_ONLINK;
+
rta *a = rta_lookup(&a0);
rte *rte = rte_get_temp(a);
rte->u.babel.seqno = r->seqno;