IPPROTO_IP(2const)

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

✨ 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 for SOCK_RAW sockets. That's not optional, that's the rules. Go peek at raw(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:

πŸ•°οΈ 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