---
name: "IP_HDRINCL"
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_HDRINCL"
---

# IP\_HDRINCL(2const)

include a user-supplied IP header

## NAME

IPPROTO\_IP - include a user-supplied IP header

## 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, IP\_HDRINCL,**                **const int \****enable***, sizeof(int));**

## DESCRIPTION

If enabled, the user supplies an IP header in front of the user data.

Valid only for **SOCK\_RAW** sockets; see [**raw**(7)](/raw/7.md) for more information.

When this flag is enabled, the values set by [**IP\_OPTIONS**(2const)](/IP_OPTIONS/2const.md), [**IP\_TTL**(2const)](/IP_TTL/2const.md), and [**IP\_TOS**(2const)](/IP_TOS/2const.md) are ignored.

## ERRORS

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

## HISTORY

Linux 2.0.

## SEE ALSO

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