diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-04 01:51:06 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-04 01:51:06 +0200 |
commit | 4b79b85e4eb270dd2104c7fee4e5c9352f5703b7 (patch) | |
tree | 32ceb73ec426e675686222d3c813025b459a21be /src | |
parent | 8c439585116b30cbbdf405d2001e21bc4998c154 (diff) | |
download | babel-4b79b85e4eb270dd2104c7fee4e5c9352f5703b7.tar babel-4b79b85e4eb270dd2104c7fee4e5c9352f5703b7.zip |
Don't purge route entries before the purge timeout has passed
Diffstat (limited to 'src')
-rw-r--r-- | src/babel.c | 6 | ||||
-rw-r--r-- | src/babel.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/babel.c b/src/babel.c index 3c0e219..7842428 100644 --- a/src/babel.c +++ b/src/babel.c @@ -93,7 +93,11 @@ static void maintain_routes(gmrf_context_t *ctx) { gp_babel_route_update(ctx, route); - if (!route->nexthops) { + if (!route->nexthops && gp_babel_since(ctx, route->last_nexthop) > GP_BABEL_PURGE_TIMEOUT) { + gmrf_logf(ctx->gmrf, LOG_DEBUG, "node %04x%04x (%u, seqno=%04x): purging.", + ntohl(*(uint32_t*)route->node.id), ntohl(*(uint32_t*)(route->node.id+4)), + route->metric.metric, route->metric.seqno); + *cur = *next; next = cur; gp_babel_route_free(ctx, route); diff --git a/src/babel.h b/src/babel.h index 46c19e4..c55a3a8 100644 --- a/src/babel.h +++ b/src/babel.h @@ -45,6 +45,7 @@ #define GP_BABEL_UPDATE_REQUEST_TIMEOUT(interval) ((interval)*13/4) /* 3.25 intervals */ #define GP_BABEL_MAINTENANCE_INTERVAL GP_BABEL_HELLO_INTERVAL +#define GP_BABEL_PURGE_TIMEOUT GP_BABEL_UPDATE_TIMEOUT(GP_BABEL_UPDATE_INTERVAL) #define GP_BABEL_NEIGH_PACKET_TIMEOUT 6000 |