diff options
Diffstat (limited to 'babeld/message.c')
| -rw-r--r-- | babeld/message.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/babeld/message.c b/babeld/message.c index 9a199acb66..e4d3bf7d49 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -52,7 +52,7 @@ static const unsigned char tlv_min_length[MESSAGE_MAX + 1] = static bool known_ae(int ae) { - return ae <= 4; + return ae <= 3; } /* Parse a network prefix, encoded in the somewhat baroque compressed @@ -758,6 +758,10 @@ parse_packet(const unsigned char *from, struct interface *ifp, format_prefix(prefix, plen), format_address(from), ifp->name, format_eui64(message + 8), seqno); + if(message[6] == 0) { + debugf(BABEL_DEBUG_COMMON, "Received request with invalid hop count 0"); + goto done; + } handle_request(neigh, prefix, plen, message[6], seqno, message + 8); } else { debugf(BABEL_DEBUG_COMMON,"Received unknown packet type %d from %s on %s.", @@ -1929,8 +1933,14 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix, /* We were about to forward a request to its requestor. Try to find a different neighbour to forward the request to. */ struct babel_route *other_route; + /* First try feasible routes as required by RFC */ + other_route = find_best_route(prefix, plen, 1, neigh); - other_route = find_best_route(prefix, plen, 0, neigh); + if(!other_route || route_metric(other_route) >= INFINITY) { + /* If no feasible route found, try non-feasible routes */ + other_route = find_best_route(prefix, plen, 0, neigh); + } + if(other_route && route_metric(other_route) < INFINITY) successor = other_route->neigh; } |
