aboutsummaryrefslogtreecommitdiffstats
path: root/community/cloud-init/02-hosts-template-fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/cloud-init/02-hosts-template-fix.patch')
-rw-r--r--community/cloud-init/02-hosts-template-fix.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/community/cloud-init/02-hosts-template-fix.patch b/community/cloud-init/02-hosts-template-fix.patch
new file mode 100644
index 0000000000..d6e04e15a0
--- /dev/null
+++ b/community/cloud-init/02-hosts-template-fix.patch
@@ -0,0 +1,35 @@
+From: Dermot Bradley <dermot_bradley@yahoo.com>
+Date: Sat, 21 Nov 2020 16:52 +0000
+Subject: [PATCH] cloud-init: Change order of entries in /etc/hosts
+
+The Alpine /etc/hosts template results in a file where the long form of
+names (including localhost) come before the short form. This means that
+when running tools like 'netstat' and 'ss' which convert IP address to
+names that their output will show 'localhost.localdomain' rather than
+'localhost.' This patch swaps the order of the short and long form names
+so such utils will show the short form name.
+
+---
+
+diff -aur a/templates/hosts.alpine.tmpl b/templates/hosts.alpine.tmpl
+--- a/templates/hosts.alpine.tmpl
++++ b/templates/hosts.alpine.tmpl
+@@ -13,13 +13,13 @@
+ # /etc/cloud/cloud.cfg or cloud-config from user-data
+ #
+ # The following lines are desirable for IPv4 capable hosts
+-127.0.1.1 {{fqdn}} {{hostname}}
+-127.0.0.1 localhost.localdomain localhost
+-127.0.0.1 localhost4.localdomain4 localhost4
++127.0.1.1 {{hostname}} {{fqdn}}
++127.0.0.1 localhost localhost.localdomain
++127.0.0.1 localhost4 localhost4.localdomain4
+
+ # The following lines are desirable for IPv6 capable hosts
+-::1 {{fqdn}} {{hostname}}
+-::1 localhost6.localdomain6 localhost6
++::1 {{hostname}} {{fqdn}}
++::1 localhost6 localhost6.localdomain6
+
+ fe00::0 ip6-localnet
+ ff00::0 ip6-mcastprefix