[erlang-questions] IPV6_V6ONLY

Raimo Niskanen <>
Tue Aug 24 10:28:20 CEST 2010


On Mon, Aug 23, 2010 at 04:15:37PM -0700, Gé Weijers wrote:
> 
> 
> On Mon, 23 Aug 2010, Per Hedeland wrote:
> 
> >Since one strong point of Erlang/OTP is to as far as possible isolate
> >the Erlang programmer from these annoying differences between OSes,
> >could it be considered to make inet_drv always apply IPV6_V6ONLY (if it
> >exists) for IPv6 sockets?
> 
> One way to implement a protocol-agnostic client and server in C on a Posix 
> system is to use the getaddrinfo() standard library routine, which 
> produces a list of parameters that can be fed into socket() + bind() for 
> servers, and socket() + connect() for clients. On the server size you may 
> end up with multiple sockets to listen to.

They probably do not solve the problem at hand since when calling
getaddrinfo("", "www", {AI_PASSIVE,AF_UNSPEC,SOCK_STREAM,0,...} you might
get separate addrinfo structures for IPv6 and IPv4 back, even though
creating only a listening socket for IPv6 (that can handle IPv4)
is the "right" thing to do on the OS. This problem is actually
mentioned in Stevens' Unix Network Programming 3:rd edition,
section 11.6, towards the end in a fineprint note.

> 
> getaddrinfo() and getnameinfo() or simular routines seem to be missing 
> from Erlang's resolver implementation. Any particular reason why?

We have focused on making the old functions work good enough.
In fact the native resolver in Erlang/OTP use getaddrinfo() and
getnameinfo() internally when calling the OS resolver.

Implementing getaddrinfo() and getnameinfo() would also demand
a rework of all Erlang/OTP resolver parts to mimic their
behaviour even when they do not exist in the underlying OS.

> 
> Ge'  (utter Erlang newbie)
> 
> >
> >--Per Hedeland
> >
> >________________________________________________________________
> >erlang-questions (at) erlang.org mailing list.
> >See http://www.erlang.org/faq.html
> >To unsubscribe; mailto:
> >
> >
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


More information about the erlang-questions mailing list