From 7028c8e756129cbb7898798fc81a16de3625709f Mon Sep 17 00:00:00 2001
From: Raimo Niskanen
Date: Wed, 24 Oct 2012 15:36:22 +0200
Subject: kernel: Document socket option ipv6_v6only
---
lib/kernel/doc/src/inet.xml | 62 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
(limited to 'lib/kernel/doc')
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml
index 32b4a429dd..d0ed26a18d 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -520,6 +520,68 @@ fe80::204:acff:fe17:bf38
+ -
+
+ Restricts the socket to only use IPv6, prohibiting any
+ IPv4 connections. This only applicable for
+ IPv6 sockets (option inet6).
+
+
+ On most platforms this option has to be set on the socket
+ before associating it to an address. Therefore it is only
+ reasonable to give it when creating the socket and not
+ to use it when calling the function
+ (setopts/2)
+ containing this description.
+
+
+ The behaviour of a socket with this socket option set to
+ true is becoming the only portable one. The original
+ idea when IPv6 was new of using IPv6 for all traffic
+ is now not recommended by FreeBSD (you can use
+ {ipv6_v6only,false} to override the recommended
+ system default value),
+ forbidden by OpenBSD (the supported GENERIC kernel)
+ and impossible on Windows (that has separate
+ IPv4 and IPv6 protocol stacks). Most Linux distros
+ still have a system default value of false.
+ This policy shift among operating systems towards
+ separating IPv6 from IPv4 traffic has evolved since
+ it gradually proved hard and complicated to get
+ a dual stack implementation correct and secure.
+
+
+ On some platforms the only allowed value for this option
+ is true, e.g. OpenBSD and Windows. Trying to set
+ this option to false when creating the socket
+ will in this case fail.
+
+
+ Setting this option on platforms where it does not exist
+ is ignored and getting this option with
+ getopts/2
+ returns no value. On Windows the option acually does
+ not exist but it is emulated as being a read-only option
+ with the value true.
+
+
+ So it boils down to that setting this option to true
+ when creating a socket will never fail except possibly
+ (at the time of this writing) on a platform where you
+ have customized the kernel to only allow false,
+ which might be doable (but weird) on e.g. OpenBSD.
+
+
+ If you read back the option value using
+ getopts/2
+ and get no value the option does not exist in the host OS
+ and all bets are off regarding the behaviour of both
+ an IPv6 and an IPv4 socket listening on the same port
+ as well as for an IPv6 socket getting IPv4 traffic.
+
+
+