summaryrefslogtreecommitdiffstats
path: root/test/units/testsuite-75.sh
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2023-07-10 10:00:00 +0200
committerDmitry V. Levin <ldv@strace.io>2023-07-14 15:13:53 +0200
commit0ff8f2a33a8f7c225860388faf43fa83f106cfe3 (patch)
tree59fb585580d9a7b3f4cfce180761f94a0c720115 /test/units/testsuite-75.sh
parentresolved: keep track of first names listed for each address in /etc/hosts (diff)
downloadsystemd-0ff8f2a33a8f7c225860388faf43fa83f106cfe3.tar.xz
systemd-0ff8f2a33a8f7c225860388faf43fa83f106cfe3.zip
resolved: fix the canonical name returned by hosts lookup by address
In etc_hosts_lookup_by_address(), make sure the canonical name of the given address is returned first in the list of names that address resolves to. Resolves: #25088
Diffstat (limited to '')
-rwxr-xr-xtest/units/testsuite-75.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/units/testsuite-75.sh b/test/units/testsuite-75.sh
index ef0e42a81d..504d1038e5 100755
--- a/test/units/testsuite-75.sh
+++ b/test/units/testsuite-75.sh
@@ -160,10 +160,12 @@ ip link del hoge.foo
### SETUP ###
# Configure network
hostnamectl hostname ns1.unsigned.test
-{
- echo "10.0.0.1 ns1.unsigned.test"
- echo "fd00:dead:beef:cafe::1 ns1.unsigned.test"
-} >>/etc/hosts
+cat >>/etc/hosts <<EOF
+10.0.0.1 ns1.unsigned.test
+fd00:dead:beef:cafe::1 ns1.unsigned.test
+
+127.128.0.5 localhost5 localhost5.localdomain localhost5.localdomain4 localhost.localdomain5 localhost5.localdomain5
+EOF
mkdir -p /etc/systemd/network
cat >/etc/systemd/network/dns0.netdev <<EOF
@@ -293,6 +295,11 @@ run getent -s myhostname hosts localhost
grep -qE "^127\.0\.0\.1\s+localhost" "$RUN_OUT"
enable_ipv6
+# Issue: https://github.com/systemd/systemd/issues/25088
+run getent -s resolve hosts 127.128.0.5
+grep -qEx '127\.128\.0\.5\s+localhost5(\s+localhost5?\.localdomain[45]?){4}' "$RUN_OUT"
+[ "$(wc -l <"$RUN_OUT")" -eq 1 ]
+
: "--- Basic resolved tests ---"
# Issue: https://github.com/systemd/systemd/issues/22229
# PR: https://github.com/systemd/systemd/pull/22231