diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-03-05 18:47:10 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-03-05 20:51:43 +0100 |
commit | 747b596ff8276cfad977423c476ba6f00e29594a (patch) | |
tree | 4c016401ed1cb07027a9b5ad0f75fcdad1800425 /src | |
parent | socket-util: add helper for checking if IPv6 is enabled (diff) | |
download | systemd-747b596ff8276cfad977423c476ba6f00e29594a.tar.xz systemd-747b596ff8276cfad977423c476ba6f00e29594a.zip |
resolved: never return ::1 when localhost or local hostname is resolved while IPv6 is off in the kernel
Fixes: #18812
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve/resolved-dns-synthesize.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-synthesize.c b/src/resolve/resolved-dns-synthesize.c index 23c9ba14a9..d4a4be71b0 100644 --- a/src/resolve/resolved-dns-synthesize.c +++ b/src/resolve/resolved-dns-synthesize.c @@ -81,7 +81,7 @@ static int synthesize_localhost_rr(Manager *m, const DnsResourceKey *key, int if return r; } - if (IN_SET(key->type, DNS_TYPE_AAAA, DNS_TYPE_ANY)) { + if (IN_SET(key->type, DNS_TYPE_AAAA, DNS_TYPE_ANY) && socket_ipv6_is_enabled()) { _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL; rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_AAAA, dns_resource_key_name(key)); @@ -234,7 +234,7 @@ static int synthesize_system_hostname_rr(Manager *m, const DnsResourceKey *key, .address.in.s_addr = htobe32(0x7F000002), }; - if (IN_SET(af, AF_INET6, AF_UNSPEC)) + if (IN_SET(af, AF_INET6, AF_UNSPEC) && socket_ipv6_is_enabled()) buffer[n++] = (struct local_address) { .family = AF_INET6, .ifindex = dns_synthesize_ifindex(ifindex), |