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

From: Robert Pluim <[email-masked]>
Date: Fri, 25 Jan 2019 15:04:38 +0100

Ernesto Alfonso <[email-masked]> writes:

>     $ netstat -tlpn | grep 1959
>     tcp6       0      0 ::1:1959                :::*                    LISTEN      1990/stumpwm        
>
>
>     ELISP> (make-network-process :host 'local
>                                  :service 1959
>                                  :name "test")
>     *** Eval error ***  make client process failed: Connection
>     refused, :host, local, :service, 1959, :name, test

Here emacs tries an AF_UNSPEC connection to 127.0.0.1

>     ELISP> (make-network-process :host 'local
>                                  :service 1959
>                                  :name "test"
>                                  :family 'ipv6)
>     *** Eval error ***  127.0.0.1/1959 Address family for hostname
>                                  not supported

Here it tries an AF_INET6 connection to 127.0.0.1, which obviously isnʼt
going to work. Itʼs a deliberate choice based on 
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6781>

>     ELISP> (make-network-process :host "localhost"
>                                  :service 1959
>                                  :name "test")
>     #<process test>

And here we use AF_UNSPEC, and loop through whatever getaddrinfo
returns, so your IPv6 "localhost" works.

I guess if we make a change so that :host 'local means the same as
:host "localhost", your use case will work, but I worry about what
else that would break (and itʼs the opposite of bug#6781). Perhaps the
minimal change would be to use "::1" when specifying :family 'ipv6?

Robert