diff options
Diffstat (limited to '')
-rw-r--r-- | man7/ip.7 | 83 |
1 files changed, 50 insertions, 33 deletions
@@ -35,7 +35,7 @@ .\" commit 76e21053b5bf33a07c76f99d27a74238310e3c71 .\" Author: Erich E. Hoover <ehoover@mines.edu> .\" -.TH ip 7 2023-07-15 "Linux man-pages 6.05.01" +.TH ip 7 2024-03-17 "Linux man-pages 6.7" .SH NAME ip \- Linux IPv4 protocol implementation .SH SYNOPSIS @@ -45,7 +45,7 @@ ip \- Linux IPv4 protocol implementation .\" .B #include <linux/errqueue.h> -- never include <linux/foo.h> .B #include <netinet/in.h> .B #include <netinet/ip.h> \fR/* superset of previous */ -.PP +.P .IB tcp_socket " = socket(AF_INET, SOCK_STREAM, 0);" .IB udp_socket " = socket(AF_INET, SOCK_DGRAM, 0);" .IB raw_socket " = socket(AF_INET, SOCK_RAW, " protocol ");" @@ -56,20 +56,20 @@ described in RFC\ 791 and RFC\ 1122. .B ip contains a level 2 multicasting implementation conforming to RFC\ 1112. It also contains an IP router including a packet filter. -.PP +.P The programming interface is BSD-sockets compatible. For more information on sockets, see .BR socket (7). -.PP +.P An IP socket is created using .BR socket (2): -.PP +.P .in +4n .EX socket(AF_INET, socket_type, protocol); .EE .in -.PP +.P Valid socket types include .B SOCK_STREAM to open a stream socket, @@ -79,7 +79,7 @@ to open a datagram socket, and to open a .BR raw (7) socket to access the IP protocol directly. -.PP +.P .I protocol is the IP protocol in the IP header to be received or sent. Valid values for @@ -107,12 +107,12 @@ stream sockets; and for .BR udplite (7) datagram sockets. -.PP +.P For .B SOCK_RAW you may specify a valid IANA IP protocol defined in RFC\ 1700 assigned numbers. -.PP +.P When a process wants to receive new incoming packets or connections, it should bind a socket to a local interface address using .BR bind (2). @@ -134,7 +134,7 @@ is called on an unbound socket, the socket is automatically bound to a random free port or to a usable shared port with the local address set to .BR INADDR_ANY . -.PP +.P A TCP local socket address that has been bound is unavailable for some time after closing, unless the .B SO_REUSEADDR @@ -151,7 +151,7 @@ and On raw sockets .I sin_port is set to the IP protocol. -.PP +.P .in +4n .EX struct sockaddr_in { @@ -166,7 +166,7 @@ struct in_addr { }; .EE .in -.PP +.P .I sin_family is always set to .BR AF_INET . @@ -190,7 +190,7 @@ port, they are implemented only by higher protocols like .BR tcp (7) and .BR udp (7). -.PP +.P .I sin_addr is the IP host address. The @@ -212,7 +212,7 @@ or set using the .BR inet_makeaddr (3) library functions or directly with the name resolver (see .BR gethostbyname (3)). -.PP +.P IPv4 addresses are divided into unicast, broadcast, and multicast addresses. Unicast addresses specify a single interface of a host, @@ -224,7 +224,7 @@ socket flag is set. In the current implementation, connection-oriented sockets are allowed to use only unicast addresses. .\" Leave a loophole for XTP @) -.PP +.P Note that the address and the port are always stored in network byte order. In particular, this means that you need to call @@ -275,7 +275,7 @@ Since Linux 5.14, .\" commit 58fee5fc83658aaacf60246aeab738946a9ba516 it is treated as an ordinary unicast address and can be assigned to an interface. -.PP +.P Internet standards have traditionally also reserved various addresses for particular uses, though Linux no longer treats some of these specially. @@ -314,7 +314,7 @@ The socket option level for IP is .BR IPPROTO_IP . .\" or SOL_IP on Linux A boolean integer flag is zero when it is false, otherwise true. -.PP +.P When an invalid socket option is specified, .BR getsockopt (2) and @@ -607,7 +607,7 @@ 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 -.sp 1 +.IP 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 @@ -828,6 +828,10 @@ is not zero, the primary local address of the interface specified by the index overwrites .I ipi_spec_dst for the routing table lookup. +.IP +Not supported for +.B SOCK_STREAM +sockets. .TP .BR IP_RECVERR " (since Linux 2.2)" .\" Precisely: since Linux 2.1.15 @@ -989,6 +993,9 @@ in which the kernel returns the original destination address of the datagram being received. The ancillary message contains a .IR "struct sockaddr_in" . +Not supported for +.B SOCK_STREAM +sockets. .TP .BR IP_RECVTOS " (since Linux 2.2)" .\" Precisely: since Linux 2.1.68 @@ -998,6 +1005,9 @@ ancillary message is passed with incoming packets. It contains a byte which specifies the Type of Service/Precedence field of the packet header. Expects a boolean integer flag. +Not supported for +.B SOCK_STREAM +sockets. .TP .BR IP_RECVTTL " (since Linux 2.2)" .\" Precisely: since Linux 2.1.68 @@ -1015,6 +1025,9 @@ Identical to .BR IP_RECVOPTS , but returns raw unprocessed options with timestamp and route record options not filled in for this hop. +Not supported for +.B SOCK_STREAM +sockets. .TP .BR IP_ROUTER_ALERT " (since Linux 2.2)" .\" Precisely: since Linux 2.1.68 @@ -1287,7 +1300,9 @@ Time in seconds to keep an IPv6 fragment in memory. Regeneration interval (in seconds) of the hash secret (or lifetime for the hash secret) for IPv6 fragments. .TP -.IR ipfrag_high_thresh " (integer), " ipfrag_low_thresh " (integer)" +.IR ipfrag_high_thresh " (integer)" +.TQ +.IR ipfrag_low_thresh " (integer)" If the amount of queued IP fragments reaches .IR ipfrag_high_thresh , the queue is pruned down to @@ -1305,7 +1320,7 @@ All ioctls described in .BR socket (7) apply to .BR ip . -.PP +.P Ioctls to configure generic device parameters are described in .BR netdevice (7). .\" FIXME Add a discussion of multicasting @@ -1365,7 +1380,9 @@ was called on an already connected socket. .B EMSGSIZE Datagram is bigger than an MTU on the path and it cannot be fragmented. .TP -.BR ENOBUFS ", " ENOMEM +.B ENOBUFS +.TQ +.B ENOMEM Not enough free memory. This often means that the memory allocation is limited by the socket buffer limits, not by the system memory, but this is not 100% consistent. @@ -1393,7 +1410,7 @@ The connection was unexpectedly closed or shut down by the other end. .TP .B ESOCKTNOSUPPORT The socket is not configured or an unknown socket type was requested. -.PP +.P Other errors may be generated by the overlaying protocols; see .BR tcp (7), .BR raw (7), @@ -1415,7 +1432,7 @@ and are Linux-specific. .\" IP_XFRM_POLICY is Linux-specific .\" IP_IPSEC_POLICY is a nonstandard extension, also present on some BSDs -.PP +.P Be very careful with the .B SO_BROADCAST option \- it is not privileged in Linux. @@ -1428,7 +1445,7 @@ See RFC 6762 for an example of a protocol (mDNS) using the more modern multicast approach to communicating with an open-ended group of hosts on the local network. -.PP +.P Some other BSD sockets implementations provide .B IP_RCVDSTADDR and @@ -1438,7 +1455,7 @@ received datagrams. Linux has the more general .B IP_PKTINFO for the same task. -.PP +.P Some BSD sockets implementations also provide an .B IP_RECVTTL option, but an ancillary message with type @@ -1447,13 +1464,13 @@ is passed with the incoming packet. This is different from the .B IP_TTL option used in Linux. -.PP +.P Using the .B SOL_IP socket options level isn't portable; BSD-based stacks use the .B IPPROTO_IP level. -.PP +.P .B INADDR_ANY (0.0.0.0) and .B INADDR_BROADCAST @@ -1476,7 +1493,7 @@ address structure for generic link layer information instead of the old .BR sockaddr_pkt . .SH BUGS There are too many inconsistent error values. -.PP +.P The error used to diagnose exhaustion of the ephemeral port range differs across the various system calls .RB ( connect (2), @@ -1484,14 +1501,14 @@ across the various system calls .BR listen (2), .BR sendto (2)) that can assign ephemeral ports. -.PP +.P The ioctls to configure IP-specific interface options and ARP tables are not described. -.\" .PP +.\" .P .\" Some versions of glibc forget to declare .\" .IR in_pktinfo . .\" Workaround currently is to copy it into your program from this man page. -.PP +.P Receiving the original destination address with .B MSG_ERRQUEUE in @@ -1515,10 +1532,10 @@ does not work in some Linux 2.2 kernels. .BR tcp (7), .BR udp (7), .BR ip (8) -.PP +.P The kernel source file .IR Documentation/networking/ip\-sysctl.txt . -.PP +.P RFC\ 791 for the original IP specification. RFC\ 1122 for the IPv4 host requirements. RFC\ 1812 for the IPv4 router requirements. |