IPPROTO_IP(2const)
β¨ IPPROTO_IP(2const) β¨
okay bestie, gather round, because this is a 2const page from the Linux man-pages (version 6.20, dated 2025-11-25, mwah π) and it's short but it is so important, no cap.
π NAME π
IPPROTO_IP β include a user-supplied IP header π
Like, you're the main character and you're writing the IP header yourself. Iconic behaviour, honestly.
π LIBRARY π
Standard C library (libc, -lc). The classic. The blueprint. Periodt.
πΈ SYNOPSIS πΈ
#include <netinet/in.h> /* Definition of IP* constants */
#include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, IP_HDRINCL,
const int *enable, sizeof(int));
π DESCRIPTION π
So here's the vibe: if this gets enabled, the user supplies an IP header in front of the user data. You're not letting the kernel do the header thing for you β you're doing it yourself, and honestly? slay.
Heads up bestie, this is valid only forSOCK_RAWsockets. That's not optional, that's the rules. Go peek atraw(7)for more info on that whole situation. π¦
And here's the part you need to know, because it will lowkey ruin your day otherwise: when this flag is enabled, the values set by IP_OPTIONS(2const), IP_TTL(2const), and IP_TOS(2const) are ignored. Just β fully ignored. Not merged, not consulted, not even a little. You set them, the kernel looks away, the header is yours. π«Ά
π ERRORS π
Not gonna reinvent the wheel here:
- See
IPPROTO_IP(2const). - See
setsockopt(2). - See
ip(7).
π°οΈ HISTORY π°οΈ
Linux 2.0. Ancient. Elder emo of socket options, fr fr. π₯
π SEE ALSO π
and that's the whole page, bestie β short, sweet, and absolutely carrying your raw sockets on its back π
Linux man-pages 6.20 Β· 2025-11-25 β mwah, go forth and build your own headers πβ¨
π¦ 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