diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-13 15:22:29 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-13 15:22:29 +0200 |
commit | caa9d03d65ce827ce536d54b26988e70767e032f (patch) | |
tree | 1af9aa24a6087273ad965cb4e29011e5fdcf788e /proto/babel | |
parent | 9c9050ff12c52762708dadda78a05108a5b533b2 (diff) |
Babel: Fix handling of missing IPv4 next hops
In case of missing IPv4 next hop, we should skip such routes
on transmit and ignore such routes on receive.
Thanks to Julian Schuh for the bugreport and Toke Hoiland-Jorgensen
for the original patch.
Diffstat (limited to 'proto/babel')
-rw-r--r-- | proto/babel/babel.c | 8 | ||||
-rw-r--r-- | proto/babel/packets.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 44c6adb8..20953044 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -952,6 +952,10 @@ babel_send_update_(struct babel_iface *ifa, btime changed, struct fib *rtable) msg.update.next_hop = ((e->n.addr->type == NET_IP4) ? ifa->next_hop_ip4 : ifa->next_hop_ip6); + /* Do not send route if next hop is unknown, e.g. no configured IPv4 address */ + if (ipa_zero(msg.update.next_hop)) + continue; + babel_enqueue(&msg, ifa); /* Update feasibility distance for redistributed routes */ @@ -1580,7 +1584,7 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con ifa->next_hop_ip6 = ipa_nonzero(ic->next_hop_ip6) ? ic->next_hop_ip6 : ifa->addr; if (ipa_zero(ifa->next_hop_ip4) && p->ip4_channel) - log(L_WARN "%s: Cannot find IPv4 next hop addr on %s", p->p.name, new->name); + log(L_WARN "%s: Missing IPv4 next hop address for %s", p->p.name, new->name); init_list(&ifa->neigh_list); ifa->hello_seqno = 1; @@ -1682,7 +1686,7 @@ babel_reconfigure_iface(struct babel_proto *p, struct babel_iface *ifa, struct b ifa->next_hop_ip6 = ipa_nonzero(new->next_hop_ip6) ? new->next_hop_ip6 : ifa->addr; if (ipa_zero(ifa->next_hop_ip4) && p->ip4_channel) - log(L_WARN "%s: Cannot find IPv4 next hop addr on %s", p->p.name, ifa->ifname); + log(L_WARN "%s: Missing IPv4 next hop address for %s", p->p.name, ifa->ifname); if (ifa->next_hello > (current_time() + new->hello_interval)) ifa->next_hello = current_time() + (random() % new->hello_interval); diff --git a/proto/babel/packets.c b/proto/babel/packets.c index 59678678..d4ecf649 100644 --- a/proto/babel/packets.c +++ b/proto/babel/packets.c @@ -616,7 +616,7 @@ babel_read_update(struct babel_tlv *hdr, union babel_msg *m, /* Update must have next hop, unless it is retraction */ if (ipa_zero(state->next_hop_ip4) && (msg->metric != BABEL_INFINITY)) - return PARSE_ERROR; + return PARSE_IGNORE; /* Merge saved prefix and received prefix parts */ memcpy(buf, state->def_ip4_prefix, tlv->omitted); |