Subject: Re: bug#34193: 26.1; make-network-proces :host 'local fails with ipv6

From: Robert Pluim <[email-masked]>
Date: Sat, 26 Jan 2019 12:04:56 +0100

Robert Pluim <[email-masked]> writes:

> Perhaps the minimal change would be to use "::1" when specifying
> :family 'ipv6?

That would be this patch, which fixes this particular use case, and
shouldn't break anything else.

diff --git i/src/process.c w/src/process.c
index c0741403b5..72351db3e6 100644
--- i/src/process.c
+++ w/src/process.c
@@ -3983,14 +3983,24 @@ usage: (make-network-process &rest ARGS)  */)
 #ifdef HAVE_LOCAL_SOCKETS
       if (family != AF_LOCAL)
 #endif
-	host = build_string ("127.0.0.1");
+        {
+        if (family == AF_INET6)
+          host = build_string ("::1");
+        else
+          host = build_string ("127.0.0.1");
+        }
     }
   else
     {
       if (EQ (host, Qlocal))
+        {
 	/* Depending on setup, "localhost" may map to different IPv4 and/or
 	   IPv6 addresses, so it's better to be explicit (Bug#6781).  */
-	host = build_string ("127.0.0.1");
+        if (family == AF_INET6)
+          host = build_string ("::1");
+        else
+          host = build_string ("127.0.0.1");
+        }
       CHECK_STRING (host);
     }