IP_HDRINCL(2const)

IP_HDRINCL2const

Include a user-supplied ip header

Usage

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

Library

Standard C library (libc, -lc)

Overview

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

Valid only for SOCK_RAW sockets; see raw(7) for more information.

When this flag is enabled, the values set by IP_OPTIONS(2const), IP_TTL(2const), and IP_TOS(2const) are ignored.

Errors

See IPPROTO_IP(2const). See setsockopt(2). See ip(7).

History

Linux 2.0.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.