IPPROTO_IP(2const) — Linux manual page

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | ERRORS | HISTORY | SEE ALSO | COLOPHON

IPPROTO_IP(2const)                                     IPPROTO_IP(2const)

NAME         top

       IPPROTO_IP - Linux IPv4 protocol socket options

LIBRARY         top

       Standard C library (libc, -lc)

SYNOPSIS         top

       #include <netinet/in.h>  /* Definition of IP* constants */
       #include <sys/socket.h>

       int setsockopt(int sockfd, IPPROTO_IP, int opt,
                      const void val[size], size_t size);
       int getsockopt(int sockfd, IPPROTO_IP, int opt,
                      void val[size], size_t size);

DESCRIPTION         top

       IP supports some protocol-specific socket options that can be set
       with setsockopt(2) and read with getsockopt(2).  The socket option
       level for IP is IPPROTO_IP.

       The following socket options are supported.

       IP_ADD_MEMBERSHIP(2const)
       IP_ADD_SOURCE_MEMBERSHIP(2const)
       IP_BIND_ADDRESS_NO_PORT(2const)
       IP_BLOCK_SOURCE(2const)
       IP_DROP_MEMBERSHIP(2const)
       IP_DROP_SOURCE_MEMBERSHIP(2const)
       IP_FREEBIND(2const)
       IP_HDRINCL(2const)
       IP_LOCAL_PORT_RANGE(2const)
       IP_MSFILTER(2const)
       IP_MTU(2const)
       IP_MTU_DISCOVER(2const)
       IP_MULTICAST_ALL(2const)
       IP_MULTICAST_IF(2const)
       IP_MULTICAST_LOOP(2const)
       IP_MULTICAST_TTL(2const)
       IP_NODEFRAG(2const)
       IP_OPTIONS(2const)
       IP_PASSSEC(2const)
       IP_PKTINFO(2const)
       IP_RECVERR(2const)
       IP_RECVOPTS(2const)
       IP_RECVORIGDSTADDR(2const)
       IP_RECVTOS(2const)
       IP_RECVTTL(2const)
       IP_RETOPTS(2const)
       IP_ROUTER_ALERT(2const)
       IP_TOS(2const)
       IP_TRANSPARENT(2const)
       IP_TTL(2const)
       IP_UNBLOCK_SOURCE(2const)

ERRORS         top

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

       ENOPROTOOPT
              opt is invalid.

HISTORY         top

       IPPROTO_IP
              POSIX.1-2001.

SEE ALSO         top

       setsockopt(2), ip(7)

COLOPHON         top

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.18.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2026-05-24.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       man-pages@man7.org

Linux man-pages 6.18            2026-01-05             IPPROTO_IP(2const)

Pages that refer to this page: IP_ADD_MEMBERSHIP(2const)IP_ADD_SOURCE_MEMBERSHIP(2const)IP_BIND_ADDRESS_NO_PORT(2const)IP_BLOCK_SOURCE(2const)IP_DROP_MEMBERSHIP(2const)IP_DROP_SOURCE_MEMBERSHIP(2const)IP_FREEBIND(2const)IP_HDRINCL(2const)IP_LOCAL_PORT_RANGE(2const)IP_MSFILTER(2const)IP_MTU(2const)IP_MTU_DISCOVER(2const)IP_MULTICAST_ALL(2const)IP_MULTICAST_IF(2const)IP_MULTICAST_LOOP(2const)IP_MULTICAST_TTL(2const)IP_NODEFRAG(2const)IP_OPTIONS(2const)IP_PASSSEC(2const)IP_PKTINFO(2const)IP_RECVERR(2const)IP_RECVOPTS(2const)IP_RECVORIGDSTADDR(2const)IP_RECVTOS(2const)IP_RECVTTL(2const)IP_RETOPTS(2const)IP_ROUTER_ALERT(2const)IP_TOS(2const)IP_TRANSPARENT(2const)IP_TTL(2const)IP_UNBLOCK_SOURCE(2const)ip(7)