Commit e6c34750 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use route_old and route_expired.

parent 5d715b56
...@@ -257,7 +257,7 @@ find_best_route(const unsigned char *prefix, unsigned char plen, int feasible, ...@@ -257,7 +257,7 @@ find_best_route(const unsigned char *prefix, unsigned char plen, int feasible,
for(i = 0; i < numroutes; i++) { for(i = 0; i < numroutes; i++) {
if(!source_match(routes[i].src, prefix, plen)) if(!source_match(routes[i].src, prefix, plen))
continue; continue;
if(routes[i].time < now.tv_sec - routes[i].hold_time) if(route_expired(&routes[i]))
continue; continue;
if(feasible && !route_feasible(&routes[i])) if(feasible && !route_feasible(&routes[i]))
continue; continue;
...@@ -277,7 +277,7 @@ update_route_metric(struct route *route) ...@@ -277,7 +277,7 @@ update_route_metric(struct route *route)
int newmetric; int newmetric;
oldmetric = route->metric; oldmetric = route->metric;
if(route->time < now.tv_sec - route->hold_time) { if(route_expired(route)) {
if(route->refmetric < INFINITY) { if(route->refmetric < INFINITY) {
route->seqno = seqno_plus(route->src->seqno, 1); route->seqno = seqno_plus(route->src->seqno, 1);
route->refmetric = INFINITY; route->refmetric = INFINITY;
...@@ -640,7 +640,7 @@ expire_routes(void) ...@@ -640,7 +640,7 @@ expire_routes(void)
struct route *route = &routes[i]; struct route *route = &routes[i];
if(route->time > now.tv_sec || /* clock stepped */ if(route->time > now.tv_sec || /* clock stepped */
route->time < now.tv_sec - route->hold_time - 20) { route_old(route)) {
flush_route(route); flush_route(route);
continue; continue;
} }
...@@ -648,7 +648,7 @@ expire_routes(void) ...@@ -648,7 +648,7 @@ expire_routes(void)
update_route_metric(route); update_route_metric(route);
if(route->installed && route->refmetric < INFINITY) { if(route->installed && route->refmetric < INFINITY) {
if(route->time < now.tv_sec - route->hold_time * 7 / 8) if(route_old(route))
send_unicast_request(route->neigh, send_unicast_request(route->neigh,
route->src->prefix, route->src->plen); route->src->prefix, route->src->plen);
} }
......
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