OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man7 / tcp.7
index 3f9564b..8631682 100644 (file)
@@ -1,4 +1,7 @@
 .\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
+.\" and Copyright (C) 2008 Michael Kerrisk <mtk.manpages@gmail.com>
+.\" Note also that many pieces are drawn from the kernel source file
+.\" Documentation/networking/ip-sysctl.txt.
 .\"
 .\" %%%LICENSE_START(VERBATIM_ONE_PARA)
 .\" Permission is granted to distribute possibly modified copies
@@ -17,9 +20,6 @@
 .\"     (other than the remaining FIXMEs in the page source below).
 .\"
 .\" FIXME The following need to be documented
-.\"    TCP_CONGESTION (new in 2.6.13)
-.\"        commit 5f8ef48d240963093451bcf83df89f1a1364f51d
-.\"        Author: Stephen Hemminger <shemminger@osdl.org>
 .\"    TCP_MD5SIG (2.6.20)
 .\"        commit cfb6eeb4c860592edd123fdea908d23c6ad1c7dc
 .\"        Author was yoshfuji@linux-ipv6.org
 .\"        Author: William Allen Simpson <william.allen.simpson@gmail.com>
 .\"        commit e56fb50f2b7958b931c8a2fc0966061b3f3c8f3a
 .\"        Author: William Allen Simpson <william.allen.simpson@gmail.com>
+.\"
+.\"        REMOVED in Linux 3.10
+.\"            commit 1a2c6181c4a1922021b4d7df373bba612c3e5f04
+.\"            Author: Christoph Paasch <christoph.paasch@uclouvain.be>
+.\"
 .\"    TCP_THIN_LINEAR_TIMEOUTS (2.6.34)
 .\"        commit 36e31b0af58728071e8023cf8e20c5166b700717
 .\"        Author: Andreas Petlund <apetlund@simula.no>
-.\"    TCP_THIN_DUPACK (2..6.34)
+.\"    TCP_THIN_DUPACK (2.6.34)
 .\"        commit 7e38017557bc0b87434d184f8804cadb102bb903
 .\"        Author: Andreas Petlund <apetlund@simula.no>
-.\"    TCP_USER_TIMEOUT (new in 2.6.37)
-.\"        Author: Jerry Chu <hkchu@google.com>
-.\"        commit dca43c75e7e545694a9dd6288553f55c53e2a3a3
 .\"    TCP_REPAIR (3.5)
 .\"        commit ee9952831cfd0bbe834f4a26489d7dce74582e37
 .\"        Author: Pavel Emelyanov <xemul@parallels.com>
 .\"    TCP_REPAIR_OPTIONS (3.5)
 .\"        commit b139ba4e90dccbf4cd4efb112af96a5c9e0b098c
 .\"        Author: Pavel Emelyanov <xemul@parallels.com>
+.\"     TCP_FASTOPEN (3.6)
+.\"         (Fast Open server side implementation completed in 3.7)
+.\"        http://lwn.net/Articles/508865/
+.\"     TCP_TIMESTAMP (3.9)
+.\"        commit 93be6ce0e91b6a94783e012b1857a347a5e6e9f2
+.\"        Author: Andrey Vagin <avagin@openvz.org>
+.\"     TCP_NOTSENT_LOWAT (3.12)
+.\"        commit c9bee3b7fdecb0c1d070c7b54113b3bdfb9a3d36
+.\"        Author: Eric Dumazet <edumazet@google.com>
 .\"
-.TH TCP  7 2012-04-23 "Linux" "Linux Programmer's Manual"
+.TH TCP  7 2015-01-10 "Linux" "Linux Programmer's Manual"
 .SH NAME
 tcp \- TCP protocol
 .SH SYNOPSIS
@@ -182,7 +193,7 @@ socket option is enabled, urgent data is put into the normal
 data stream (a program can test for its location using the
 .B SIOCATMARK
 ioctl described below),
-otherwise it can be only received when the
+otherwise it can be received only when the
 .B MSG_OOB
 flag is set for
 .BR recv (2)
@@ -202,8 +213,8 @@ TCP is built on top of IP (see
 The address formats defined by
 .BR ip (7)
 apply to TCP.
-TCP only supports point-to-point
-communication; broadcasting and multicasting are not
+TCP supports point-to-point communication only;
+broadcasting and multicasting are not
 supported.
 .SS /proc interfaces
 System-wide TCP parameter settings can be accessed by files in the directory
@@ -284,17 +295,36 @@ Show/set the congestion control algorithm choices available to unprivileged
 processes (see the description of the
 .B TCP_CONGESTION
 socket option).
+The items in the list are separated by white space and
+terminated by a newline character.
 The list is a subset of those listed in
 .IR tcp_available_congestion_control .
-.\" FIXME How are the items in this delimited? Null bytes, spaces, commas?
 The default value for this list is "reno" plus the default setting of
 .IR tcp_congestion_control .
 .TP
+.IR tcp_autocorking " (Boolean; default: enabled; since Linux 3.14)"
+.\" commit f54b311142a92ea2e42598e347b84e1655caf8e3
+.\" Text heavily based on Documentation/networking/ip-sysctl.txt
+If this option is enabled, the kernel tries to coalesce small writes
+(from consecutive
+.BR write (2)
+and
+.BR sendmsg (2)
+calls) as much as possible,
+in order to decrease the total number of sent packets.
+Coalescing is done if at least one prior packet for the flow
+is waiting in Qdisc queues or device transmit queue.
+Applications can still use the
+.B TCP_CORK
+socket option to obtain optimal behavior
+when they know how/when to uncork their sockets.
+.TP
 .IR tcp_available_congestion_control " (String; read-only; since Linux 2.4.20)"
 .\" The following is from 2.6.28-rc4: Documentation/networking/ip-sysctl.txt
 Show a list of the congestion-control algorithms
 that are registered.
-.\" FIXME How are the items in this delimited? Null bytes, spaces, commas?
+The items in the list are separated by white space and
+terminated by a newline character.
 This list is a limiting set for the list in
 .IR tcp_allowed_congestion_control .
 More congestion-control algorithms may be available as modules,
@@ -322,7 +352,7 @@ this is the initial MSS used by the connection.
 .TP
 .IR tcp_bic " (Boolean; default: disabled; Linux 2.4.27/2.6.6 to 2.6.13)"
 Enable BIC TCP congestion control algorithm.
-BIC-TCP is a sender-side only change that ensures a linear RTT
+BIC-TCP is a sender-side-only change that ensures a linear RTT
 fairness under large windows while offering both scalability and
 bounded TCP-friendliness.
 The protocol combines two schemes
@@ -455,7 +485,7 @@ no response is obtained from the other end.
 .\" Since 2.1.43
 The number of seconds a connection needs to be idle
 before TCP begins sending out keep-alive probes.
-Keep-alives are only sent when the
+Keep-alives are sent only when the
 .B SO_KEEPALIVE
 socket option is enabled.
 The default value is 7200 seconds (2 hours).
@@ -750,10 +780,11 @@ building larger TSO frames.
 .TP
 .IR tcp_tw_recycle " (Boolean; default: disabled; since Linux 2.4)"
 .\" Since 2.3.15
-Enable fast recycling of TIME_WAIT sockets.
-Enabling this option is not
-recommended since this causes problems when working
-with NAT (Network Address Translation).
+Enable fast recycling of TIME_WAIT sockets. Enabling this option is
+not recommended for devices communicating with the general Internet
+or using NAT (Network Address Translation). Since some NAT gateways
+pass through IP timestamp values, one IP can appear to have
+non-increasing timestamps. See RFC 1323 (PAWS), RFC 6191.
 .\"
 .\" The following is from 2.6.12: Documentation/networking/ip-sysctl.txt
 .TP
@@ -768,7 +799,7 @@ It should not be changed without advice/request of technical experts.
 .IR tcp_vegas_cong_avoid  " (Boolean; default: disabled; Linux 2.2 to 2.6.13)"
 .\" Since 2.1.8; removed in 2.6.13
 Enable TCP Vegas congestion avoidance algorithm.
-TCP Vegas is a sender-side only change to TCP that anticipates
+TCP Vegas is a sender-side-only change to TCP that anticipates
 the onset of congestion by estimating the bandwidth.
 TCP Vegas adjusts the sending rate by modifying the congestion window.
 TCP Vegas should provide less packet loss, but it is
@@ -778,7 +809,7 @@ not as aggressive as TCP Reno.
 .TP
 .IR tcp_westwood " (Boolean; default: disabled; Linux 2.4.26/2.6.3 to 2.6.13)"
 Enable TCP Westwood+ congestion control algorithm.
-TCP Westwood+ is a sender-side only modification of the TCP Reno
+TCP Westwood+ is a sender-side-only modification of the TCP Reno
 protocol stack that optimizes the performance of TCP congestion control.
 It is based on end-to-end bandwidth estimation to set
 congestion window and slow start threshold after a congestion episode.
@@ -862,6 +893,10 @@ to read or
 .BR setsockopt (2)
 to write the option with the option level argument set to
 .BR IPPROTO_TCP .
+Unless otherwise noted,
+.I optval
+is a pointer to an
+.IR int .
 .\" or SOL_TCP on Linux
 In addition,
 most
@@ -870,6 +905,22 @@ socket options are valid on TCP sockets.
 For more information see
 .BR ip (7).
 .TP
+.BR TCP_CONGESTION " (since Linux 2.6.13)"
+.\"        commit 5f8ef48d240963093451bcf83df89f1a1364f51d
+.\"        Author: Stephen Hemminger <shemminger@osdl.org>
+The argument for this option is a string.
+This option allows the caller to set the TCP congestion control
+algorithm to be used, on a per-socket basis.
+Unprivileged processes are restricted to choosing one of the algorithms in
+.IR tcp_allowed_congestion_control
+(described above).
+Privileged processes
+.RB ( CAP_NET_ADMIN )
+can choose from any of the available congestion-control algorithms
+(see the description of
+.IR tcp_available_congestion_control
+above).
+.TP
 .BR TCP_CORK " (since Linux 2.2)"
 .\" precisely: since 2.1.127
 If set, don't send out partial frames.
@@ -888,6 +939,9 @@ This option should not be used in code intended to be portable.
 .TP
 .BR TCP_DEFER_ACCEPT " (since Linux 2.4)"
 .\" Precisely: since 2.3.38
+.\" Useful references:
+.\" http://www.techrepublic.com/article/take-advantage-of-tcp-ip-options-to-optimize-data-transmission/
+.\" http://unix.stackexchange.com/questions/94104/real-world-use-of-tcp-defer-accept
 Allow a listener to be awakened only when data arrives on the socket.
 Takes an integer value (seconds), this can
 bound the maximum number of attempts TCP will make to
@@ -982,6 +1036,51 @@ aborting the attempt to connect.
 It cannot exceed 255.
 This option should not be used in code intended to be portable.
 .TP
+.BR TCP_USER_TIMEOUT " (since Linux 2.6.37)"
+.\"        commit dca43c75e7e545694a9dd6288553f55c53e2a3a3
+.\"        Author: Jerry Chu <hkchu@google.com>
+.\" The following text taken nearly verbatim from Jerry Chu's (excellent)
+.\" commit message.
+.\"
+This option takes an
+.IR "unsigned int"
+as an argument.
+When the value is greater than 0,
+it specifies the maximum amount of time in milliseconds that transmitted
+data may remain unacknowledged before TCP will forcibly close the
+corresponding connection and return
+.B ETIMEDOUT
+to the application.
+If the option value is specified as 0,
+TCP will to use the system default.
+
+Increasing user timeouts allows a TCP connection to survive extended
+periods without end-to-end connectivity.
+Decreasing user timeouts
+allows applications to "fail fast", if so desired.
+Otherwise, failure may take up to 20 minutes with
+the current system defaults in a normal WAN environment.
+
+This option can be set during any state of a TCP connection,
+but is effective only during the synchronized states of a connection
+(ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, and LAST-ACK).
+Moreover, when used with the TCP keepalive
+.RB ( SO_KEEPALIVE )
+option,
+.B TCP_USER_TIMEOUT
+will override keepalive to determine when to close a
+connection due to keepalive failure.
+
+The option has no effect on when TCP retransmits a packet,
+nor when a keepalive probe is sent.
+
+This option, like many others, will be inherited by the socket returned by
+.BR accept (2),
+if it was set on the listening socket.
+
+Further details on the user timeout feature can be found in
+RFC\ 793 and RFC\ 5482 ("TCP User Timeout Option").
+.TP
 .BR TCP_WINDOW_CLAMP " (since Linux 2.4)"
 .\" Precisely: since 2.3.41
 Bound the size of the advertised window to this value.
@@ -1006,7 +1105,7 @@ It can be changed via
 .IR /proc/sys/net/ipv4/tcp_stdurg .
 
 It is possible to peek at out-of-band data using the
-.IR recv (2)
+.BR recv (2)
 .B MSG_PEEK
 flag.
 
@@ -1021,7 +1120,7 @@ argument of
 This flag causes the received bytes of data to be discarded,
 rather than passed back in a caller-supplied buffer.
 Since Linux 2.4.4,
-.BR MSG_PEEK
+.BR MSG_TRUNC
 also has this effect when used in conjunction with
 .BR MSG_OOB
 to receive out-of-band data.
@@ -1101,7 +1200,7 @@ is returned.
 .B SIOCOUTQ
 is defined in
 .IR <linux/sockios.h> .
-.\" FIXME http://sources.redhat.com/bugzilla/show_bug.cgi?id=12002,
+.\" FIXME http://sources.redhat.com/bugzilla/show_bug.cgi?id=12002,
 .\" filed 2010-09-10, may cause SIOCOUTQ to be defined in glibc headers
 Alternatively,
 you can use the synonymous
@@ -1187,3 +1286,12 @@ RFC\ 3168 for a description of Explicit Congestion Notification.
 RFC\ 2581 for TCP congestion control algorithms.
 .br
 RFC\ 2018 and RFC\ 2883 for SACK and extensions to SACK.
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.