Commit 11344b80 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Protect expiration against clock stepping.

parent b12f084c
......@@ -247,6 +247,7 @@ check_neighbours()
changed = update_neighbour(&neighs[i], -1, 0);
if(neighs[i].reach == 0 ||
neighs[i].hello_time.tv_sec > now.tv_sec || /* clock stepped */
timeval_minus_msec(&now, &neighs[i].hello_time) > 300000) {
flush_neighbour(&neighs[i]);
continue;
......
......@@ -636,7 +636,8 @@ expire_routes(void)
while(i < numroutes) {
struct route *route = &routes[i];
if(route->time < now.tv_sec - route_gc_delay) {
if(route->time > now.tv_sec || /* clock stepped */
route->time < now.tv_sec - route_gc_delay) {
flush_route(route);
continue;
}
......
......@@ -166,6 +166,9 @@ expire_sources()
for(i = 0; i < numsrcs; i++) {
if(!srcs[i].valid)
continue;
if(srcs[i].time > now.tv_sec)
/* clock stepped */
srcs[i].time = now.tv_sec;
if(srcs[i].time < now.tv_sec - SOURCE_GC_TIME)
continue;
rc = flush_source(&srcs[i]);
......
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