mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
import of dnsmasq-2.27.tar.gz
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* dnsmasq is Copyright (c) 2000-2005 Simon Kelley
|
||||
/* dnsmasq is Copyright (c) 2000-2006 Simon Kelley
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -176,8 +176,7 @@ int main (int argc, char **argv)
|
||||
die(_("DBus error: %s"), err);
|
||||
}
|
||||
#else
|
||||
if (daemon->options & OPT_DBUS)
|
||||
die(_("DBus not available: set HAVE_DBUS in src/config.h"), NULL);
|
||||
die(_("DBus not available: set HAVE_DBUS in src/config.h"), NULL);
|
||||
#endif
|
||||
|
||||
/* If query_port is set then create a socket now, before dumping root
|
||||
@@ -256,7 +255,7 @@ int main (int argc, char **argv)
|
||||
#endif
|
||||
|
||||
if (daemon->dhcp &&
|
||||
(i == daemon->lease_fd ||
|
||||
(i == fileno(daemon->lease_stream) ||
|
||||
i == daemon->dhcpfd ||
|
||||
i == daemon->dhcp_raw_fd ||
|
||||
i == daemon->dhcp_icmp_fd))
|
||||
@@ -314,14 +313,14 @@ int main (int argc, char **argv)
|
||||
if (if_tmp->name && !if_tmp->used)
|
||||
syslog(LOG_WARNING, _("warning: interface %s does not currently exist"), if_tmp->name);
|
||||
|
||||
#ifdef HAVE_RTNETLINK
|
||||
/* Must do this after daemonizing so that the pid is right */
|
||||
netlink_init(daemon);
|
||||
#endif
|
||||
|
||||
if (daemon->dhcp)
|
||||
{
|
||||
struct dhcp_context *dhcp_tmp;
|
||||
|
||||
#ifdef HAVE_RTNETLINK
|
||||
/* Must do this after daemonizing so that the pid is right */
|
||||
daemon->netlinkfd = netlink_init();
|
||||
#endif
|
||||
|
||||
for (dhcp_tmp = daemon->dhcp; dhcp_tmp; dhcp_tmp = dhcp_tmp->next)
|
||||
{
|
||||
@@ -375,7 +374,7 @@ int main (int argc, char **argv)
|
||||
{
|
||||
if (daemon->dhcp)
|
||||
{
|
||||
lease_update_file(1, now);
|
||||
lease_update_file(daemon, 1, now);
|
||||
#ifdef HAVE_BROKEN_RTC
|
||||
alarm(daemon->min_leasetime);
|
||||
#endif
|
||||
@@ -400,6 +399,15 @@ int main (int argc, char **argv)
|
||||
maxfd = daemon->dhcpfd;
|
||||
}
|
||||
|
||||
#ifdef HAVE_RTNETLINK
|
||||
if (daemon->netlinkfd != -1)
|
||||
{
|
||||
FD_SET(daemon->netlinkfd, &rset);
|
||||
if (daemon->netlinkfd > maxfd)
|
||||
maxfd = daemon->netlinkfd;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Whilst polling for the dbus, wake every quarter second */
|
||||
#ifdef HAVE_PSELECT
|
||||
{
|
||||
@@ -497,6 +505,11 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_RTNETLINK
|
||||
if (daemon->netlinkfd != -1 && FD_ISSET(daemon->netlinkfd, &rset))
|
||||
netlink_multicast(daemon);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
/* if we didn't create a DBus connection, retry now. */
|
||||
@@ -522,9 +535,9 @@ int main (int argc, char **argv)
|
||||
if (daemon->dhcp)
|
||||
{
|
||||
#ifdef HAVE_BROKEN_RTC
|
||||
lease_update_file(1, now);
|
||||
lease_update_file(daemon, 1, now);
|
||||
#endif
|
||||
close(daemon->lease_fd);
|
||||
fclose(daemon->lease_stream);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -565,7 +578,7 @@ void clear_cache_and_reload(struct daemon *daemon, time_t now)
|
||||
dhcp_read_ethers(daemon);
|
||||
dhcp_update_configs(daemon->dhcp_conf);
|
||||
lease_update_from_configs(daemon);
|
||||
lease_update_file(0, now);
|
||||
lease_update_file(daemon, 0, now);
|
||||
lease_update_dns(daemon);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user