summaryrefslogtreecommitdiff
path: root/proto/babel
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-10-25 17:59:57 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-12-07 13:53:42 +0100
commit738a57b69bdff6244cf5093ae3997290e6c11324 (patch)
tree9f022e973e5268968dfddcaa888d33e167f29fc0 /proto/babel
parentb47eaefe12d0673af2c7c7ec1a8adff982a958ca (diff)
Babel: Fix hello timeout for short hello intervals
Diffstat (limited to 'proto/babel')
-rw-r--r--proto/babel/babel.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index 07c82d91..2009c0d0 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -355,21 +355,25 @@ babel_expire_ihu(struct babel_proto *p, struct babel_neighbor *nbr)
}
static void
-babel_expire_hello(struct babel_proto *p, struct babel_neighbor *nbr)
+babel_expire_hello(struct babel_proto *p, struct babel_neighbor *nbr, btime now_)
{
+again:
nbr->hello_map <<= 1;
if (nbr->hello_cnt < 16)
nbr->hello_cnt++;
+ nbr->hello_expiry += nbr->last_hello_int;
+
+ /* We may expire multiple hellos if last_hello_int is too short */
+ if (nbr->hello_map && nbr->hello_expiry <= now_)
+ goto again;
+
TRACE(D_EVENTS, "Hello from nbr %I on %s expired, %d left",
nbr->addr, nbr->ifa->iface->name, u32_popcount(nbr->hello_map));
if (nbr->hello_map)
- {
- nbr->hello_expiry += nbr->last_hello_int;
babel_update_cost(nbr);
- }
else
babel_flush_neighbor(p, nbr);
}
@@ -389,7 +393,7 @@ babel_expire_neighbors(struct babel_proto *p)
babel_expire_ihu(p, nbr);
if (nbr->hello_expiry && nbr->hello_expiry <= now_)
- babel_expire_hello(p, nbr);
+ babel_expire_hello(p, nbr, now_);
}
}
}