Commit aaa1944e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

More tweaks to request forwarding.

parent 3072bce2
...@@ -251,7 +251,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix, ...@@ -251,7 +251,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
unsigned short seqno, unsigned short router_hash) unsigned short seqno, unsigned short router_hash)
{ {
struct xroute *xroute; struct xroute *xroute;
struct route *route; struct route *route, *best_route;
if(hop_count == 0) { if(hop_count == 0) {
send_update(neigh->network, 1, prefix, plen); send_update(neigh->network, 1, prefix, plen);
...@@ -266,9 +266,16 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix, ...@@ -266,9 +266,16 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
return; return;
} }
/* We usually want to send the request to our selected successor,
but avoid it if we suspect it's dead. So pick the best successor
(feasible of not) if our selected successor's metric is too large. */
route = find_installed_route(prefix, plen); route = find_installed_route(prefix, plen);
if(!route || route->metric >= INFINITY || route->neigh == neigh) best_route = find_best_route(prefix, plen, 0, neigh);
route = find_best_route(prefix, plen, 0, neigh); if(!route || route->neigh == neigh || route->metric == INFINITY)
route = best_route;
else if(route && best_route && route->metric >= best_route->metric + 256)
route = best_route;
if(!route || route->metric >= INFINITY || route->neigh == neigh) if(!route || route->metric >= INFINITY || route->neigh == neigh)
return; return;
if(router_hash == hash_id(route->src->address) && if(router_hash == hash_id(route->src->address) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment