| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH IPV6_ADDRFORM 2const 2025-12-02 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
IPV6_ADDRFORM |
| 8 |
\- |
| 9 |
turn an AF_INET6 socket into a socket of a different address family |
| 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_IPV6,\~IPV6_ADDRFORM, |
| 19 |
.B " &(const\~int){AF_INET},\~sizeof(int));" |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Turn an |
| 23 |
.B AF_INET6 |
| 24 |
socket into a socket of a different address family. |
| 25 |
.P |
| 26 |
Only |
| 27 |
.B AF_INET |
| 28 |
is currently supported for that. |
| 29 |
.P |
| 30 |
It is allowed only for IPv6 sockets |
| 31 |
that are connected and bound to a v4-mapped-on-v6 address. |
| 32 |
.P |
| 33 |
This is useful to pass v4-mapped sockets as file descriptors to |
| 34 |
programs that don't know how to deal with the IPv6 API. |
| 35 |
.SH ERRORS |
| 36 |
See |
| 37 |
.BR setsockopt (2). |
| 38 |
See |
| 39 |
.BR ipv6 (7). |
| 40 |
.SH SEE ALSO |
| 41 |
.BR IPPROTO_IPV6 (2const), |
| 42 |
.BR setsockopt (2), |
| 43 |
.BR ipv6 (7) |