Don't rearm rs timer if callback is not set
authorHans Dedecker <hans.dedecker@technicolor.com>
Wed, 15 Jan 2014 13:46:44 +0000 (14:46 +0100)
committerHans Dedecker <hans.dedecker@technicolor.com>
Wed, 15 Jan 2014 13:46:44 +0000 (14:46 +0100)
src/router.c

index a75b847fbb2b29de358b75ac3c8e757236c2c3c5..dfbcf60dca73e4fb62f0b3e1b7eeb895f1cb971b 100644 (file)
@@ -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);
+       }
 }