From 7558ecd9ac1621e695b3d89d04c44f10956b056a Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Sun, 16 Dec 2012 21:45:16 +0000 Subject: [PATCH] Fix periodic loop --- src/dhcp6.c | 8 +++++++- src/radv.c | 7 ++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dhcp6.c b/src/dhcp6.c index 48d0d50..7f5e7bd 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -596,7 +596,13 @@ void dhcp_construct_contexts(time_t now) } if (param.newone) - lease_update_file(now); + { + if (daemon->dhcp || daemon->doing_dhcp6) + lease_update_file(now); + else + /* Not doing DHCP, so no lease system, manage alarms for ra only */ + send_alarm(periodic_ra(now), now); + } } static int join_multicast_worker(struct in6_addr *local, int prefix, diff --git a/src/radv.c b/src/radv.c index b74c398..a935343 100644 --- a/src/radv.c +++ b/src/radv.c @@ -102,11 +102,8 @@ void ra_start_unsolicted(time_t now, struct dhcp_context *context) context->ra_time = now; else for (context = daemon->dhcp6; context; context = context->next) - if (context->flags & CONTEXT_RA) - context->ra_time = now + (rand16()/13000); /* range 0 - 5 */ - else - context->ra_time = 0; - + context->ra_time = now + (rand16()/13000); /* range 0 - 5 */ + /* re-do frequently for a minute or so, in case the first gets lost. */ ra_short_period_start = now; }