Commit 8b6dabf7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Send requests when receiving unfeasible updates if they're any good.

parent 55ad5c60
......@@ -384,11 +384,16 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
if(feasible)
trigger_route_change(route, oldsrc, oldmetric);
else if(lost)
else
send_unfeasible_request(metric, a, p, plen);
if(lost)
route_lost(oldsrc, oldmetric);
} else {
if(!feasible)
if(!feasible) {
send_unfeasible_request(metric, a, p, plen);
return NULL;
}
if(refmetric >= INFINITY)
/* Somebody's retracting a route we never saw. */
return NULL;
......@@ -412,6 +417,26 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
return route;
}
/* We just received an unfeasible update. If it's any good, send
a request for a new seqno. */
void
send_unfeasible_request(unsigned short metric, const unsigned char *a,
const unsigned char *prefix, unsigned char plen)
{
struct route *route = find_installed_route(prefix, plen);
struct source *src = find_source(a, prefix, plen, 0, 0);
if(src == NULL)
return;
if(!route || route->metric >= metric + 256) {
send_request_resend(prefix, plen,
src->metric >= INFINITY ?
src->seqno : seqno_plus(src->seqno, 1),
hash_id(src->address));
}
}
/* This takes a feasible route and decides whether to install it. The only
condition that it must satisfy is that if there is no currently installed
route, then one will be installed. */
......
......@@ -64,6 +64,8 @@ struct route *update_route(const unsigned char *a,
unsigned short seqno, unsigned short refmetric,
struct neighbour *neigh,
const unsigned char *nexthop);
void send_unfeasible_request(unsigned short metric, const unsigned char *a,
const unsigned char *prefix, unsigned char plen);
void consider_route(struct route *route);
void send_triggered_update(struct route *route,
struct source *oldsrc, int oldmetric);
......
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