Commit 655c4f3d authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Be smarter about forwarding requests.

If our currently selected nexthop sends us a request, we should not
forward it back, but rather try a different route.
parent 3cde1704
...@@ -267,7 +267,10 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix, ...@@ -267,7 +267,10 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
} }
route = find_installed_route(prefix, plen); route = find_installed_route(prefix, plen);
if(route && route->metric < INFINITY) { if(!route || route->metric >= INFINITY || route->neigh == neigh)
route = find_best_route(prefix, plen, 0);
if(!route || route->metric >= INFINITY || route->neigh == neigh)
return;
if(router_hash == hash_id(route->src->address) && if(router_hash == hash_id(route->src->address) &&
seqno_compare(seqno, route->seqno) > 0) { seqno_compare(seqno, route->seqno) > 0) {
if(hop_count > 1) { if(hop_count > 1) {
...@@ -280,7 +283,6 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix, ...@@ -280,7 +283,6 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
send_update(neigh->network, 1, prefix, plen); send_update(neigh->network, 1, prefix, plen);
} }
return; return;
}
} }
......
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