Commit 3964af3e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement poison routes.

We now distinguish between the timeout timer and the gc timer, and announce
infinity until gc time.  Timeout is set to 120 seconds, gc to 90.
parent 46a60aa2
......@@ -708,18 +708,19 @@ expire_routes(void)
while(i < numroutes) {
struct route *route = &routes[i];
if(route->time < now.tv_sec - 180) {
if(route->blackhole_time > 0 &&
route->blackhole_time < now.tv_sec - 65) {
flush_route(route);
continue;
}
update_route_metric(route);
if(route->time < now.tv_sec - 120)
update_route(route->dest->address, ((route->seqno + 1) & 0xFF),
INFINITY, route->nexthop, NULL, 0);
else
update_route_metric(route);
if(route->refmetric >= INFINITY) {
flush_route(route);
continue;
}
if(route->installed) {
if(route->installed && route->refmetric < INFINITY) {
if(route->time <= now.tv_sec - 90)
send_unicast_request(route->nexthop, route->dest);
}
......
......@@ -306,8 +306,13 @@ update_route(const unsigned char *d, int seqno, int refmetric,
oldseqno = route->seqno;
oldmetric = route->metric;
route->time = now.tv_sec;
if(route->refmetric >= INFINITY && refmetric < INFINITY)
route->origtime = now.tv_sec;
if(refmetric < INFINITY) {
route->blackhole_time = 0;
if(route->refmetric >= INFINITY)
route->origtime = now.tv_sec;
} else if(route->blackhole_time <= 0) {
route->blackhole_time = now.tv_sec;
}
route->seqno = seqno;
route->refmetric = refmetric;
change_route_metric(route, metric);
......@@ -342,6 +347,7 @@ update_route(const unsigned char *d, int seqno, int refmetric,
route->nexthop = nexthop;
route->time = now.tv_sec;
route->origtime = now.tv_sec;
route->blackhole_time = 0;
route->installed = 0;
numroutes++;
for(i = 0; i < numpxroutes; i++)
......
......@@ -30,6 +30,7 @@ struct route {
struct neighbour *nexthop;
int time;
int origtime;
int blackhole_time;
int installed;
};
......
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