mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
resolved: if ipv6 is off patch hostname→address query with unspec family to ipv4
If the client never specified the address family, and IPv6 is off in the kernel, then look only for A, never for AAAA RRs. Fixes: #23951 (cherry picked from commit 0438aa57751559295fee86d1c1f176486e518455) (cherry picked from commit 4e3ae43282c0ae47b6affad44554421f0c9b9b1f) (cherry picked from commit d3763dafca3e4fa3def71096b306809897f042c5)
This commit is contained in:
parent
56575054bd
commit
53343728a6
@ -4,6 +4,7 @@
|
||||
#include "dns-domain.h"
|
||||
#include "dns-type.h"
|
||||
#include "resolved-dns-question.h"
|
||||
#include "socket-util.h"
|
||||
|
||||
DnsQuestion *dns_question_new(size_t n) {
|
||||
DnsQuestion *q;
|
||||
@ -304,6 +305,11 @@ int dns_question_new_address(DnsQuestion **ret, int family, const char *name, bo
|
||||
if (!IN_SET(family, AF_INET, AF_INET6, AF_UNSPEC))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
/* If IPv6 is off and the request has an unspecified lookup family, restrict it automatically to
|
||||
* IPv4. */
|
||||
if (family == AF_UNSPEC && !socket_ipv6_is_enabled())
|
||||
family = AF_INET;
|
||||
|
||||
if (convert_idna) {
|
||||
r = dns_name_apply_idna(name, &buf);
|
||||
if (r < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user