Commit e0f3b52d authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't send requests to sources with very old sequence numbers.

This avoids repeatedly sending requests to a source that has just rebooted
and lost its sequence number.
parent f24ec86f
...@@ -422,13 +422,13 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen, ...@@ -422,13 +422,13 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
if(feasible) if(feasible)
trigger_route_change(route, oldsrc, oldmetric); trigger_route_change(route, oldsrc, oldmetric);
else else
send_unfeasible_request(metric, a, p, plen); send_unfeasible_request(seqno, metric, a, p, plen);
if(lost) if(lost)
route_lost(oldsrc, oldmetric); route_lost(oldsrc, oldmetric);
} else { } else {
if(!feasible) { if(!feasible) {
send_unfeasible_request(metric, a, p, plen); send_unfeasible_request(seqno, metric, a, p, plen);
return NULL; return NULL;
} }
if(refmetric >= INFINITY) if(refmetric >= INFINITY)
...@@ -459,7 +459,8 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen, ...@@ -459,7 +459,8 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
/* We just received an unfeasible update. If it's any good, send /* We just received an unfeasible update. If it's any good, send
a request for a new seqno. */ a request for a new seqno. */
void void
send_unfeasible_request(unsigned short metric, const unsigned char *a, send_unfeasible_request(unsigned short seqno, unsigned short metric,
const unsigned char *a,
const unsigned char *prefix, unsigned char plen) const unsigned char *prefix, unsigned char plen)
{ {
struct route *route = find_installed_route(prefix, plen); struct route *route = find_installed_route(prefix, plen);
...@@ -468,6 +469,11 @@ send_unfeasible_request(unsigned short metric, const unsigned char *a, ...@@ -468,6 +469,11 @@ send_unfeasible_request(unsigned short metric, const unsigned char *a,
if(src == NULL) if(src == NULL)
return; return;
if(seqno_minus(src->seqno, seqno) < 5) {
/* Probably a source that lost its seqno. Let it time-out. */
return;
}
if(!route || route->metric >= metric + 256) { if(!route || route->metric >= metric + 256) {
send_request_resend(prefix, plen, send_request_resend(prefix, plen,
src->metric >= INFINITY ? src->metric >= INFINITY ?
......
...@@ -65,7 +65,8 @@ struct route *update_route(const unsigned char *a, ...@@ -65,7 +65,8 @@ struct route *update_route(const unsigned char *a,
unsigned short seqno, unsigned short refmetric, unsigned short seqno, unsigned short refmetric,
struct neighbour *neigh, struct neighbour *neigh,
const unsigned char *nexthop); const unsigned char *nexthop);
void send_unfeasible_request(unsigned short metric, const unsigned char *a, void send_unfeasible_request(unsigned short seqno, unsigned short metric,
const unsigned char *a,
const unsigned char *prefix, unsigned char plen); const unsigned char *prefix, unsigned char plen);
void consider_route(struct route *route); void consider_route(struct route *route);
void send_triggered_update(struct route *route, void send_triggered_update(struct route *route,
......
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