Put the FQDN first in /etc/hosts to make dnsmasq happy when reverse resolving hostnames. Make a special exception for localhost. Fixes #7771

This commit is contained in:
jim-p 2017-08-14 14:16:53 -04:00
parent fde09aa8e5
commit 0e78c2f544

View File

@ -549,10 +549,11 @@ function system_hosts_generate() {
$hosts_array = system_hosts_entries($dnsmasqcfg);
foreach ($hosts_array as $host) {
$hosts .= "{$host['ipaddr']}\t";
if (!empty($host['name'])) {
$hosts .= "{$host['name']} ";
if ($host['name'] == "localhost") {
$hosts .= "{$host['name']} {$host['fqdn']}";
} else {
$hosts .= "{$host['fqdn']} {$host['name']}";
}
$hosts .= "{$host['fqdn']}";
$hosts .= "\n";
}
unset($hosts_array);