---
name: "IP_RECVTTL"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/IP_RECVTTL"
---

# IP\_RECVTTL(2const)

enable IP\_TTL control message

## NAME

IP\_RECVTTL - enable IP\_TTL control message

## LIBRARY

Standard C library (*libc*, *-lc*)

## 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));**

## DESCRIPTION

When this flag is set, pass a [**IP\_TTL**(2const)](/IP_TTL/2const.md) control message with the time-to-live field of the received packet as a 32 bit integer.

Not supported for **SOCK\_STREAM** sockets.

## ERRORS

See [**IPPROTO\_IP**(2const)](/IPPROTO_IP/2const.md). See [**setsockopt**(2)](/setsockopt/2.md). See [**ip**(7)](/ip/7.md).

## VERSIONS

Some BSD sockets implementations also provide an **IP\_RECVTTL** option, but an ancillary message with type **IP\_RECVTTL** is passed with the incoming packet. This is different from the [**IP\_TTL**(2const)](/IP_TTL/2const.md) option used in Linux.

## HISTORY

Linux 2.2.

## SEE ALSO

[**IPPROTO\_IP**(2const)](/IPPROTO_IP/2const.md), [**setsockopt**(2)](/setsockopt/2.md), [**ip**(7)](/ip/7.md)
