[erlang-questions] : : Broken ipv6 behavior?

Raimo Niskanen <>
Thu Apr 17 11:48:33 CEST 2008

On Thu, Apr 17, 2008 at 01:18:06AM -0700, Matthew Dempsky wrote:
> On Thu, Apr 17, 2008 at 1:03 AM, Raimo Niskanen
> <> wrote:
> >  That patch uses gethostbyname2, which is just as or even more obsoleted
> >  than getipnodebyname. I wonder when I (finally) have added
> >  getaddrinfo support if there is need for gethostbyname2 support too?
> I tested that patch because the author suggested it worked for him on
> Linux, and it's a relatively non-intrusive change.  (I don't
> particularly care what functions are used for IPv6 support as long as
> they work.)

I am working on getaddrinfo support. When it seems to work I will publish
a source patch for OTP_R12B-2 and then start on the test cases,
to get feedback for a final version.

> >  It is strange getipnodebyname works so differently from gethostbyname2
> >  on OS X. They should do the same job.
> Yeah.
> >  The flags to getipnodebyname
> >  are (AF_V4MAPPED | AI_ADDRINFO), which means that it should return
> >  mapped v4 addresses only if no IPv6 addresses are found and
> >  that it should return IPv6 addresses only if the machine runs
> >  IPv6 ("Only if IPv6 configured" according to Solaris 10 headers,
> >  "Only if there is an interface on the host that is not a loopback
> >  interface that has an IPv6 address" according to Steven's
> >  Unix Network Programming).
> I tested various a few different flags options, and ipv6.google.com
> would only resolve when AI_V4MAPPED(_CFG) was *not* set.  0 and
> AI_ADDRCONFIG both returned an IPv6 hostent structure.

The header files on MacOS X 10.5.2 says:
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */

Would that indicate that the kernel does not support
mapped IPv4 addresses or what does it not support?

Is this a MacOS X support question?

Or just wait for the getaddrinfo patch and see if it works better.

> >  So maybe gethostbyname2 returns IPv6 records even though your
> >  machine has no external IPv6 interface?
> No, every test I have run regarding Erlang and IPv6 in this thread has
> involved a machine with a globally routable IPv6 address configured.
> _______________________________________________
> erlang-questions mailing list
> http://www.erlang.org/mailman/listinfo/erlang-questions


/ Raimo Niskanen, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list