| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH IP_PASSSEC 2const 2025-11-25 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
IP_PASSSEC |
| 8 |
\- |
| 9 |
receive the security context of the peer socket |
| 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,\~IP_PASSSEC, |
| 19 |
.BI " const\~int\~*" enable ,\~sizeof(int)); |
| 20 |
.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_PASSSEC, |
| 21 |
.BI " int\~*" enabled ,\~sizeof(int)); |
| 22 |
.fi |
| 23 |
.SH DESCRIPTION |
| 24 |
If labeled IPSEC or NetLabel is configured on the sending and receiving |
| 25 |
hosts, this option enables receiving of the security context of the peer |
| 26 |
socket in an ancillary message of type |
| 27 |
.B SCM_SECURITY |
| 28 |
retrieved using |
| 29 |
.BR recvmsg (2). |
| 30 |
.P |
| 31 |
This option is supported only for UDP sockets; |
| 32 |
for TCP or SCTP sockets, |
| 33 |
see |
| 34 |
.BR SO_PEERSEC (2const). |
| 35 |
.P |
| 36 |
The security context returned in the |
| 37 |
.B SCM_SECURITY |
| 38 |
ancillary message |
| 39 |
is of the same format as the one described in |
| 40 |
.BR SO_PEERSEC (2const). |
| 41 |
.SH ERRORS |
| 42 |
See |
| 43 |
.BR IPPROTO_IP (2const). |
| 44 |
See |
| 45 |
.BR setsockopt (2). |
| 46 |
See |
| 47 |
.BR ip (7). |
| 48 |
.SH STANDARDS |
| 49 |
Linux. |
| 50 |
.SH HISTORY |
| 51 |
Linux 2.6.17. |
| 52 |
.\" commit 2c7946a7bf45ae86736ab3b43d0085e43947945c |
| 53 |
.SH CAVEATS |
| 54 |
The reuse of the |
| 55 |
.B SCM_SECURITY |
| 56 |
message type for the |
| 57 |
.B IP_PASSSEC |
| 58 |
socket option was likely a mistake, since other IP control messages use |
| 59 |
their own numbering scheme in the IP namespace and often use the |
| 60 |
socket option value as the message type. |
| 61 |
There is no conflict currently since the IP option with the same value as |
| 62 |
.B SCM_SECURITY |
| 63 |
is |
| 64 |
.BR IP_HDRINCL (2const) |
| 65 |
and this is never used for a control message type. |
| 66 |
.SH SEE ALSO |
| 67 |
.BR IPPROTO_IP (2const), |
| 68 |
.BR setsockopt (2), |
| 69 |
.BR ip (7) |