Make sure that the DNS Forwarder/Resolver is actually capable of accepting queries on localhost before using it as a DNS server.

This commit is contained in:
jim-p 2014-04-23 10:14:59 -04:00
parent 770f4ee5b8
commit bd5737dc22
4 changed files with 8 additions and 2 deletions

View File

@ -103,7 +103,9 @@ function system_resolvconf_generate($dynupdate = false) {
if($syscfg['domain'])
$resolvconf = "domain {$syscfg['domain']}\n";
if ((isset($config['dnsmasq']['enable']) || isset($config['unbound']['enable'])) && !isset($config['system']['dnslocalhost']))
if (((isset($config['dnsmasq']['enable']) && (empty($config['dnsmasq']['interface']) || in_array("lo0", explode(",", $config['dnsmasq']['interface']))))
|| (isset($config['unbound']['enable'])) && (empty($config['unbound']['active_interface']) || in_array("lo0", explode(",", $config['unbound']['active_interface']))))
&& !isset($config['system']['dnslocalhost']))
$resolvconf .= "nameserver 127.0.0.1\n";
if (isset($syscfg['dnsallowoverride'])) {

View File

@ -116,6 +116,8 @@ if ($_POST) {
// Relaod filter (we might need to sync to CARP hosts)
filter_configure();
/* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate();
if ($retval == 0)
clear_subsystem_dirty('hosts');

View File

@ -110,6 +110,8 @@ if ($_POST) {
$savemsg = get_std_save_message($retval);
if ($retval == 0)
clear_subsystem_dirty('unbound');
/* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate();
}
}

View File

@ -402,7 +402,7 @@ include("head.inc");
<?=gettext("Do not use the DNS Forwarder as a DNS server for the firewall"); ?>
</strong>
<br />
<?=gettext("By default localhost (127.0.0.1) will be used as the first DNS server where the DNS forwarder is enabled, so system can use the DNS forwarder to perform lookups. ".
<?=gettext("By default localhost (127.0.0.1) will be used as the first DNS server where the DNS Forwarder or DNS Resolver is enabled and set to listen on Localhost, so system can use the local DNS service to perform lookups. ".
"Checking this box omits localhost from the list of DNS servers."); ?>
</span>
</td>