mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Rationalise join_multicast()
This commit is contained in:
@@ -39,6 +39,7 @@ static struct iovec iov;
|
||||
static u32 netlink_pid;
|
||||
|
||||
static int nl_async(struct nlmsghdr *h);
|
||||
static void nl_newinterface(time_t now);
|
||||
|
||||
void netlink_init(void)
|
||||
{
|
||||
@@ -199,23 +200,8 @@ int iface_enumerate(int family, void *parm, int (*callback)())
|
||||
/* handle async new interface address arrivals, these have to be done
|
||||
after we complete as we're not re-entrant */
|
||||
if (newaddr)
|
||||
{
|
||||
time_t now = dnsmasq_time();
|
||||
nl_newinterface(dnsmasq_time());
|
||||
|
||||
if (option_bool(OPT_CLEVERBIND))
|
||||
{
|
||||
enumerate_interfaces();
|
||||
create_bound_listeners(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DHCP6
|
||||
if (daemon->doing_dhcp6 || daemon->doing_ra)
|
||||
dhcp_construct_contexts(now);
|
||||
|
||||
if (daemon->doing_dhcp6)
|
||||
lease_find_interfaces(now);
|
||||
#endif
|
||||
}
|
||||
return callback_ok;
|
||||
}
|
||||
else if (h->nlmsg_type == RTM_NEWADDR && family != AF_UNSPEC && family != AF_LOCAL)
|
||||
@@ -346,23 +332,9 @@ void netlink_multicast(time_t now)
|
||||
|
||||
/* restore non-blocking status */
|
||||
fcntl(daemon->netlinkfd, F_SETFL, flags);
|
||||
|
||||
|
||||
if (newaddr)
|
||||
{
|
||||
if (option_bool(OPT_CLEVERBIND))
|
||||
{
|
||||
enumerate_interfaces();
|
||||
create_bound_listeners(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DHCP6
|
||||
if (daemon->doing_dhcp6 || daemon->doing_ra)
|
||||
dhcp_construct_contexts(now);
|
||||
|
||||
if (daemon->doing_dhcp6)
|
||||
lease_find_interfaces(now);
|
||||
#endif
|
||||
}
|
||||
nl_newinterface(now);
|
||||
}
|
||||
|
||||
static int nl_async(struct nlmsghdr *h)
|
||||
@@ -410,7 +382,28 @@ static int nl_async(struct nlmsghdr *h)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nl_newinterface(time_t now)
|
||||
{
|
||||
if (option_bool(OPT_CLEVERBIND))
|
||||
{
|
||||
enumerate_interfaces();
|
||||
create_bound_listeners(0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DHCP6
|
||||
if (daemon->doing_dhcp6 || daemon->doing_ra)
|
||||
{
|
||||
dhcp_construct_contexts(now);
|
||||
join_multicast(0);
|
||||
}
|
||||
|
||||
if (daemon->doing_dhcp6)
|
||||
lease_find_interfaces(now);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user