diff --git a/src/dhcp6.c b/src/dhcp6.c index fe3bbd2..777d856 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -577,8 +577,11 @@ void dhcp_construct_contexts(time_t now) for (context = daemon->dhcp6; context; context = context->next) if (context->flags & CONTEXT_CONSTRUCTED) - context->flags |= CONTEXT_GC; - + { + context->flags |= CONTEXT_GC; + context->if_index = 0; + } + iface_enumerate(AF_INET6, ¶m, construct_worker); for (up = &daemon->dhcp6, context = daemon->dhcp6; context; context = tmp) diff --git a/src/dnsmasq.c b/src/dnsmasq.c index 7a9d340..4e2165b 100644 --- a/src/dnsmasq.c +++ b/src/dnsmasq.c @@ -210,9 +210,8 @@ int main (int argc, char **argv) #endif #ifdef HAVE_LINUX_NETWORK - /* After lease_init */ netlink_init(); - + if (option_bool(OPT_NOWILD) && option_bool(OPT_CLEVERBIND)) die(_("cannot set --bind-interfaces and --bind-dynamic"), NULL, EC_BADCONF); #endif @@ -222,13 +221,7 @@ int main (int argc, char **argv) if (daemon->doing_dhcp6 || daemon->doing_ra) join_multicast(); #endif - -#ifdef HAVE_DHCP - /* after netlink_init */ - if (daemon->dhcp || daemon->doing_dhcp6) - lease_find_interfaces(now); -#endif - + if (!enumerate_interfaces()) die(_("failed to find list of interfaces: %s"), NULL, EC_MISC); @@ -650,6 +643,9 @@ int main (int argc, char **argv) my_syslog(MS_DHCP | LOG_INFO, _("IPv6 router advertisement enabled")); # endif + /* after dhcp_contruct_contexts */ + if (daemon->dhcp || daemon->doing_dhcp6) + lease_find_interfaces(now); #endif #ifdef HAVE_TFTP diff --git a/src/netlink.c b/src/netlink.c index 9090034..db575c3 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -200,13 +200,19 @@ int iface_enumerate(int family, void *parm, int (*callback)()) after we complete as we're not re-entrant */ if (newaddr) { + time_t now = dnsmasq_time(); + if (option_bool(OPT_CLEVERBIND)) { enumerate_interfaces(); create_bound_listeners(0); } #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 } return callback_ok; diff --git a/src/option.c b/src/option.c index b765f90..59be9d4 100644 --- a/src/option.c +++ b/src/option.c @@ -2180,7 +2180,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma case 'F': /* --dhcp-range */ { 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)); memset (new, 0, sizeof(*new));