dnsmasq: always listen on loopback, resolv.conf must know

PR: https://github.com/opnsense/core/issues/2562
This commit is contained in:
Franco Fichtner 2018-07-19 21:38:52 +02:00
parent 5f924d263b
commit 188b098110
2 changed files with 8 additions and 5 deletions

View File

@ -118,9 +118,11 @@ function dnsmasq_configure_do($verbose = false)
}
if (isset($config['dnsmasq']['interface'])) {
$addresses = array('127.0.0.1', '::1');
$interfaces = explode(',', $config['dnsmasq']['interface']);
$interfaces[] = 'lo0';
$addresses = array();
foreach (explode(',', $config['dnsmasq']['interface']) as $interface) {
foreach ($interfaces as $interface) {
foreach (legacy_getall_interface_addresses(get_real_interface($interface)) as $tmpaddr) {
$tmpaddr = explode('/', $tmpaddr)[0];
/* no support for link-local address with scope specified */

View File

@ -157,9 +157,10 @@ function system_resolvconf_generate($verbose = false)
$resolvconf = "domain {$syscfg['domain']}\n";
}
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'])) {
/* XXX Unbound should always bind to loopback like Dnsmasq */
if (!isset($config['system']['dnslocalhost']) && (isset($config['dnsmasq']['enable']) ||
(isset($config['unbound']['enable']) && (empty($config['unbound']['active_interface']) ||
in_array('lo0', explode(',', $config['unbound']['active_interface'])))))) {
$resolvconf .= "nameserver 127.0.0.1\n";
}