unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ai_flags in calls to getaddrinfo
@ 2020-12-31 15:06 Eli Zaretskii
  2020-12-31 22:40 ` Robin Tarsiger
  2021-01-01 10:59 ` ai_flags in calls to getaddrinfo Lars Ingebrigtsen
  0 siblings, 2 replies; 50+ messages in thread
From: Eli Zaretskii @ 2020-12-31 15:06 UTC (permalink / raw)
  To: emacs-devel

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");



^ permalink raw reply related	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2021-01-12 18:06 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-31 15:06 ai_flags in calls to getaddrinfo Eli Zaretskii
2020-12-31 22:40 ` Robin Tarsiger
2021-01-01  7:43   ` Eli Zaretskii
2021-01-01 11:40     ` Robin Tarsiger
2021-01-01 12:04       ` Robin Tarsiger
2021-01-01 12:48       ` Eli Zaretskii
2021-01-02  0:19         ` Robin Tarsiger
2021-01-03 16:00   ` Eli Zaretskii
2021-01-11 10:47     ` ai_flags in calls to getaddrinfo, broader call for reproducibility check Robin Tarsiger
2021-01-11 12:42       ` Robert Pluim
2021-01-11 15:25       ` Eli Zaretskii
2021-01-11 15:47         ` Robert Pluim
2021-01-11 16:44           ` Eli Zaretskii
2021-01-11 17:07             ` Robin Tarsiger
2021-01-11 17:53               ` Robert Pluim
2021-01-11 18:30                 ` Robin Tarsiger
2021-01-11 18:42                   ` Robert Pluim
2021-01-11 19:28                     ` Stefan Monnier
2021-01-11 20:12                       ` Robert Pluim
2021-01-11 20:41                         ` Eli Zaretskii
2021-01-11 20:55                           ` Stefan Monnier
2021-01-11 21:02                           ` Robert Pluim
2021-01-11 21:09                             ` Lars Ingebrigtsen
2021-01-11 21:15                               ` Robert Pluim
2021-01-11 22:42                                 ` Lars Ingebrigtsen
2021-01-12  9:40                                   ` Robert Pluim
2021-01-12 12:49                                     ` Lars Ingebrigtsen
2021-01-12 13:04                                       ` Robert Pluim
2021-01-12 14:08                                         ` Lars Ingebrigtsen
2021-01-12 14:29                                           ` Robert Pluim
2021-01-12 18:06                                             ` Lars Ingebrigtsen
2021-01-12 15:14                                       ` Stefan Monnier
2021-01-12 15:45                                         ` Eli Zaretskii
2021-01-12  3:29                             ` Eli Zaretskii
2021-01-11 20:46                 ` Eli Zaretskii
2021-01-11 20:56                   ` Robert Pluim
2021-01-12 15:01                     ` Eli Zaretskii
2021-01-12 15:36                       ` Robert Pluim
2021-01-12 15:42                       ` Eli Zaretskii
2021-01-12 16:00                         ` Robert Pluim
2021-01-12 16:05                           ` Eli Zaretskii
2021-01-12 17:56                             ` Robert Pluim
2021-01-11 19:32           ` Basil L. Contovounesios
2021-01-11 20:19             ` Robert Pluim
2021-01-11 23:57           ` Andy Moreton
2021-01-12  9:44             ` Robert Pluim
2021-01-12 11:56               ` tomas
2021-01-01 10:59 ` ai_flags in calls to getaddrinfo Lars Ingebrigtsen
2021-01-01 12:50   ` Eli Zaretskii
2021-01-02  5:40     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).