tst_v6only_get - Get the value of IPV6_V6ONLY option from kernel
To check whether the IPV6_V6ONLY option can be used with getsockopt().
./tst_v6only_get [-tooloption ...] -tooloption : v6api tool option
1. Get the default value of IPV6_V6ONLY option 2. Check A: The default value of IPV6_V6ONLY option is 0 3. Set the IPV6_V6ONLY option to 1 4. Get the value of IPV6_V6ONLY option 5. Check B: The value of IPV6_V6ONLY option is 1
None
RFC 3493
5.3 IPV6_V6ONLY option for AF_INET6 Sockets
This socket option restricts AF_INET6 sockets to IPv6 communications only. As stated in section <3.7 Compatibility with IPv4 Nodes>, AF_INET6 sockets may be used for both IPv4 and IPv6 communications. Some applications may want to restrict their use of an AF_INET6 socket to IPv6 communications only. For these applications the IPV6_V6ONLY socket option is defined. <B>When this option is turned on, the socket can be used to send and receive IPv6 packets only.</B> This is an IPPROTO_IPV6 level option. This option takes an int value. This is a boolean option. By default this option is turned off.
Here is an example of setting this option:
int on = 1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof(on)) == -1) perror("setsockopt IPV6_V6ONLY"); else printf("IPV6_V6ONLY set\n");
Note - This option has no effect on the use of IPv4 Mapped addresses which enter a node as a valid IPv6 addresses for IPv6 communications as defined by Stateless IP/ICMP Translation Algorithm (SIIT) [5].
An example use of this option is to allow two versions of the same server process to run on the same port, one providing service over IPv6, the other providing the same service over IPv4.