[erlang-questions] IPV6_V6ONLY

Raimo Niskanen <>
Tue Aug 24 09:56:31 CEST 2010

On Mon, Aug 23, 2010 at 07:11:42PM +0200, Per Hedeland wrote:
> Hi,
> On Linux (and maybe some others), by default, when binding a socket to
> the IPv6 wildcard address, the socket accepts both IPv6 and IPv4, the
> latter in the form of IPv4-mapped IPv6. Trying to bind another socket
> with the same port and the IPv4 wildcard results in EADDRINUSE.
> On *BSD, by default (and always on Windows I believe), the situation is
> the opposite - the IPv6-wildcard socket accepts only IPv6, and you need
> to bind another socket for IPv4 if you want to support both.
> I believe there is some consensus in the networking community that the
> first behaviour is "bad" for various reasons. Be that as it may, it is
> unlikely to change, and it seems applications tend to ensure the second
> behavior by means of unconditionally using the IPV6_V6ONLY socket option
> in order to get consistent behavior across OSes (and avoid the "badness").

It seems the situation has changed since Stevens' Unix Network Programming
- The Sockets Networking API, third edition. There it seems one of the strong
points of a IPv6 socket is that it accepts IPv4 connections _unless_ the
IPV6_V6ONLY socket option is set.

Where can these network community discussions be followed where
can one find a motivation to why FreeBSD has diverged from Stevens' book
(if that is the case)...

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

Since Linux (and previously Solaris) are the chief platforms for Erlang/OTP
I would prefer trying to always get the Linux behaviour, if possible.

> --Per Hedeland
> ________________________________________________________________
> 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