From 0e78c2f544ad577234a0a2f87ce2e8caefdfdb77 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 14 Aug 2017 14:16:53 -0400 Subject: Put the FQDN first in /etc/hosts to make dnsmasq happy when reverse resolving hostnames. Make a special exception for localhost. Fixes #7771 --- src/etc/inc/system.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/etc/inc') diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index b6b1444..295641d 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -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); -- cgit v1.1