[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ai_flags in calls to getaddrinfo
From: |
Eli Zaretskii |
Subject: |
ai_flags in calls to getaddrinfo |
Date: |
Thu, 31 Dec 2020 17:06:23 +0200 |
On one of the systems on which I work, getaddrinfo called with
AF_INET6 fails with EAI_NODATA, for some reason. That causes
network-lookup-address-info to fail when passed 'ipv6' as the last
argument.
Adding the AI_V4MAPPED flag, as in the patch below, seems to solve the
problem. So I wonder why we don't do this in general. I'm not an
expert on DNS, so would people who know more than I do about this
please comment on whether the patch below is a good idea?
diff --git a/src/process.c b/src/process.c
index 28ab15c903..f550703c2a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4559,12 +4559,18 @@ DEFUN ("network-lookup-address-info",
Fnetwork_lookup_address_info,
memset (&hints, 0, sizeof hints);
if (EQ (family, Qnil))
- hints.ai_family = AF_UNSPEC;
+ {
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_flags = AI_ALL | AI_V4MAPPED;
+ }
else if (EQ (family, Qipv4))
hints.ai_family = AF_INET;
#ifdef AF_INET6
else if (EQ (family, Qipv6))
- hints.ai_family = AF_INET6;
+ {
+ hints.ai_family = AF_INET6;
+ hints.ai_flags = AI_V4MAPPED;
+ }
#endif
else
error ("Unsupported lookup type");
- ai_flags in calls to getaddrinfo,
Eli Zaretskii <=