IP_RECVTTL(2const)
β¨ IP_RECVTTL(2const) β¨
okay bestie, so this one lives in the (2const) girlies section of the Linux man-pages, and it's all about flagging β literally, it's a socket option constant π
π« NAME π«
IP_RECVTTL β the flag that says "yes queen, enable that IP_TTL control message" π
π LIBRARY π
Standard C library (libc, -lc) β the usual girlies, nothing new here, she's standard for a reason π«Ά
πΈ SYNOPSIS πΈ
#include <netinet/in.h> /* Definition of IP* constants */
#include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, int opt,
const int *enable, sizeof(int));
look at that #include <netinet/in.h> up top β that's where all the IP* constants live, iykyk π
π DESCRIPTION π
so when this flag is set (yes, set, not unset β we're turning things ON around here), the kernel will pass a IP_TTL(2const) control message your way, carrying the time-to-live field of the received packet as a 32 bit integer β¨
bestie warning π¨ β this is not supported for SOCK_STREAM sockets. if you're on a stream socket, she simply will not serve. sorry babe π
π¦ ERRORS π¦
like, go read the OGs:
IPPROTO_IP(2const)β for the protocol-level teasetsockopt(2)β for the socket-option teaip(7)β for the IP-layer tea π
π₯ VERSIONS π₯
okay this is the important plot twist so listen up diva: some BSD sockets implementations also provide an IP_RECVTTL option, BUT over there an ancillary message with type IP_RECVTTL gets passed along with the incoming packet π
that is different from the IP_TTL(2const) option used in Linux β so if you port code across and it's giving weird vibes, that's why. no cap π
π HISTORY π
Linux 2.2 β she's vintage, she's iconic, she's been here since 2.2 πβ
π SEE ALSO π
and that's the whole page, bestie π this little icon came straight out of Linux man-pages 6.20, dated 2025-11-25 β go slay some sockets with your TTL values, mwah πππ¦
π¦ 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