diff options
Diffstat (limited to 'man/man2const')
33 files changed, 2069 insertions, 0 deletions
diff --git a/man/man2const/IPPROTO_IP.2const b/man/man2const/IPPROTO_IP.2const new file mode 100644 index 0000000000..eedfc24051 --- /dev/null +++ b/man/man2const/IPPROTO_IP.2const @@ -0,0 +1,141 @@ +.\" 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 (date) "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) +.TQ +.BR SO_PEERSEC (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 SEE ALSO +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_ADD_MEMBERSHIP.2const b/man/man2const/IP_ADD_MEMBERSHIP.2const new file mode 100644 index 0000000000..aac81abf1a --- /dev/null +++ b/man/man2const/IP_ADD_MEMBERSHIP.2const @@ -0,0 +1,50 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_ADD_MEMBERSHIP 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_ADD_MEMBERSHIP +\- +join a multicast group +.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,\~IP_ADD_MEMBERSHIP, +.BI " const\~struct\~ip_mreqn\~*" val ,\~sizeof(struct\~ip_mreqn)); +.fi +.SH DESCRIPTION +Join a multicast group. +.P +.B IP_ADD_MEMBERSHIP +is valid only for +.BR setsockopt (2). +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.TP +.B EINVAL +.I val->imr_multiaddr +is not a valid multicast address. +.SH HISTORY +Linux 1.2. +.P +For compatibility, the old +.I ip_mreq +structure is still supported. +The kernel determines which structure is being passed based +on the size passed in the last argument. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR ip_mreqn (2type), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_ADD_SOURCE_MEMBERSHIP.2const b/man/man2const/IP_ADD_SOURCE_MEMBERSHIP.2const new file mode 100644 index 0000000000..7af7fcc809 --- /dev/null +++ b/man/man2const/IP_ADD_SOURCE_MEMBERSHIP.2const @@ -0,0 +1,44 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_ADD_SOURCE_MEMBERSHIP 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_ADD_SOURCE_MEMBERSHIP +\- +join a multicast group +and allow receiving data +only from a specified source +.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,\~IP_ADD_SOURCE_MEMBERSHIP, +.BI " const\~struct\~ip_mreq_source\~*" val , +.B " sizeof(struct\~ip_mreq_source));" +.fi +.SH DESCRIPTION +Join a multicast group and allow receiving data only +from a specified source. +.P +This option can be used multiple times to allow +receiving data from more than one source. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.4.22, Linux 2.5.68. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR IP_ADD_MEMBERSHIP (2const), +.BR ip_mreq_source (2type), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_BIND_ADDRESS_NO_PORT.2const b/man/man2const/IP_BIND_ADDRESS_NO_PORT.2const new file mode 100644 index 0000000000..088c1c7650 --- /dev/null +++ b/man/man2const/IP_BIND_ADDRESS_NO_PORT.2const @@ -0,0 +1,42 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_BIND_ADDRESS_NO_PORT 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_BIND_ADDRESS_NO_PORT +\- +don't reserve an ephemeral port +.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,\~IP_BIND_ADDRESS_NO_PORT, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Inform the kernel to not reserve an ephemeral port when using +.BR bind (2) +with a port number of 0. +The port will later be automatically chosen at +.BR connect (2) +time, +in a way that allows sharing a source port as long as the 4-tuple is unique. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 4.2. +.\" commit 90c337da1524863838658078ec34241f45d8394d +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_BLOCK_SOURCE.2const b/man/man2const/IP_BLOCK_SOURCE.2const new file mode 100644 index 0000000000..b6a1ec24b8 --- /dev/null +++ b/man/man2const/IP_BLOCK_SOURCE.2const @@ -0,0 +1,43 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_BLOCK_SOURCE 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_BLOCK_SOURCE +\- +stop receiving multicast data from a specific source in a given group +.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,\~IP_BLOCK_SOURCE, +.BI " const\~struct\~ip_mreq_source\~*" val , +.B " sizeof(struct\~ip_mreq_source));" +.fi +.SH DESCRIPTION +Stop receiving multicast data from a specific source in a given group. +.P +This is valid only after the application has subscribed +to the multicast group using either +.BR IP_ADD_MEMBERSHIP (2const) +or +.BR IP_ADD_SOURCE_MEMBERSHIP (2const). +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.4.22, Linux 2.5.68. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR ip_mreq_source (2type), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_DROP_MEMBERSHIP.2const b/man/man2const/IP_DROP_MEMBERSHIP.2const new file mode 100644 index 0000000000..819c407c65 --- /dev/null +++ b/man/man2const/IP_DROP_MEMBERSHIP.2const @@ -0,0 +1,42 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_DROP_MEMBERSHIP 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_DROP_MEMBERSHIP +\- +leave a multicast group +.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,\~IP_DROP_MEMBERSHIP, +.BI " const\~struct\~ip_mreqn\~*" val ,\~sizeof(struct\~ip_mreqn)); +.fi +.SH DESCRIPTION +Leave a multicast group. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 1.2. +.P +For compatibility, the old +.I ip_mreq +structure is still supported. +The kernel determines which structure is being passed based +on the size passed in the last argument. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR ip_mreqn (2type), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_DROP_SOURCE_MEMBERSHIP.2const b/man/man2const/IP_DROP_SOURCE_MEMBERSHIP.2const new file mode 100644 index 0000000000..a1d9ed0c14 --- /dev/null +++ b/man/man2const/IP_DROP_SOURCE_MEMBERSHIP.2const @@ -0,0 +1,48 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_DROP_SOURCE_MEMBERSHIP 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_DROP_SOURCE_MEMBERSHIP +\- +leave a source-specific multicast group +.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,\~IP_DROP_SOURCE_MEMBERSHIP, +.BI " const\~struct\~ip_mreq_source\~*" val , +.B " sizeof(struct\~ip_mreq_source));" +.fi +.SH DESCRIPTION +Leave a source-specific group; +that is, +stop receiving data +from a given multicast group +that comes from a given source. +.P +If the application has subscribed to +multiple sources within the same group, +data from the remaining sources will still be delivered. +To stop receiving data from all sources at once, +use +.BR IP_DROP_MEMBERSHIP (2const). +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.4.22, Linux 2.5.68. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR ip_mreq_source (2type), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_FREEBIND.2const b/man/man2const/IP_FREEBIND.2const new file mode 100644 index 0000000000..6a00dde940 --- /dev/null +++ b/man/man2const/IP_FREEBIND.2const @@ -0,0 +1,52 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_FREEBIND 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_FREEBIND +\- +bind to a nonlocal or nonexistent IP address +.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,\~IP_FREEBIND, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +If enabled, +this boolean option allows binding to an IP address +that is nonlocal or does not (yet) exist. +.P +This permits listening on a socket, +without requiring +the underlying network interface +or the specified dynamic IP address +to be up at the time +that the application is trying to bind to it. +.P +This option is the per-socket equivalent of the +.I /proc/sys/net/ipv4/ip_nonlocal_bind +interface. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.4. +.\" Precisely: since Linux 2.4.0-test10 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR proc_sys_net_ipv4 (5), +.BR ip (7) diff --git a/man/man2const/IP_HDRINCL.2const b/man/man2const/IP_HDRINCL.2const new file mode 100644 index 0000000000..948c6d651e --- /dev/null +++ b/man/man2const/IP_HDRINCL.2const @@ -0,0 +1,51 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IPPROTO_IP 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IPPROTO_IP +\- +include a user-supplied IP header +.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,\~IP_HDRINCL, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +If enabled, +the user supplies an IP header in front of the user data. +.P +Valid only for +.B SOCK_RAW +sockets; +see +.BR raw (7) +for more information. +.P +When this flag is enabled, +the values set by +.BR IP_OPTIONS (2const), +.BR IP_TTL (2const), +and +.BR IP_TOS (2const) +are ignored. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.0. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_LOCAL_PORT_RANGE.2const b/man/man2const/IP_LOCAL_PORT_RANGE.2const new file mode 100644 index 0000000000..c4ac9cb498 --- /dev/null +++ b/man/man2const/IP_LOCAL_PORT_RANGE.2const @@ -0,0 +1,62 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_LOCAL_PORT_RANGE 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_LOCAL_PORT_RANGE +\- +default local port range +.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,\~IP_LOCAL_PORT_RANGE, +.BI " const\~uint32_t\~*" val ,\~sizeof(uint32_t)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_LOCAL_PORT_RANGE, +.BI " uint32_t\~*" val ,\~sizeof(uint32_t)); +.fi +.SH DESCRIPTION +Set or get the per-socket default local port range. +.P +This option can be used to clamp down the global local port range, +defined by the +.I /proc/sys/net/ipv4/ip_local_port_range +interface, +for a given socket. +.P +The option takes an +.I uint32_t +value with +the high 16 bits set to the upper range bound, +and the low 16 bits set to the lower range bound. +Range bounds are inclusive. +The 16-bit values should be in host byte order. +.P +The lower bound has to be less than the upper bound +when both bounds are not zero. +Otherwise, setting the option fails with EINVAL. +.P +If either bound is outside of the global local port range, or is zero, +then that bound has no effect. +.P +To reset the setting, +pass zero as both the upper and the lower bound. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 6.3. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR proc_sys_net_ipv4 (5), +.BR ip (7) diff --git a/man/man2const/IP_MSFILTER.2const b/man/man2const/IP_MSFILTER.2const new file mode 100644 index 0000000000..e05c26a118 --- /dev/null +++ b/man/man2const/IP_MSFILTER.2const @@ -0,0 +1,67 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MSFILTER 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MSFILTER +\- +multicast source filtering +.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,\~IP_MSFILTER, +.BI " const\~struct\~ip_msfilter\~*" val , +.B " sizeof(struct\~ip_msfilter));" +.fi +.P +.EX +struct ip_msfilter { + struct in_addr imsf_multiaddr; // IP multicast group address + struct in_addr imsf_interface; // IP address of local interface + uint32_t imsf_fmode; // Filter\-mode +\& + uint32_t imsf_numsrc; // Number of elements in .imsf_slist + struct in_addr imsf_slist[1]; // Array of source addresses +}; +.EE +.SH DESCRIPTION +This option provides access to the advanced full-state filtering API. +.P +There are two macros, +.B MCAST_INCLUDE +and +.BR MCAST_EXCLUDE , +which can be used to specify the filtering mode. +.P +Additionally, +the +.BR IP_MSFILTER_SIZE (n) +macro exists to determine how much memory is needed to store +.I ip_msfilter +structure with +.I n +sources in the source list. +.P +For the full description of multicast source filtering +refer to RFC 3376. +.SH ERRORS +See +.BR IPRROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.4.22, Linux 2.5.68. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_MTU.2const b/man/man2const/IP_MTU.2const new file mode 100644 index 0000000000..3d3f4b685b --- /dev/null +++ b/man/man2const/IP_MTU.2const @@ -0,0 +1,43 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MTU 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MTU +\- +path maximum transmission unit size +.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\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MTU, +.BI " int\~*" val ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Retrieve the current known path MTU of the current socket. +.P +.B IP_MTU +is valid only for +.BR getsockopt (2), +and can be employed only when the socket has been connected. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR getsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.124 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR getsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_MTU_DISCOVER.2const b/man/man2const/IP_MTU_DISCOVER.2const new file mode 100644 index 0000000000..b0f358bec0 --- /dev/null +++ b/man/man2const/IP_MTU_DISCOVER.2const @@ -0,0 +1,127 @@ +'\" t +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MTU_DISCOVER 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MTU_DISCOVER +\- +path maximum transfer unit size discovery +.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,\~IP_MTU_DISCOVER, +.BI " const\~int\~*" val ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MTU_DISCOVER, +.BI " int\~*" val ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Set or receive the Path MTU Discovery setting for a socket. +.P +When enabled, +Linux will perform Path MTU Discovery +as defined in RFC\ 1191 on +.B SOCK_STREAM +sockets. +.P +For +.RB non- SOCK_STREAM +sockets, +.B IP_PMTUDISC_DO +forces the don't-fragment flag to be set on all outgoing packets. +It is the user's responsibility to packetize the data +in MTU-sized chunks and to do the retransmits if necessary. +The kernel will reject (with +.BR EMSGSIZE ) +datagrams that are bigger than the known path MTU. +.B IP_PMTUDISC_WANT +will fragment a datagram if needed according to the path MTU, +or will set the don't-fragment flag otherwise. +.P +The system-wide default can be toggled between +.B IP_PMTUDISC_WANT +and +.B IP_PMTUDISC_DONT +by writing (respectively, zero and nonzero values) to the +.I /proc/sys/net/ipv4/ip_no_pmtu_disc +file. +.TS +tab(:); +c l +l l. +Path MTU discovery value:Meaning +IP_PMTUDISC_WANT:Use per-route settings. +IP_PMTUDISC_DONT:Never do Path MTU Discovery. +IP_PMTUDISC_DO:Always do Path MTU Discovery. +IP_PMTUDISC_PROBE:Set DF but ignore Path MTU. +.TE +.P +When PMTU discovery is enabled, the kernel automatically keeps track of +the path MTU per destination host. +When it is connected to a specific peer with +.BR connect (2), +the currently known path MTU can be retrieved conveniently using the +.BR IP_MTU (2const) +socket option (e.g., after an +.B EMSGSIZE +error occurred). +The path MTU may change over time. +For connectionless sockets with many destinations, +the new MTU for a given destination can also be accessed using the +error queue (see +.BR IP_RECVERR (2const)). +A new error will be queued for every incoming MTU update. +.P +While MTU discovery is in progress, initial packets from datagram sockets +may be dropped. +Applications using UDP should be aware of this and not +take it into account for their packet retransmit strategy. +.P +To bootstrap the path MTU discovery process on unconnected sockets, it +is possible to start with a big datagram size +(headers up to 64 kilobytes long) and let it shrink by updates of the path MTU. +.P +To get an initial estimate of the +path MTU, connect a datagram socket to the destination address using +.BR connect (2) +and retrieve the MTU by calling +.BR getsockopt (2) +with the +.BR IP_MTU (2const) +option. +.P +It is possible to implement RFC 4821 MTU probing with +.B SOCK_DGRAM +or +.B SOCK_RAW +sockets by setting a value of +.BR IP_PMTUDISC_PROBE . +This is also particularly useful for diagnostic tools such as +.BR tracepath (8) +that wish to deliberately send probe packets larger than +the observed Path MTU. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.124 +.TP +.B IP_PMTUDISC_PROBE +Linux 2.6.22. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_MULTICAST_ALL.2const b/man/man2const/IP_MULTICAST_ALL.2const new file mode 100644 index 0000000000..dd32ec0091 --- /dev/null +++ b/man/man2const/IP_MULTICAST_ALL.2const @@ -0,0 +1,46 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MULTICAST_ALL 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MULTICAST_ALL +\- +delivery policy of multicast messages +.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,\~IP_MULTICAST_ALL, +.BI " const\~int\~*" val ,\~sizeof(int)); +.fi +.SH DESCRIPTION +This option can be used to modify the delivery policy of multicast messages. +.P +If set to 1 (default), +the socket will receive messages from all the groups that have been joined +globally on the whole system. +.P +If set to 0, +it will deliver messages only from +the groups that have been explicitly joined +(for example via +.BR IP_ADD_MEMBERSHIP (2const)) +on this particular socket. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.6.31. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_MULTICAST_IF.2const b/man/man2const/IP_MULTICAST_IF.2const new file mode 100644 index 0000000000..71d7811544 --- /dev/null +++ b/man/man2const/IP_MULTICAST_IF.2const @@ -0,0 +1,56 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MULTICAST_IF 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MULTICAST_IF +\- +local device for a multicast socket +.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,\~IP_MULTICAST_IF, +.BI " const\~void\~" val [ size ],\~size_t\~ size ); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_IF, +.BI " struct\~in_addr\~*" val ,\~sizeof(struct\~in_addr)); +.fi +.SH DESCRIPTION +Set the local device for a multicast socket. +.P +The argument for +.BR setsockopt (2) +is an +.BR ip_mreqn (2type) +or +.\" net: IP_MULTICAST_IF setsockopt now recognizes struct mreq +.\" Commit: 3a084ddb4bf299a6e898a9a07c89f3917f0713f7 +(since Linux 3.5) +.BR ip_mreq (2type) +structure, +or an +.BR in_addr (2type) +structure. +(The kernel determines which structure is being passed based +on the size passed in +.IR size .) +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 1.2. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR in_addr (2type), +.BR ip_mreqn (2type), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_MULTICAST_LOOP.2const b/man/man2const/IP_MULTICAST_LOOP.2const new file mode 100644 index 0000000000..3c59465d8a --- /dev/null +++ b/man/man2const/IP_MULTICAST_LOOP.2const @@ -0,0 +1,38 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MULTICAST_LOOP 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MULTICAST_LOOP +\- +loop back sent multicast packets to local sockets +.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,\~IP_MULTICAST_LOOP, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_LOOP, +.BI " int\~*" enabled ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Set or read a boolean integer argument that determines whether +sent multicast packets should be looped back to the local sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 1.2. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_MULTICAST_TTL.2const b/man/man2const/IP_MULTICAST_TTL.2const new file mode 100644 index 0000000000..f325f4fe4f --- /dev/null +++ b/man/man2const/IP_MULTICAST_TTL.2const @@ -0,0 +1,43 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_MULTICAST_TTL 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_MULTICAST_TTL +\- +time-to-live value of outgoing multicast packets +.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,\~IP_MULTICAST_TTL, +.BI " const\~int\~*" ttl ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_TTL, +.BI " int\~*" ttl ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Set or read the time-to-live value of outgoing multicast packets for this +socket. +.P +The default is 1 which means that multicast packets don't leave the local +network unless the user program explicitly requests it. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 1.2. +.SH CAVEATS +It is very important for multicast packets to set the smallest TTL possible. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_NODEFRAG.2const b/man/man2const/IP_NODEFRAG.2const new file mode 100644 index 0000000000..da0bfea158 --- /dev/null +++ b/man/man2const/IP_NODEFRAG.2const @@ -0,0 +1,42 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_NODEFRAG 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_NODEFRAG +\- +don't defragmentate outgoing packets +.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,\~IP_NODEFRAG, +.BI " const\~int\~*" val ,\~sizeof(int)); +.fi +.SH DESCRIPTION +If +.I val +is nonzero, +the reassembly of outgoing packets is disabled in the netfilter layer. +.P +This option is valid only for +.B SOCK_RAW +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.6.36. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_OPTIONS.2const b/man/man2const/IP_OPTIONS.2const new file mode 100644 index 0000000000..f60d5aece0 --- /dev/null +++ b/man/man2const/IP_OPTIONS.2const @@ -0,0 +1,71 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_OPTIONS 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_OPTIONS +\- +options to be sent with every packet +.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,\~IP_OPTIONS, +.BI " const\~void\~" buf [ size ],\~size_t\~ size ); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_OPTIONS, +.BI " void\~" buf [ size ],\~size_t\~ size ); +.fi +.SH DESCRIPTION +Set or get the IP options to be sent with every packet from this socket. +.P +The arguments are a pointer to a memory buffer containing the options +and the buffer length. +.P +The +.BR setsockopt (2) +call sets the IP options associated with a socket. +The maximum option size for IPv4 is 40 bytes. +See RFC\ 791 for the allowed options. +.P +When the initial connection request packet for a +.B SOCK_STREAM +socket contains IP options, +the IP options will be set automatically +to the options from the initial packet with routing headers reversed. +.P +Incoming packets are not allowed to change options +after the connection is established. +.P +The processing of all incoming source routing options +is disabled by default and can be enabled by using the +.I accept_source_route +.I /proc +interface. +Other options like timestamps are still handled. +.P +For datagram sockets, IP options can be set only by the local user. +.P +Calling +.BR getsockopt (2) +with +.B IP_OPTIONS +puts the current IP options used for sending into the supplied buffer. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.0. +.\" Precisely: since Linux 1.3.30 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_PASSSEC.2const b/man/man2const/IP_PASSSEC.2const new file mode 100644 index 0000000000..46845cf3d8 --- /dev/null +++ b/man/man2const/IP_PASSSEC.2const @@ -0,0 +1,69 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_PASSSEC 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_PASSSEC +\- +receive the security context of the peer socket +.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,\~IP_PASSSEC, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_PASSSEC, +.BI " int\~*" enabled ,\~sizeof(int)); +.fi +.SH DESCRIPTION +If labeled IPSEC or NetLabel is configured on the sending and receiving +hosts, this option enables receiving of the security context of the peer +socket in an ancillary message of type +.B SCM_SECURITY +retrieved using +.BR recvmsg (2). +.P +This option is supported only for UDP sockets; +for TCP or SCTP sockets, +see +.BR SO_PEERSEC (2const). +.P +The security context returned in the +.B SCM_SECURITY +ancillary message +is of the same format as the one described in +.BR SO_PEERSEC (2const). +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.6.17. +.\" commit 2c7946a7bf45ae86736ab3b43d0085e43947945c +.SH CAVEATS +The reuse of the +.B SCM_SECURITY +message type for the +.B IP_PASSSEC +socket option was likely a mistake, since other IP control messages use +their own numbering scheme in the IP namespace and often use the +socket option value as the message type. +There is no conflict currently since the IP option with the same value as +.B SCM_SECURITY +is +.BR IP_HDRINCL (2const) +and this is never used for a control message type. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_PKTINFO.2const b/man/man2const/IP_PKTINFO.2const new file mode 100644 index 0000000000..9546d68c65 --- /dev/null +++ b/man/man2const/IP_PKTINFO.2const @@ -0,0 +1,111 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_PKTINFO 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_PKTINFO +\- +information about the incoming packet +.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,\~IP_PKTINFO, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.P +.EX +struct in_pktinfo { + unsigned int ipi_ifindex; /* Interface index */ + struct in_addr ipi_spec_dst; /* Local address */ + struct in_addr ipi_addr; /* Header Destination address */ +}; +.EE +.SH DESCRIPTION +Pass an +.B IP_PKTINFO +ancillary message that contains a +.I pktinfo +structure that supplies some information about the incoming packet. +This works only for datagram oriented sockets. +.P +The argument is a flag that tells the socket whether the +.B IP_PKTINFO +message should be passed or not. +.P +The message itself can be sent/retrieved +only as a control message with a packet using +.BR recvmsg (2) +or +.BR sendmsg (2). +.P +When returned by +.BR recvmsg (2) , +.I .ipi_ifindex +is the unique index of the interface the packet was received on. +.I .ipi_spec_dst +is the preferred source address for replies to the given packet, +and +.I .ipi_addr +is the destination address in the packet header. +These addresses are usually the same, +but can differ for broadcast or multicast packets. +Depending on the configured routes, +.I .ipi_spec_dst +might belong to a different interface from the one that received the packet. +.P +If +.B IP_PKTINFO +is passed to +.BR sendmsg (2) +and +.\" This field is grossly misnamed +.I .ipi_spec_dst +is not zero, +then it is used as the local source address, +for the routing table lookup, +and for setting up IP source route options. +When +.I .ipi_ifindex +is not zero, +the primary local address of the interface specified by the index +overwrites +.I .ipi_spec_dst +for the routing table lookup. +.I .ipi_addr +is ignored. +.P +Not supported for +.B SOCK_STREAM +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH VERSIONS +Some BSD sockets implementations provide +.B IP_RCVDSTADDR +and +.B IP_RECVIF +socket options to get the destination address and the interface of +received datagrams. +Linux has the more general +.B IP_PKTINFO +for the same task. +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.68 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_RECVERR.2const b/man/man2const/IP_RECVERR.2const new file mode 100644 index 0000000000..dba2216518 --- /dev/null +++ b/man/man2const/IP_RECVERR.2const @@ -0,0 +1,188 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_RECVERR 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_RECVERR +\- +extended reliable error message passing +.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,\~IP_RECVERR, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_RECVERR, +.BI " int\~*" enabled ,\~sizeof(int)); +.fi +.P +.EX +struct sock_extended_err { + uint32_t ee_errno; /* error number */ + uint8_t ee_origin; /* where the error originated */ + uint8_t ee_type; /* type */ + uint8_t ee_code; /* code */ + uint8_t ee_pad; + uint32_t ee_info; /* additional information */ + uint32_t ee_data; /* other data */ + /* More data may follow */ +}; +.EE +.P +.nf +#define SO_EE_ORIGIN_NONE 0 +#define SO_EE_ORIGIN_LOCAL 1 +#define SO_EE_ORIGIN_ICMP 2 +#define SO_EE_ORIGIN_ICMP6 3 +.P +.B struct\~sockaddr\~*SO_EE_OFFENDER(struct\~sock_extended_err\~*); +.SH DESCRIPTION +Enable extended reliable error message passing +(default: disabled). +.P +When enabled on a datagram socket, +all generated errors will be queued in a per-socket error queue. +When the user receives an error from a socket operation, +the errors can be received by calling +.BR recvmsg (2) +with the +.B MSG_ERRQUEUE +flag set. +The +.I sock_extended_err +structure describing the error +will be passed in an ancillary message +with the type +.B IP_RECVERR +and the level +.BR IPPROTO_IP . +.\" or SOL_IP on Linux +This is useful for reliable error handling on unconnected sockets. +The received data portion of the error queue contains the error packet. +.P +The +.B IP_RECVERR +control message contains a +.I sock_extended_err +structure. +.TP +.I .ee_errno +contains the +.I errno +number of the queued error. +.TP +.I .ee_origin +is the origin code of where the error originated. +.P +The other fields are protocol-specific. +.P +The macro +.BR SO_EE_OFFENDER () +returns a pointer to the address of the network object +where the error originated from +given a pointer to the ancillary message. +If this address is not known, +the +.I .sa_family +member of the +.I sockaddr +contains +.B AF_UNSPEC +and the other fields of the +.I sockaddr +are undefined. +.P +IP uses the +.I sock_extended_err +structure as follows: +.IP \[bu] 3 +.I .ee_origin +is set to +.B SO_EE_ORIGIN_ICMP +for errors received as an ICMP packet, +or +.B SO_EE_ORIGIN_LOCAL +for locally generated errors. +Unknown values should be ignored. +.IP \[bu] +.I .ee_type +and +.I .ee_code +are set from the type and code fields of the ICMP header. +.IP \[bu] +.I .ee_info +contains the discovered MTU for +.B EMSGSIZE +errors. +.IP \[bu] +The message also contains the +.I sockaddr_in +of the node caused that the error, +which can be accessed with the +.BR SO_EE_OFFENDER () +macro. +.P +The +.I .sin_family +field of the +.BR SO_EE_OFFENDER () +address is +.B AF_UNSPEC +when the source was unknown. +When the error originated from the network, all IP options +.RB ( IP_OPTIONS (2const), +.BR IP_TTL (2const), +etc.) enabled on the socket and contained in the +error packet are passed as control messages. +The payload of the packet causing the error is returned as normal payload. +.\" FIXME . Is it a good idea to document that? It is a dubious feature. +.\" On +.\" .B SOCK_STREAM +.\" sockets, +.\" .B IP_RECVERR +.\" has slightly different semantics. Instead of +.\" saving the errors for the next timeout, it passes all incoming +.\" errors immediately to the user. +.\" This might be useful for very short-lived TCP connections which +.\" need fast error handling. Use this option with care: +.\" it makes TCP unreliable +.\" by not allowing it to recover properly from routing +.\" shifts and other normal +.\" conditions and breaks the protocol specification. +.P +TCP has no error queue; +.B MSG_ERRQUEUE +is not permitted on +.B SOCK_STREAM +sockets. +.B IP_RECVERR +is valid for TCP, +but all errors are returned by socket function return or +.B SO_ERROR +only. +.P +For raw sockets, +.B IP_RECVERR +enables passing of all received ICMP errors to the +application, otherwise errors are reported only on connected sockets +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.15 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_RECVOPTS.2const b/man/man2const/IP_RECVOPTS.2const new file mode 100644 index 0000000000..4b5b95fb78 --- /dev/null +++ b/man/man2const/IP_RECVOPTS.2const @@ -0,0 +1,45 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_RECVOPTS 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_RECVOPTS +\- +receive all incoming IP options in control message +.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,\~IP_RECVOPTS, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Pass all incoming IP options to the user in a +.BR IP_OPTIONS (2const) +control message. +.P +The routing header and other options are already filled in +for the local host. +.P +Not supported for +.B SOCK_STREAM +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.15 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_RECVORIGDSTADDR.2const b/man/man2const/IP_RECVORIGDSTADDR.2const new file mode 100644 index 0000000000..505c5eadab --- /dev/null +++ b/man/man2const/IP_RECVORIGDSTADDR.2const @@ -0,0 +1,51 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_RECVORIGDSTADDR 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_RECVORIGDSTADDR +\- +receive IP_ORIGDSTADDR control message +.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,\~IP_RECVORIGDSTADDR, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +This boolean option enables the +.B IP_ORIGDSTADDR +ancillary message in +.BR recvmsg (2), +in which the kernel returns the original destination address +of the datagram being received. +.P +The ancillary message contains a +.BR sockaddr_in (2type) +structure. +.P +Not supported for +.B SOCK_STREAM +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.6.29. +.\" commit e8b2dfe9b4501ed0047459b2756ba26e5a940a69 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_RECVTOS.2const b/man/man2const/IP_RECVTOS.2const new file mode 100644 index 0000000000..e246b187d7 --- /dev/null +++ b/man/man2const/IP_RECVTOS.2const @@ -0,0 +1,45 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_RECVTOS 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_RECVTOS +\- +receive IP_TOS control message +.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,\~IP_RECVTOS, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +If enabled, +the +.BR IP_TOS (2const) +ancillary message is passed with incoming packets. +It contains a byte which specifies the Type of Service/Precedence +field of the packet header. +.P +Not supported for +.B SOCK_STREAM +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.68 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_RECVTTL.2const b/man/man2const/IP_RECVTTL.2const new file mode 100644 index 0000000000..77eeaec2c9 --- /dev/null +++ b/man/man2const/IP_RECVTTL.2const @@ -0,0 +1,54 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_RECVTTL 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_RECVTTL +\- +enable IP_TTL control message +.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\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +When this flag is set, +pass a +.BR IP_TTL (2const) +control message +with the time-to-live field +of the received packet as a 32 bit integer. +.P +Not supported for +.B SOCK_STREAM +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH VERSIONS +Some BSD sockets implementations also provide an +.B IP_RECVTTL +option, but an ancillary message with type +.B IP_RECVTTL +is passed with the incoming packet. +This is different from the +.BR IP_TTL (2const) +option used in Linux. +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.68 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_RETOPTS.2const b/man/man2const/IP_RETOPTS.2const new file mode 100644 index 0000000000..e750166f62 --- /dev/null +++ b/man/man2const/IP_RETOPTS.2const @@ -0,0 +1,43 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_RETOPTS 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_RETOPTS +\- +receive most incoming IP options in control message +.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,\~IP_RETOPTS, +.BI " const\~int\~*" enabled ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Identical to +.BR IP_RECVOPTS (2const), +but returns raw unprocessed options with timestamp and route record +options not filled in for this hop. +.P +Not supported for +.B SOCK_STREAM +sockets. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.15 +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_ROUTER_ALERT.2const b/man/man2const/IP_ROUTER_ALERT.2const new file mode 100644 index 0000000000..6aea0ca8c3 --- /dev/null +++ b/man/man2const/IP_ROUTER_ALERT.2const @@ -0,0 +1,49 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_ROUTER_ALERT 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_ROUTER_ALERT +\- +pass all to-be forwarded packets +.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,\~IP_ROUTER_ALERT, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Pass all to-be forwarded packets with the +IP Router Alert option set to this socket. +.P +Valid only for raw sockets. +.P +This is useful, for instance, for user-space RSVP daemons. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.2. +.\" Precisely: since Linux 2.1.68 +.SH CAVEATS +The tapped packets are not forwarded by the kernel; +it is the user's responsibility to send them out again. +.P +Socket binding is ignored, +such packets are filtered only by protocol. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_TOS.2const b/man/man2const/IP_TOS.2const new file mode 100644 index 0000000000..b5def16716 --- /dev/null +++ b/man/man2const/IP_TOS.2const @@ -0,0 +1,70 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_TOS 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_TOS +\- +type of service +.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,\~IP_TOS, +.BI " const\~int\~*" tos ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_TOS, +.BI " int\~*" tos ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Set or receive the Type-Of-Service (TOS) field that is sent +with every IP packet originating from this socket. +It is used to prioritize packets on the network. +.P +There are some standard TOS flags defined: +.TP +.B IPTOS_LOWDELAY +to minimize delays for interactive traffic, +.TP +.B IPTOS_THROUGHPUT +to optimize throughput, +.TP +.B IPTOS_RELIABILITY +to optimize for reliability, +.TP +.B IPTOS_MINCOST +should be used for "filler data" where slow transmission doesn't matter. +.P +At most one of these TOS values can be specified. +Other bits are invalid and shall be cleared. +.P +Linux sends +.B IPTOS_LOWDELAY +datagrams first by default, +but the exact behavior depends on the configured queueing discipline. +.\" FIXME elaborate on this +.P +Some high-priority levels may require superuser privileges (the +.B CAP_NET_ADMIN +capability). +.\" The priority can also be set in a protocol-independent way by the +.\" .RB ( SOL_SOCKET ", " SO_PRIORITY ) +.\" socket option (see +.\" .BR socket (7)). +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 1.0. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_TRANSPARENT.2const b/man/man2const/IP_TRANSPARENT.2const new file mode 100644 index 0000000000..c885ebd619 --- /dev/null +++ b/man/man2const/IP_TRANSPARENT.2const @@ -0,0 +1,62 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_TRANSPARENT 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_TRANSPARENT +\- +transparent proxying +.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,\~IP_TRANSPARENT, +.BI " const\~int\~*" enable ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Setting this boolean option enables transparent proxying on this socket. +.P +This socket option allows +the calling application to bind to a nonlocal IP address and operate +both as a client and a server with the foreign address as the local endpoint. +.P +This requires that routing be set up in a way that +packets going to the foreign address are routed through the TProxy box +(i.e., the system hosting the application that employs the +.B IP_TRANSPARENT +socket option). +.P +Enabling this socket option requires superuser privileges +(the +.B CAP_NET_ADMIN +or +.B CAP_NET_RAW +capability). +.P +TProxy redirection with the iptables TPROXY target also requires that +this option be set on the redirected socket. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.6.24. +.\" commit f5715aea4564f233767ea1d944b2637a5fd7cd2e +.\" This patch introduces the IP_TRANSPARENT socket option: enabling that +.\" will make the IPv4 routing omit the non-local source address check on +.\" output. Setting IP_TRANSPARENT requires NET_ADMIN capability. +.\" http://lwn.net/Articles/252545/ +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_TTL.2const b/man/man2const/IP_TTL.2const new file mode 100644 index 0000000000..305b5c97f1 --- /dev/null +++ b/man/man2const/IP_TTL.2const @@ -0,0 +1,38 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_TTL 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_TTL +\- +time to live +.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,\~IP_TTL, +.BI " const\~int\~*" ttl ,\~sizeof(int)); +.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_TTL, +.BI " int\~*" ttl ,\~sizeof(int)); +.fi +.SH DESCRIPTION +Set or retrieve the current time-to-live field that is used in every packet +sent from this socket. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 1.0. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/IP_UNBLOCK_SOURCE.2const b/man/man2const/IP_UNBLOCK_SOURCE.2const new file mode 100644 index 0000000000..82ffd1b50d --- /dev/null +++ b/man/man2const/IP_UNBLOCK_SOURCE.2const @@ -0,0 +1,40 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH IP_UNBLOCK_SOURCE 2const (date) "Linux man-pages (unreleased)" +.SH NAME +IP_UNBLOCK_SOURCE +\- +unblock multicast source +.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,\~IP_UNBLOCK_SOURCE, +.BI " const\~struct\~ip_mreq_source\~*" src , +.B " sizeof(struct\~ip_mreq_source));" +.fi +.SH DESCRIPTION +Unblock previously blocked multicast source. +.P +Fails with +.B EADDRNOTAVAIL +when given source is not being blocked. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.SH HISTORY +Linux 2.4.22, Linux 2.5.68. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) diff --git a/man/man2const/SO_PEERSEC.2const b/man/man2const/SO_PEERSEC.2const new file mode 100644 index 0000000000..bf6f9a34e3 --- /dev/null +++ b/man/man2const/SO_PEERSEC.2const @@ -0,0 +1,96 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH SO_PEERSEC 2const (date) "Linux man-pages (unreleased)" +.SH NAME +SO_PEERSEC +\- +get the security context of a peer socker +.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\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~SO_PEERSEC, +.BI " void\~" buf [ size ],\~size_t\~ size ); +.fi +.SH DESCRIPTION +If labeled IPSEC or NetLabel is configured on both the sending and +receiving hosts, this read-only socket option returns the security +context of the peer socket connected to this socket. +By default, +this will be the same as the security context of the process that created +the peer socket unless overridden by the policy or by a process with +the required permissions. +.P +The argument to +.BR getsockopt (2) +is a pointer to a buffer of the specified length in bytes +into which the security context string will be copied. +If the buffer length is less than the length of the security +context string, then +.BR getsockopt (2) +returns \-1, sets +.I errno +to +.BR ERANGE , +and returns the required length via +.IR size . +The caller should allocate at least +.B NAME_MAX +bytes for the buffer initially, although this is not guaranteed +to be sufficient. +Resizing the buffer to the returned length +and retrying may be necessary. +.P +The security context string may include a terminating null character +in the returned length, but is not guaranteed to do so: a security +context "foo" might be represented as either {'f','o','o'} of length 3 +or {'f','o','o','\[rs]0'} of length 4, which are considered to be +interchangeable. +The string is printable, +does not contain non-terminating null characters, +and is in an unspecified encoding +(in particular, +it is not guaranteed to be ASCII or UTF-8). +.P +The use of this option for sockets in the +.B AF_INET +address family is supported since Linux 2.6.17 +.\" commit 2c7946a7bf45ae86736ab3b43d0085e43947945c +for TCP sockets, +and since Linux 4.17 +.\" commit d452930fd3b9031e59abfeddb2fa383f1403d61a +for SCTP sockets. +.P +For SELinux, NetLabel conveys only the MLS portion of the security +context of the peer across the wire, defaulting the rest of the +security context to the values defined in the policy for the +netmsg initial security identifier (SID). +However, NetLabel can +be configured to pass full security contexts over loopback. +Labeled IPSEC always passes full security contexts as part of establishing +the security association (SA) and looks them up based on the association +for each packet. +.SH ERRORS +See +.BR IPPROTO_IP (2const). +See +.BR setsockopt (2). +See +.BR ip (7). +.TP +.B ERANGE +The buffer +.I size +is not enough. +.SH HISTORY +Linux 2.6.17. +.SH SEE ALSO +.BR IPPROTO_IP (2const), +.BR setsockopt (2), +.BR ip (7) |
