Subject: Re: bug#18914: 2.0.11 REPL server listens on 127.0.0.1 but not "localhost"

From: Andy Wingo <[email-masked]>
Date: Wed, 22 Jun 2016 10:32:06 +0200

Hi,

Works for me, with Guile 2.0.11 also.  Could it be that "nc" is trying
to connect to an IPv6 address?

Andy

On Sun 02 Nov 2014 14:23, [email-masked] (Taylan Ulrich "Bayırlı/Kammer") writes:

> <[email-masked]> writes:
>
>> Seems to work fine on master
>
> I just built from the master branch to be sure and can still reproduce.
>
>> Maybe try strace, possibly limiting it with -e connect, to reveal what
>> it's actually doing.
>
> Not sure what I should be looking for, but there is no connect() call,
> no occurrence of "localhost" in the whole output, but the following
> snippet at some point:
>
> ...
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 8
> fcntl(8, F_GETFL)                       = 0x2 (flags O_RDWR)
> lseek(8, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
> setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(8, {sa_family=AF_INET, sin_port=htons(37146), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
> mmap(NULL, 8720384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f35aaf81000
> mprotect(0x7f35aaf81000, 4096, PROT_NONE) = 0
> clone(child_stack=0x7f35ab7d0ff0,
> flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
> parent_tidptr=0x7f35ab7d19d0, tls=0x7f35ab7d1700,
> child_tidptr=0x7f35ab7d19d0) = 2099
> futex(0x7fffd27a33fc, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
> ...
>
> which is also the sole occurrence of '127.0.0.1'.  Seems to come from
> `make-tcp-server-socket' in module/system/repl/server.scm where it
> passes INADDR_LOOPBACK, an integer whose value is 127.0.0.1 as a uint32,
> to bind().  I don't know at what point it's normally supposed to make
> the association with "localhost".
>
> Any further help in how to debug this is appreciated.  I have little
> knowledge of the POSIX networking API.
>
> Taylan