[erlang-questions] : Broken ipv6 behavior?

Matthew Dempsky <>
Thu Apr 17 10:18:06 CEST 2008


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.)

>  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).

On OS X, AI_DEFAULT is defined to (AI_V4MAPPED_CFG | AI_ADDRCONFIG).

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.

>  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.



More information about the erlang-questions mailing list