Commit 8445f5d2 authored by Simon Kelley's avatar Simon Kelley

Fix initialisation order.

parent 72c9c3b1
...@@ -577,8 +577,11 @@ void dhcp_construct_contexts(time_t now) ...@@ -577,8 +577,11 @@ void dhcp_construct_contexts(time_t now)
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
if (context->flags & CONTEXT_CONSTRUCTED) if (context->flags & CONTEXT_CONSTRUCTED)
context->flags |= CONTEXT_GC; {
context->flags |= CONTEXT_GC;
context->if_index = 0;
}
iface_enumerate(AF_INET6, &param, construct_worker); iface_enumerate(AF_INET6, &param, construct_worker);
for (up = &daemon->dhcp6, context = daemon->dhcp6; context; context = tmp) for (up = &daemon->dhcp6, context = daemon->dhcp6; context; context = tmp)
......
...@@ -210,9 +210,8 @@ int main (int argc, char **argv) ...@@ -210,9 +210,8 @@ int main (int argc, char **argv)
#endif #endif
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK
/* After lease_init */
netlink_init(); netlink_init();
if (option_bool(OPT_NOWILD) && option_bool(OPT_CLEVERBIND)) if (option_bool(OPT_NOWILD) && option_bool(OPT_CLEVERBIND))
die(_("cannot set --bind-interfaces and --bind-dynamic"), NULL, EC_BADCONF); die(_("cannot set --bind-interfaces and --bind-dynamic"), NULL, EC_BADCONF);
#endif #endif
...@@ -222,13 +221,7 @@ int main (int argc, char **argv) ...@@ -222,13 +221,7 @@ int main (int argc, char **argv)
if (daemon->doing_dhcp6 || daemon->doing_ra) if (daemon->doing_dhcp6 || daemon->doing_ra)
join_multicast(); join_multicast();
#endif #endif
#ifdef HAVE_DHCP
/* after netlink_init */
if (daemon->dhcp || daemon->doing_dhcp6)
lease_find_interfaces(now);
#endif
if (!enumerate_interfaces()) if (!enumerate_interfaces())
die(_("failed to find list of interfaces: %s"), NULL, EC_MISC); die(_("failed to find list of interfaces: %s"), NULL, EC_MISC);
...@@ -650,6 +643,9 @@ int main (int argc, char **argv) ...@@ -650,6 +643,9 @@ int main (int argc, char **argv)
my_syslog(MS_DHCP | LOG_INFO, _("IPv6 router advertisement enabled")); my_syslog(MS_DHCP | LOG_INFO, _("IPv6 router advertisement enabled"));
# endif # endif
/* after dhcp_contruct_contexts */
if (daemon->dhcp || daemon->doing_dhcp6)
lease_find_interfaces(now);
#endif #endif
#ifdef HAVE_TFTP #ifdef HAVE_TFTP
......
...@@ -200,13 +200,19 @@ int iface_enumerate(int family, void *parm, int (*callback)()) ...@@ -200,13 +200,19 @@ int iface_enumerate(int family, void *parm, int (*callback)())
after we complete as we're not re-entrant */ after we complete as we're not re-entrant */
if (newaddr) if (newaddr)
{ {
time_t now = dnsmasq_time();
if (option_bool(OPT_CLEVERBIND)) if (option_bool(OPT_CLEVERBIND))
{ {
enumerate_interfaces(); enumerate_interfaces();
create_bound_listeners(0); create_bound_listeners(0);
} }
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
dhcp_construct_contexts(dnsmasq_time()); if (daemon->doing_dhcp6 || daemon->doing_ra)
dhcp_construct_contexts(now);
if (daemon->doing_dhcp6)
lease_find_interfaces(now);
#endif #endif
} }
return callback_ok; return callback_ok;
......
...@@ -2180,7 +2180,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -2180,7 +2180,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
case 'F': /* --dhcp-range */ case 'F': /* --dhcp-range */
{ {
int k, leasepos = 2; int k, leasepos = 2;
char *cp, *a[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL }; char *cp, *a[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context)); struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context));
memset (new, 0, sizeof(*new)); memset (new, 0, sizeof(*new));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment