mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Cope with --listen-address for not yet existent addr in bind-dynamic mode.
This commit is contained in:
@@ -338,10 +338,19 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
|
||||
sprintf(daemon->addrbuff, "port %d", port);
|
||||
s = _("failed to create listening socket for %s: %s");
|
||||
|
||||
if (dienow)
|
||||
die(s, daemon->addrbuff, EC_BADNET);
|
||||
if (fd != -1)
|
||||
close (fd);
|
||||
|
||||
if (dienow)
|
||||
{
|
||||
/* failure to bind addresses given by --listen-address at this point
|
||||
is OK if we're doing bind-dynamic */
|
||||
if (!option_bool(OPT_CLEVERBIND))
|
||||
die(s, daemon->addrbuff, EC_BADNET);
|
||||
}
|
||||
else
|
||||
my_syslog(LOG_WARNING, s, daemon->addrbuff, strerror(errno));
|
||||
|
||||
my_syslog(LOG_ERR, s, daemon->addrbuff, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -513,7 +522,8 @@ void create_bound_listeners(int dienow)
|
||||
no interface with a matching address. These may be valid: eg it's possible
|
||||
to listen on 127.0.1.1 even if the loopback interface is 127.0.0.1
|
||||
|
||||
If the address isn't valid the bind() will fail and we'll die().
|
||||
If the address isn't valid the bind() will fail and we'll die()
|
||||
(except in bind-dynamic mode, when we'll complain but keep trying.)
|
||||
|
||||
The resulting listeners have the ->iface field NULL, and this has to be
|
||||
handled by the DNS and TFTP code. It disables --localise-queries processing
|
||||
|
||||
Reference in New Issue
Block a user