IP_PASSSEC(2const)

πŸ“¦
version 6.20 Β· 4 versions
, in arch rolling, nixpkgs unstable

πŸ’– IP_PASSSEC πŸ’–

okay so bestie, quick vibe check: this is a manual page from the 2const girlies, meaning it's one of those constant-flavored pages. The star of the show? IP_PASSSEC β€” receive the security context of the peer socket. Yes queen, we're getting labeled. πŸŽ€


✨ NAME ✨

IP_PASSSEC β€” receive the security context of the peer socket

πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc). The classics, fr fr. 🫢

🌸 SYNOPSIS 🌸

#include <netinet/in.h>  /* Definition of IP* constants */
#include <sys/socket.h>

int setsockopt(int sockfd, IPPROTO_IP, IP_PASSSEC,
               const int *enable, sizeof(int));
int getsockopt(int sockfd, IPPROTO_IP, IP_PASSSEC,
               int *enabled, sizeof(int));

πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the tea. If labeled IPSEC or NetLabel is configured on the sending and receiving hosts, this option enables receiving of the security context of the peer socket in an ancillary message of type SCM_SECURITY, and you get that little treat out via recvmsg(2). Obsessed with her honestly. πŸ’…

This option is supported only for UDP sockets β€” like, that's her lane, she's not crossing it. For TCP or SCTP sockets, go see SO_PEERSEC(2const) instead, bestie. 🌈

The security context returned in the SCM_SECURITY ancillary message is of the same format as the one described in SO_PEERSEC(2const). Same flavor, different girl. ✨

😭 ERRORS 😭

Not reinventing the wheel here:

πŸ¦‹ STANDARDS πŸ¦‹

Linux. That's it, that's the whole standard. 🐧

⭐ HISTORY ⭐

Linux 2.6.17. A little retro, a little iconic. πŸ‘‘

πŸ’€ CAVEATS πŸ’€

okay this part is lowkey juicy. The reuse of the SCM_SECURITY message type for the IP_PASSSEC socket option was likely a mistake β€” bestie, they fumbled it a bit. 😭 Because other IP control messages use their own numbering scheme in the IP namespace, and they often just use the socket option value as the message type.

Good news though: there is no conflict currently, since the IP option with the same value as SCM_SECURITY is IP_HDRINCL(2const) β€” and that one is never used for a control message type. So like… crisis averted, but keep that in your notes. πŸ“

fr fr, remember this is a historical design choice, not a behavior you should count on being pretty. Nobody's fixing it, but nobody's fighting it either.

πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page bestie, no notes. this was brought to you by Linux man-pages 6.20, dated 2025-11-25 β€” go off, IP_PASSSEC(2const), you ate πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms