| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH IPV6_V6ONLY 2const 2026-01-05 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
IPV6_V6ONLY |
| 8 |
\- |
| 9 |
restrict to IPv6 only |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <netinet/in.h>" " /* Definition of " IP* " constants */" |
| 16 |
.B #include <sys/socket.h> |
| 17 |
.P |
| 18 |
.BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IPV6_V6ONLY, |
| 19 |
.BI " const\~int\~*" enable ,\~sizeof(int)); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
.\" See RFC 3493 |
| 23 |
If this flag is set to true (nonzero), |
| 24 |
then the socket is restricted |
| 25 |
to sending and receiving IPv6 packets only. |
| 26 |
In this case, |
| 27 |
an IPv4 and an IPv6 application can bind |
| 28 |
to a single port at the same time. |
| 29 |
.P |
| 30 |
If this flag is set to false (zero), |
| 31 |
then the socket can be used to send and receive packets |
| 32 |
to and from an IPv6 address or an IPv4-mapped IPv6 address. |
| 33 |
.P |
| 34 |
The default value for this flag is defined by the contents of the file |
| 35 |
.IR /proc/sys/net/ipv6/bindv6only . |
| 36 |
The default value for that file is 0 (false). |
| 37 |
.\" FLOWLABEL_MGR, FLOWINFO_SEND |
| 38 |
.SH ERRORS |
| 39 |
See |
| 40 |
.BR IPPROTO_IPV6 (2const). |
| 41 |
See |
| 42 |
.BR setsockopt (2). |
| 43 |
See |
| 44 |
.BR ipv6 (7). |
| 45 |
.SH HISTORY |
| 46 |
POSIX.1-2001, |
| 47 |
Linux 2.4.21, Linux 2.6. |
| 48 |
.SH SEE ALSO |
| 49 |
.BR IPPROTO_IPV6 (2const), |
| 50 |
.BR setsockopt (2), |
| 51 |
.BR ipv6 (7) |