mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix problem with domains associated with DHCP hosts at startup.
At startup, the leases file is read by lease_init(), and in lease_init() undecorated hostnames are expanded into FQDNs by adding the domain associated with the address of the lease. lease_init() happens relavtively early in the startup, party because if it calls the dhcp-lease helper script, we don't want that to inherit a load of sensitive file descriptors. This has implications if domains are defined using the --domain=example.com,eth0 format since it's long before we call enumerate_interfaces(), so get_domain fails for such domains. The patch just moves the hostname expansion function to a seperate subroutine that gets called later, after enumerate_interfaces().
This commit is contained in:
@@ -374,6 +374,13 @@ int main (int argc, char **argv)
|
||||
|
||||
if (!enumerate_interfaces(1) || !enumerate_interfaces(0))
|
||||
die(_("failed to find list of interfaces: %s"), NULL, EC_MISC);
|
||||
|
||||
#ifdef HAVE_DHCP
|
||||
/* Determine lease FQDNs after enumerate_interfaces() call, since it needs
|
||||
to call get_domain and that's only valid for some domain configs once we
|
||||
have interface addresses. */
|
||||
lease_calc_fqdns();
|
||||
#endif
|
||||
|
||||
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user