News for hackers. Stuff that matters.
Re:Internet Draft: Let 'localhost' be localhost by p1mrx on Monday August 07, 2017 @07:22PM (#14952109)
Ideally, a server binding to "localhost" should create a listening socket for each of its IP addresses (e.g. 127.0.0.1 and ::1), and a client connecting to "localhost" should try each IP address in order, until one succeeds.

But a lot of standard libraries (including parts of Java and Go) get this wrong, and pick exactly one IP address arbitrarily. When you combine a buggy client with a buggy server, and their preferences for IPv4/IPv6 disagree, then all hell breaks loose.

These are the open bugs I'm aware of:

https://bugs.openjdk.java.net/browse/JDK-8170568

https://github.com/golang/go/issues/9334

Re:Internet Draft: Let 'localhost' be localhost by fulafel on Monday August 07, 2017 @11:52PM (#14954040)
Or use a single socket for both protocols (set the IPV6_V6ONLY socket option to false).
Re:Internet Draft: Let 'localhost' be localhost by p1mrx on Tuesday August 08, 2017 @02:50AM (#14955134)
That works when binding to :: (all interfaces), but it's irrelevant when binding to "localhost", because you can only bind one address per socket.
Re:Internet Draft: Let 'localhost' be localhost by fulafel on Wednesday August 09, 2017 @12:10AM (#14965481)
Yes, I thought it worked for ::1 too but you're right.
Re:Internet Draft: Let 'localhost' be localhost by user5994461 on Tuesday August 08, 2017 @04:46AM (#14955820)
An interface on linux has only one ip address.

The "localhost" interface will either designate the ipv4 127.0.0.1 interface or the ipv6 ::1 interface. That's the realm of undefined behavior and system specifics.

This whole IETF draft looks like a mess. They should reserve the names localhost4 and localhost6.

Re:Internet Draft: Let 'localhost' be localhost by pilif on Tuesday August 08, 2017 @05:05AM (#14955909)
> An interface on linux has only one ip address.

absolutely not true. Neither for IPv4 nor IPv6, where it's even the default to have a multitude of addresses on an interface.

> The "localhost" interface will either designate the ipv4 127.0.0.1 interface or the ipv6 ::1 interface. That's the realm of undefined behavior and system specifics.

no it won't. My loopback (lo) interface has both 127.0.0.1 and ::1 as its addresses.

Re:Internet Draft: Let 'localhost' be localhost by __david__ on Tuesday August 08, 2017 @06:09AM (#14956198)
> An interface on linux has only one ip address.

Eh?

    $ ifconfig lo
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
Re:Internet Draft: Let 'localhost' be localhost by justinclift on Tuesday August 08, 2017 @05:45AM (#14956085)
> An interface on linux has only one ip address.

Just to point out, while the behaviour of any one OS is a useful data point for the discussion, it's not super useful to say "because OS 'foo' does things in a certain way, a well used programming language should limit it's design to that OS's way of doing things." :)

Hmmm, I guess I'm trying to say that (at least) Go should be fairly OS agnostic about this.