1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.\" FIXME The following socket options are yet to be documented
.\"
.\" IP_XFRM_POLICY (2.5.48)
.\" Needs CAP_NET_ADMIN
.\"
.\" IP_IPSEC_POLICY (2.5.47)
.\" Needs CAP_NET_ADMIN
.\"
.\" IP_MINTTL (2.6.34)
.\" commit d218d11133d888f9745802146a50255a4781d37a
.\" Author: Stephen Hemminger <shemminger@vyatta.com>
.\"
.\" MCAST_JOIN_GROUP (2.4.22 / 2.6)
.\"
.\" MCAST_BLOCK_SOURCE (2.4.22 / 2.6)
.\"
.\" MCAST_UNBLOCK_SOURCE (2.4.22 / 2.6)
.\"
.\" MCAST_LEAVE_GROUP (2.4.22 / 2.6)
.\"
.\" MCAST_JOIN_SOURCE_GROUP (2.4.22 / 2.6)
.\"
.\" MCAST_LEAVE_SOURCE_GROUP (2.4.22 / 2.6)
.\"
.\" MCAST_MSFILTER (2.4.22 / 2.6)
.\"
.\" IP_UNICAST_IF (3.4)
.\" commit 76e21053b5bf33a07c76f99d27a74238310e3c71
.\" Author: Erich E. Hoover <ehoover@mines.edu>
.\"
.TH IPPROTO_IP 2const 2026-01-05 "Linux man-pages (unreleased)"
.SH NAME
IPPROTO_IP
\-
Linux IPv4 protocol socket options
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.BR "#include <netinet/in.h>" " /* Definition of " IP* " constants */"
.B #include <sys/socket.h>
.P
.BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~int\~ opt ,
.BI " const\~void\~" val [ size ],\~size_t\~ size );
.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~int\~ opt ,
.BI " void\~" val [ size ],\~size_t\~ size );
.fi
.SH DESCRIPTION
IP supports some protocol-specific socket options that can be set with
.BR setsockopt (2)
and read with
.BR getsockopt (2).
The socket option level for IP is
.BR IPPROTO_IP .
.\" or SOL_IP on Linux
.P
The following socket options are supported.
.TP
.BR IP_ADD_MEMBERSHIP (2const)
.TQ
.BR IP_ADD_SOURCE_MEMBERSHIP (2const)
.TQ
.BR IP_BIND_ADDRESS_NO_PORT (2const)
.TQ
.BR IP_BLOCK_SOURCE (2const)
.TQ
.BR IP_DROP_MEMBERSHIP (2const)
.TQ
.BR IP_DROP_SOURCE_MEMBERSHIP (2const)
.TQ
.BR IP_FREEBIND (2const)
.TQ
.BR IP_HDRINCL (2const)
.TQ
.BR IP_LOCAL_PORT_RANGE (2const)
.TQ
.BR IP_MSFILTER (2const)
.TQ
.BR IP_MTU (2const)
.TQ
.BR IP_MTU_DISCOVER (2const)
.TQ
.BR IP_MULTICAST_ALL (2const)
.TQ
.BR IP_MULTICAST_IF (2const)
.TQ
.BR IP_MULTICAST_LOOP (2const)
.TQ
.BR IP_MULTICAST_TTL (2const)
.TQ
.BR IP_NODEFRAG (2const)
.TQ
.BR IP_OPTIONS (2const)
.TQ
.BR IP_PASSSEC (2const)
.TQ
.BR IP_PKTINFO (2const)
.TQ
.BR IP_RECVERR (2const)
.TQ
.BR IP_RECVOPTS (2const)
.TQ
.BR IP_RECVORIGDSTADDR (2const)
.TQ
.BR IP_RECVTOS (2const)
.TQ
.BR IP_RECVTTL (2const)
.TQ
.BR IP_RETOPTS (2const)
.TQ
.BR IP_ROUTER_ALERT (2const)
.TQ
.BR IP_TOS (2const)
.TQ
.BR IP_TRANSPARENT (2const)
.TQ
.BR IP_TTL (2const)
.TQ
.BR IP_UNBLOCK_SOURCE (2const)
.SH ERRORS
See
.BR setsockopt (2).
See
.BR ip (7).
.TP
.B ENOPROTOOPT
.I opt
is invalid.
.\" .SH STANDARDS
.\" IP_XFRM_POLICY is Linux-specific
.\" IP_IPSEC_POLICY is a nonstandard extension, also present on some BSDs
.SH HISTORY
.TP
.B IPPROTO_IP
POSIX.1-2001.
.SH SEE ALSO
.BR setsockopt (2),
.BR ip (7)
|