DNSmasq: use domain override for static hosts, closes https://github.com/opnsense/core/pull/4539

This commit is contained in:
Ad Schellevis 2020-12-21 11:21:55 +01:00
parent 8644af058c
commit 1adefd7440

View File

@ -231,11 +231,14 @@ function _dnsmasq_add_host_entries()
continue;
}
$domain = $config['system']['domain'];
if ($host['domain']) {
if (!empty($host['domain'])) {
$domain = $host['domain'];
} elseif ($dhcpifconf['domain']) {
} elseif (!empty($dhcpifconf['domain'])) {
$domain = $dhcpifconf['domain'];
} elseif (!empty($config['dnsmasq']['regdhcpdomain'])) {
$domain = $config['dnsmasq']['regdhcpdomain'];
} else {
$domain = $config['system']['domain'];
}
$dhosts .= "{$host['ipaddr']}\t{$host['hostname']}.{$domain} {$host['hostname']}\n";
@ -251,7 +254,6 @@ function _dnsmasq_add_host_entries()
if (!$host['ipaddrv6'] || !$host['hostname']) {
continue;
}
$domain = $config['system']['domain'];
// XXX: dhcpdv6 domain entries have been superseded by domainsearchlist,
// for backward compatibilty support both here.
if (!empty($host['domainsearchlist'])) {
@ -262,7 +264,12 @@ function _dnsmasq_add_host_entries()
$domain = $dhcpifconf['domainsearchlist'];
} elseif (!empty($dhcpifconf['domain'])) {
$domain = $dhcpifconf['domain'];
} elseif (!empty($config['dnsmasq']['regdhcpdomain'])) {
$domain = $config['dnsmasq']['regdhcpdomain'];
} else {
$domain = $config['system']['domain'];
}
$domain = explode(";", $domain)[0]; // XXX: first entry of domainsearchlist
$dhosts .= "{$host['ipaddrv6']}\t{$host['hostname']}.{$domain} {$host['hostname']}\n";
}