[erlang-questions] : Broken ipv6 behavior?

Raimo Niskanen <>
Thu Apr 17 10:03:29 CEST 2008


On Wed, Apr 16, 2008 at 11:50:07AM -0700, Matthew Dempsky wrote:
> On Wed, Apr 9, 2008 at 1:00 PM, Mikael Magnusson <> wrote:
> >  It looks beautiful on Debian Lenny/Sid GNU/Linux, which contains my IPv6
> >  patch:
> 
> I applied the patch attached to
> http://www.erlang.org/pipermail/erlang-questions/2006-November/024099.html
> (needed to change www2 to www in the URL), but it doesn't work for me
> on OS X.
> 

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?

> OS X has getipnodebyname so the previous #ifdef runs first, but it
> returns the wrong results (e.g., not finding ipv6.google.com and
> returning an IPv4-mapped address instead of a native IPv6 address for
> www.kame.net).  If I move the gethostbyname2 block first, then it
> works fine for me.

It is strange getipnodebyname works so differently from gethostbyname2
on OS X. They should do the same job. 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).

So maybe gethostbyname2 returns IPv6 records even though your
machine has no external IPv6 interface?

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