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,20 +267,22 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
}
route = find_installed_route(prefix, plen);
if(route && route->metric < INFINITY) {
if(router_hash == hash_id(route->src->address) &&
seqno_compare(seqno, route->seqno) > 0) {
if(hop_count > 1) {
send_unicast_request(route->neigh, prefix, plen,
hop_count - 1, seqno, router_hash);
record_request(prefix, plen, seqno, router_hash,
neigh->network, 0);
}
} else {
send_update(neigh->network, 1, prefix, plen);
}
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) &&
seqno_compare(seqno, route->seqno) > 0) {
if(hop_count > 1) {
send_unicast_request(route->neigh, prefix, plen,
hop_count - 1, seqno, router_hash);
record_request(prefix, plen, seqno, router_hash,
neigh->network, 0);
}
} else {
send_update(neigh->network, 1, prefix, plen);
}
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