diff options
author | sbyx <steven@midlink.org> | 2014-01-16 15:46:27 -0800 |
---|---|---|
committer | sbyx <steven@midlink.org> | 2014-01-16 15:46:27 -0800 |
commit | 71db4a0c548b23d842fdf3cc2b3ed6a88816c8ba (patch) | |
tree | 7401745ff5f3eb80c72898e586ab49bb74f71069 | |
parent | d59daa0f4027ee70a4650ab8baa40d58d113cd30 (diff) | |
parent | fa3073b32452d78037d2a8ce2e3ea213b3d5f50c (diff) |
Merge pull request #8 from dedeckeh/bugfixes
Don't rearm RS timer if callback is not set
-rw-r--r-- | src/router.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/router.c b/src/router.c index a75b847..dfbcf60 100644 --- a/src/router.c +++ b/src/router.c @@ -451,12 +451,14 @@ static void send_router_advert(struct uloop_timeout *event) odhcpd_send(router_event.uloop.fd, &all_nodes, iov, ARRAY_SIZE(iov), iface); - // Rearm timer - int msecs; - odhcpd_urandom(&msecs, sizeof(msecs)); - msecs = (labs(msecs) % (1000 * (MaxRtrAdvInterval - - MinRtrAdvInterval))) + (MinRtrAdvInterval * 1000); - uloop_timeout_set(&iface->timer_rs, msecs); + // Rearm timer if not shut down + if (event->cb) { + int msecs; + odhcpd_urandom(&msecs, sizeof(msecs)); + msecs = (labs(msecs) % (1000 * (MaxRtrAdvInterval + - MinRtrAdvInterval))) + (MinRtrAdvInterval * 1000); + uloop_timeout_set(&iface->timer_rs, msecs); + } } |