idnits 2.17.1 draft-ietf-tcpm-rfc793bis-16.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack a Security Considerations section. == There are 3 instances of lines with non-RFC2606-compliant FQDNs in the document. -- The draft header indicates that this document obsoletes RFC6093, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document obsoletes RFC2873, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document obsoletes RFC6429, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document obsoletes RFC879, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year (Using the creation date from RFC1122, updated by this document, for RFC5378 checks: 1989-10-01) -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 24, 2020) is 1495 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 1981 (ref. '3') (Obsoleted by RFC 8201) ** Downref: Normative reference to an Informational RFC: RFC 2923 (ref. '7') -- Obsolete informational reference (is this intentional?): RFC 793 (ref. '12') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 896 (ref. '13') (Obsoleted by RFC 7805) -- Obsolete informational reference (is this intentional?): RFC 1349 (ref. '15') (Obsoleted by RFC 2474) -- Obsolete informational reference (is this intentional?): RFC 1644 (ref. '16') (Obsoleted by RFC 6247) -- Obsolete informational reference (is this intentional?): RFC 2873 (ref. '18') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6093 (ref. '32') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6429 (ref. '34') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6528 (ref. '35') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6691 (ref. '36') (Obsoleted by RFC 9293) == Outdated reference: A later version (-04) exists of draft-gont-tcpm-tcp-seq-validation-02 == Outdated reference: A later version (-15) exists of draft-ietf-tcpinc-tcpcrypt-09 == Outdated reference: A later version (-13) exists of draft-ietf-tcpm-tcp-edo-10 Summary: 3 errors (**), 0 flaws (~~), 5 warnings (==), 15 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force W. Eddy, Ed. 3 Internet-Draft MTI Systems 4 Obsoletes: 793, 879, 2873, 6093, 6429, March 24, 2020 5 6528, 6691 (if approved) 6 Updates: 5961, 1122 (if approved) 7 Intended status: Standards Track 8 Expires: September 25, 2020 10 Transmission Control Protocol Specification 11 draft-ietf-tcpm-rfc793bis-16 13 Abstract 15 This document specifies the Internet's Transmission Control Protocol 16 (TCP). TCP is an important transport layer protocol in the Internet 17 stack, and has continuously evolved over decades of use and growth of 18 the Internet. Over this time, a number of changes have been made to 19 TCP as it was specified in RFC 793, though these have only been 20 documented in a piecemeal fashion. This document collects and brings 21 those changes together with the protocol specification from RFC 793. 22 This document obsoletes RFC 793, as well as 879, 2873, 6093, 6429, 23 6528, and 6691 that updated parts of RFC 793. It updates RFC 1122, 24 and should be considered as a replacement for the portions of that 25 document dealing with TCP requirements. It updates RFC 5961 due to a 26 small clarification in reset handling while in the SYN-RECEIVED 27 state. 29 RFC EDITOR NOTE: If approved for publication as an RFC, this should 30 be marked additionally as "STD: 7" and replace RFC 793 in that role. 32 Requirements Language 34 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 35 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 36 document are to be interpreted as described in RFC 2119 [4]. 38 Status of This Memo 40 This Internet-Draft is submitted in full conformance with the 41 provisions of BCP 78 and BCP 79. 43 Internet-Drafts are working documents of the Internet Engineering 44 Task Force (IETF). Note that other groups may also distribute 45 working documents as Internet-Drafts. The list of current Internet- 46 Drafts is at https://datatracker.ietf.org/drafts/current/. 48 Internet-Drafts are draft documents valid for a maximum of six months 49 and may be updated, replaced, or obsoleted by other documents at any 50 time. It is inappropriate to use Internet-Drafts as reference 51 material or to cite them other than as "work in progress." 53 This Internet-Draft will expire on September 25, 2020. 55 Copyright Notice 57 Copyright (c) 2020 IETF Trust and the persons identified as the 58 document authors. All rights reserved. 60 This document is subject to BCP 78 and the IETF Trust's Legal 61 Provisions Relating to IETF Documents 62 (https://trustee.ietf.org/license-info) in effect on the date of 63 publication of this document. Please review these documents 64 carefully, as they describe your rights and restrictions with respect 65 to this document. Code Components extracted from this document must 66 include Simplified BSD License text as described in Section 4.e of 67 the Trust Legal Provisions and are provided without warranty as 68 described in the Simplified BSD License. 70 This document may contain material from IETF Documents or IETF 71 Contributions published or made publicly available before November 72 10, 2008. The person(s) controlling the copyright in some of this 73 material may not have granted the IETF Trust the right to allow 74 modifications of such material outside the IETF Standards Process. 75 Without obtaining an adequate license from the person(s) controlling 76 the copyright in such materials, this document may not be modified 77 outside the IETF Standards Process, and derivative works of it may 78 not be created outside the IETF Standards Process, except to format 79 it for publication as an RFC or to translate it into languages other 80 than English. 82 Table of Contents 84 1. Purpose and Scope . . . . . . . . . . . . . . . . . . . . . . 3 85 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 86 2.1. Key TCP Concepts . . . . . . . . . . . . . . . . . . . . 5 87 3. Functional Specification . . . . . . . . . . . . . . . . . . 6 88 3.1. Header Format . . . . . . . . . . . . . . . . . . . . . . 6 89 3.2. Terminology Overview . . . . . . . . . . . . . . . . . . 11 90 3.2.1. Key Connection State Variables . . . . . . . . . . . 11 91 3.2.2. State Machine Overview . . . . . . . . . . . . . . . 13 92 3.3. Sequence Numbers . . . . . . . . . . . . . . . . . . . . 16 93 3.4. Establishing a connection . . . . . . . . . . . . . . . . 23 94 3.5. Closing a Connection . . . . . . . . . . . . . . . . . . 29 95 3.5.1. Half-Closed Connections . . . . . . . . . . . . . . . 32 97 3.6. Segmentation . . . . . . . . . . . . . . . . . . . . . . 32 98 3.6.1. Maximum Segment Size Option . . . . . . . . . . . . . 34 99 3.6.2. Path MTU Discovery . . . . . . . . . . . . . . . . . 35 100 3.6.3. Interfaces with Variable MTU Values . . . . . . . . . 36 101 3.6.4. Nagle Algorithm . . . . . . . . . . . . . . . . . . . 36 102 3.6.5. IPv6 Jumbograms . . . . . . . . . . . . . . . . . . . 37 103 3.7. Data Communication . . . . . . . . . . . . . . . . . . . 37 104 3.7.1. Retransmission Timeout . . . . . . . . . . . . . . . 38 105 3.7.2. TCP Congestion Control . . . . . . . . . . . . . . . 38 106 3.7.3. TCP Connection Failures . . . . . . . . . . . . . . . 38 107 3.7.4. TCP Keep-Alives . . . . . . . . . . . . . . . . . . . 39 108 3.7.5. The Communication of Urgent Information . . . . . . . 40 109 3.7.6. Managing the Window . . . . . . . . . . . . . . . . . 41 110 3.8. Interfaces . . . . . . . . . . . . . . . . . . . . . . . 46 111 3.8.1. User/TCP Interface . . . . . . . . . . . . . . . . . 46 112 3.8.2. TCP/Lower-Level Interface . . . . . . . . . . . . . . 55 113 3.9. Event Processing . . . . . . . . . . . . . . . . . . . . 57 114 3.10. Glossary . . . . . . . . . . . . . . . . . . . . . . . . 82 115 4. Changes from RFC 793 . . . . . . . . . . . . . . . . . . . . 87 116 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 92 117 6. Security and Privacy Considerations . . . . . . . . . . . . . 92 118 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 93 119 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 94 120 8.1. Normative References . . . . . . . . . . . . . . . . . . 94 121 8.2. Informative References . . . . . . . . . . . . . . . . . 95 122 Appendix A. Other Implementation Notes . . . . . . . . . . . . . 99 123 A.1. IP Security Compartment and Precedence . . . . . . . . . 100 124 A.1.1. Precedence . . . . . . . . . . . . . . . . . . . . . 100 125 A.1.2. MLS Systems . . . . . . . . . . . . . . . . . . . . . 101 126 A.2. Sequence Number Validation . . . . . . . . . . . . . . . 101 127 A.3. Nagle Modification . . . . . . . . . . . . . . . . . . . 101 128 A.4. Low Water Mark Settings . . . . . . . . . . . . . . . . . 102 129 Appendix B. TCP Requirement Summary . . . . . . . . . . . . . . 102 130 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 106 132 1. Purpose and Scope 134 In 1981, RFC 793 [12] was released, documenting the Transmission 135 Control Protocol (TCP), and replacing earlier specifications for TCP 136 that had been published in the past. 138 Since then, TCP has been implemented many times, and has been used as 139 a transport protocol for numerous applications on the Internet. 141 For several decades, RFC 793 plus a number of other documents have 142 combined to serve as the specification for TCP [41]. Over time, a 143 number of errata have been identified on RFC 793, as well as 144 deficiencies in security, performance, and other aspects. The number 145 of enhancements has grown over time across many separate documents. 146 These were never accumulated together into an update to the base 147 specification. 149 The purpose of this document is to bring together all of the IETF 150 Standards Track changes that have been made to the basic TCP 151 functional specification and unify them into an update of the RFC 793 152 protocol specification. Some companion documents are referenced for 153 important algorithms that TCP uses (e.g. for congestion control), but 154 have not been attempted to include in this document. This is a 155 conscious choice, as this base specification can be used with 156 multiple additional algorithms that are developed and incorporated 157 separately, but all TCP implementations need to implement this 158 specification as a common basis in order to interoperate. As some 159 additional TCP features have become quite complicated themselves 160 (e.g. advanced loss recovery and congestion control), future 161 companion documents may attempt to similarly bring these together. 163 In addition to the protocol specification that descibes the TCP 164 segment format, generation, and processing rules that are to be 165 implemented in code, RFC 793 and other updates also contain 166 informative and descriptive text for human readers to understand 167 aspects of the protocol design and operation. This document does not 168 attempt to alter or update this informative text, and is focused only 169 on updating the normative protocol specification. We preserve 170 references to the documentation containing the important explanations 171 and rationale, where appropriate. 173 This document is intended to be useful both in checking existing TCP 174 implementations for conformance, as well as in writing new 175 implementations. 177 2. Introduction 179 RFC 793 contains a discussion of the TCP design goals and provides 180 examples of its operation, including examples of connection 181 establishment, closing connections, and retransmitting packets to 182 repair losses. 184 This document describes the basic functionality expected in modern 185 implementations of TCP, and replaces the protocol specification in 186 RFC 793. It does not replicate or attempt to update the introduction 187 and philosophy content in RFC 793 (sections 1 and 2 of that 188 document). Other documents are referenced to provide explanation of 189 the theory of operation, rationale, and detailed discussion of design 190 decisions. This document only focuses on the normative behavior of 191 the protocol. 193 The "TCP Roadmap" [41] provides a more extensive guide to the RFCs 194 that define TCP and describe various important algorithms. The TCP 195 Roadmap contains sections on strongly encouraged enhancements that 196 improve performance and other aspects of TCP beyond the basic 197 operation specified in this document. As one example, implementing 198 congestion control (e.g. [28]) is a TCP requirement, but is a complex 199 topic on its own, and not described in detail in this document, as 200 there are many options and possibilities that do not impact basic 201 interoperability. Similarly, most common TCP implementations today 202 include the high-performance extensions in [39], but these are not 203 strictly required or discussed in this document. 205 A list of changes from RFC 793 is contained in Section 4. 207 Each use of RFC 2119 keywords in the document is individually labeled 208 and referenced in Appendix B that summarizes implementation 209 requirements. Sentences using "MUST" are labeled as "MUST-X" with X 210 being a numeric identifier enabling the requirement to be located 211 easily when referenced from Appendix B. Similarly, sentences using 212 "SHOULD" are labeled with "SHLD-X", "MAY" with "MAY-X", and 213 "RECOMMENDED" with "REC-X". For the purposes of this labeling, 214 "SHOULD NOT" and "MUST NOT" are labeled the same as "SHOULD" and 215 "MUST" instances. 217 2.1. Key TCP Concepts 219 TCP provides a reliable, in-order, byte-stream service to 220 applications. 222 The application byte-stream is conveyed over the network via TCP 223 segments, with each TCP segment sent as an Internet Protocol (IP) 224 datagram. 226 TCP reliability consists of detecting packet losses (via sequence 227 numbers) and errors (via per-segment checksums), as well as 228 correction via retransmission. 230 TCP supports unicast delivery of data. Anycast applications exist 231 that successfully use TCP without modifications, though there is some 232 risk of instability due to changes of lower-layer forwarding 233 behavior. 235 TCP is connection-oriented, though does not inherently include a 236 liveness detection capability. 238 Data flow is supported bidirectionally over TCP connections, though 239 applications are free to send data only unidirectionally, if they so 240 choose. 242 TCP uses port numbers to identify application services and to 243 multiplex multiple flows between hosts. 245 A more detailed description of TCP's features compared to other 246 transport protocols can be found in Section 3.1 of [44]. Further 247 description of the motivations for developing TCP and its role in the 248 Internet stack can be found in Section 2 of [12] and earlier versions 249 of the TCP specification. 251 3. Functional Specification 253 3.1. Header Format 255 TCP segments are sent as internet datagrams. The Internet Protocol 256 (IP) header carries several information fields, including the source 257 and destination host addresses [1] [11]. A TCP header follows the 258 Internet header, supplying information specific to the TCP protocol. 259 This division allows for the existence of host level protocols other 260 than TCP. In early development of the Internet suite of protocols, 261 the IP header fields had been a part of TCP. 263 0 1 2 3 264 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 265 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 266 | Source Port | Destination Port | 267 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 268 | Sequence Number | 269 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 270 | Acknowledgment Number | 271 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 272 | Data | |C|E|U|A|P|R|S|F| | 273 | Offset| Rsrvd |W|C|R|C|S|S|Y|I| Window | 274 | | |R|E|G|K|H|T|N|N| | 275 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 276 | Checksum | Urgent Pointer | 277 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 278 | Options | Padding | 279 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 280 | data | 281 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 283 Note that one tick mark represents one bit position. 285 Figure 1: TCP Header Format 287 Source Port: 16 bits 289 The source port number. 291 Destination Port: 16 bits 293 The destination port number. 295 Sequence Number: 32 bits 297 The sequence number of the first data octet in this segment (except 298 when SYN is present). If SYN is present the sequence number is the 299 initial sequence number (ISN) and the first data octet is ISN+1. 301 Acknowledgment Number: 32 bits 303 If the ACK control bit is set, this field contains the value of the 304 next sequence number the sender of the segment is expecting to 305 receive. Once a connection is established, this is always sent. 307 Data Offset: 4 bits 309 The number of 32 bit words in the TCP Header. This indicates where 310 the data begins. The TCP header (even one including options) is an 311 integral number of 32 bits long. 313 Rsrvd - Reserved: 4 bits 315 Reserved for future use. Must be zero in generated segments and 316 must be ignored in received segments, if corresponding future 317 features are unimplemented by the sending or receiving host. 319 Control Bits: 8 bits (from left to right): 321 CWR: Congestion Window Reduced (see [8]) 322 ECE: ECN-Echo (see [8]) 323 URG: Urgent Pointer field significant 324 ACK: Acknowledgment field significant 325 PSH: Push Function (see the Send Call description in 326 Section 3.8.1) 327 RST: Reset the connection 328 SYN: Synchronize sequence numbers 329 FIN: No more data from sender 331 The control bits are also know as "flags". Assignment is managed 332 by IANA from the "TCP Header Flags" registry [48]. 334 Window: 16 bits 336 The number of data octets beginning with the one indicated in the 337 acknowledgment field that the sender of this segment is willing to 338 accept. 340 The window size MUST be treated as an unsigned number, or else 341 large window sizes will appear like negative windows and TCP will 342 now work (MUST-1). It is RECOMMENDED that implementations will 343 reserve 32-bit fields for the send and receive window sizes in the 344 connection record and do all window computations with 32 bits (REC- 345 1). 347 Checksum: 16 bits 349 The checksum field is the 16 bit one's complement of the one's 350 complement sum of all 16 bit words in the header and text. The 351 checksum computation needs to ensure the 16-bit alignment of the 352 data being summed. If a segment contains an odd number of header 353 and text octets, alignment can be achieved by padding the last 354 octet with zeros on its right to form a 16 bit word for checksum 355 purposes. The pad is not transmitted as part of the segment. 356 While computing the checksum, the checksum field itself is replaced 357 with zeros. 359 The checksum also covers a pseudo header conceptually prefixed to 360 the TCP header. The pseudo header is 96 bits for IPv4 and 320 bits 361 for IPv6. For IPv4, this pseudo header contains the Source 362 Address, the Destination Address, the Protocol (PTCL), and TCP 363 length. This gives the TCP connection protection against misrouted 364 segments. This information is carried in IP headers and is 365 transferred across the TCP/Network interface in the arguments or 366 results of calls by the TCP implementation on the IP layer. 368 +--------+--------+--------+--------+ 369 | Source Address | 370 +--------+--------+--------+--------+ 371 | Destination Address | 372 +--------+--------+--------+--------+ 373 | zero | PTCL | TCP Length | 374 +--------+--------+--------+--------+ 376 Psuedo header components: 378 Source Address: the IPv4 source address in network byte order 380 Destination Address: the IPv4 destination address in network 381 byte order 383 zero: bits set to zero 385 PTCL: the protocol number from the IP header 386 TCP Length: the TCP header length plus the data length in octets 387 (this is not an explicitly transmitted quantity, but is 388 computed), and it does not count the 12 octets of the pseudo 389 header. 391 For IPv6, the pseudo header is contained in section 8.1 of RFC 8200 392 [11], and contains the IPv6 Source Address and Destination Address, 393 an Upper Layer Packet Length (a 32-bit value otherwise equivalent 394 to TCP Length in the IPv4 pseudo header), three bytes of zero- 395 padding, and a Next Header value (differing from the IPv6 header 396 value in the case of extension headers present in between IPv6 and 397 TCP). 399 The TCP checksum is never optional. The sender MUST generate it 400 (MUST-2) and the receiver MUST check it (MUST-3). 402 Urgent Pointer: 16 bits 404 This field communicates the current value of the urgent pointer as 405 a positive offset from the sequence number in this segment. The 406 urgent pointer points to the sequence number of the octet following 407 the urgent data. This field is only be interpreted in segments 408 with the URG control bit set. 410 Options: variable 412 Options may occupy space at the end of the TCP header and are a 413 multiple of 8 bits in length. All options are included in the 414 checksum. An option may begin on any octet boundary. There are 415 two cases for the format of an option: 417 Case 1: A single octet of option-kind. 419 Case 2: An octet of option-kind, an octet of option-length, and 420 the actual option-data octets. 422 The option-length counts the two octets of option-kind and option- 423 length as well as the option-data octets. 425 Note that the list of options may be shorter than the data offset 426 field might imply. The content of the header beyond the End-of- 427 Option option must be header padding (i.e., zero). 429 The list of all currently defined options is managed by IANA [47], 430 and each option is defined in other RFCs, as indicated there. That 431 set includes experimental options that can be extended to support 432 multiple concurrent usages [38]. 434 A given TCP implementation can support any currently defined 435 options, but the following options MUST be supported (MUST-4) (kind 436 indicated in octal): 438 Kind Length Meaning 439 ---- ------ ------- 440 0 - End of option list. 441 1 - No-Operation. 442 2 4 Maximum Segment Size. 444 A TCP implementation MUST be able to receive a TCP option in any 445 segment (MUST-5). 446 A TCP implementation MUST (MUST-6) ignore without error any TCP 447 option it does not implement, assuming that the option has a length 448 field (all TCP options except End of option list and No-Operation 449 have length fields). TCP implementations MUST be prepared to 450 handle an illegal option length (e.g., zero); a suggested procedure 451 is to reset the connection and log the reason (MUST-7). 453 Specific Option Definitions 455 End of Option List 457 +--------+ 458 |00000000| 459 +--------+ 460 Kind=0 462 This option code indicates the end of the option list. This 463 might not coincide with the end of the TCP header according to 464 the Data Offset field. This is used at the end of all options, 465 not the end of each option, and need only be used if the end of 466 the options would not otherwise coincide with the end of the TCP 467 header. 469 No-Operation 471 +--------+ 472 |00000001| 473 +--------+ 474 Kind=1 476 This option code can be used between options, for example, to 477 align the beginning of a subsequent option on a word boundary. 478 There is no guarantee that senders will use this option, so 479 receivers MUST be prepared to process options even if they do 480 not begin on a word boundary (MUST-64). 482 Maximum Segment Size (MSS) 484 +--------+--------+---------+--------+ 485 |00000010|00000100| max seg size | 486 +--------+--------+---------+--------+ 487 Kind=2 Length=4 489 Maximum Segment Size Option Data: 16 bits 491 If this option is present, then it communicates the maximum 492 receive segment size at the TCP endpoint that sends this 493 segment. This value is limited by the IP reassembly limit. 494 This field may be sent in the initial connection request (i.e., 495 in segments with the SYN control bit set) and MUST NOT be sent 496 in other segments (MUST-65). If this option is not used, any 497 segment size is allowed. A more complete description of this 498 option is in Section 3.6.1. 500 Experimental TCP option values are defined in [21], and [38] 501 describes the current recommended usage for these experimental 502 values. 504 Note: There is ongoing work to extend the space available for 505 TCP options, such as [52]. 507 Padding: variable 509 The TCP header padding is used to ensure that the TCP header ends 510 and data begins on a 32 bit boundary. The padding is composed of 511 zeros. 513 3.2. Terminology Overview 515 This section includes an overview of key terms needed to understand 516 the detailed protocol operation in the rest of the document. There 517 is a traditional glossary of terms in Section 3.10. 519 3.2.1. Key Connection State Variables 521 Before we can discuss very much about the operation of the TCP 522 implementation we need to introduce some detailed terminology. The 523 maintenance of a TCP connection requires the remembering of several 524 variables. We conceive of these variables being stored in a 525 connection record called a Transmission Control Block or TCB. Among 526 the variables stored in the TCB are the local and remote IP addresses 527 and port numbers, the IP security level and compartment of the 528 connection (see Appendix A.1), pointers to the user's send and 529 receive buffers, pointers to the retransmit queue and to the current 530 segment. In addition several variables relating to the send and 531 receive sequence numbers are stored in the TCB. 533 Send Sequence Variables 535 SND.UNA - send unacknowledged 536 SND.NXT - send next 537 SND.WND - send window 538 SND.UP - send urgent pointer 539 SND.WL1 - segment sequence number used for last window update 540 SND.WL2 - segment acknowledgment number used for last window 541 update 542 ISS - initial send sequence number 544 Receive Sequence Variables 546 RCV.NXT - receive next 547 RCV.WND - receive window 548 RCV.UP - receive urgent pointer 549 IRS - initial receive sequence number 551 The following diagrams may help to relate some of these variables to 552 the sequence space. 554 1 2 3 4 555 ----------|----------|----------|---------- 556 SND.UNA SND.NXT SND.UNA 557 +SND.WND 559 1 - old sequence numbers that have been acknowledged 560 2 - sequence numbers of unacknowledged data 561 3 - sequence numbers allowed for new data transmission 562 4 - future sequence numbers that are not yet allowed 564 Figure 2: Send Sequence Space 566 The send window is the portion of the sequence space labeled 3 in 567 Figure 2. 569 1 2 3 570 ----------|----------|---------- 571 RCV.NXT RCV.NXT 572 +RCV.WND 574 1 - old sequence numbers that have been acknowledged 575 2 - sequence numbers allowed for new reception 576 3 - future sequence numbers that are not yet allowed 578 Figure 3: Receive Sequence Space 580 The receive window is the portion of the sequence space labeled 2 in 581 Figure 3. 583 There are also some variables used frequently in the discussion that 584 take their values from the fields of the current segment. 586 Current Segment Variables 588 SEG.SEQ - segment sequence number 589 SEG.ACK - segment acknowledgment number 590 SEG.LEN - segment length 591 SEG.WND - segment window 592 SEG.UP - segment urgent pointer 594 3.2.2. State Machine Overview 596 A connection progresses through a series of states during its 597 lifetime. The states are: LISTEN, SYN-SENT, SYN-RECEIVED, 598 ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, 599 TIME-WAIT, and the fictional state CLOSED. CLOSED is fictional 600 because it represents the state when there is no TCB, and therefore, 601 no connection. Briefly the meanings of the states are: 603 LISTEN - represents waiting for a connection request from any 604 remote TCP peer and port. 606 SYN-SENT - represents waiting for a matching connection request 607 after having sent a connection request. 609 SYN-RECEIVED - represents waiting for a confirming connection 610 request acknowledgment after having both received and sent a 611 connection request. 613 ESTABLISHED - represents an open connection, data received can be 614 delivered to the user. The normal state for the data transfer 615 phase of the connection. 617 FIN-WAIT-1 - represents waiting for a connection termination 618 request from the remote TCP peer, or an acknowledgment of the 619 connection termination request previously sent. 621 FIN-WAIT-2 - represents waiting for a connection termination 622 request from the remote TCP peer. 624 CLOSE-WAIT - represents waiting for a connection termination 625 request from the local user. 627 CLOSING - represents waiting for a connection termination request 628 acknowledgment from the remote TCP peer. 630 LAST-ACK - represents waiting for an acknowledgment of the 631 connection termination request previously sent to the remote TCP 632 peer (this termination request sent to the remote TCP peer already 633 included an acknowledgment of the termination request sent from 634 the remote TCP peer). 636 TIME-WAIT - represents waiting for enough time to pass to be sure 637 the remote TCP peer received the acknowledgment of its connection 638 termination request. 640 CLOSED - represents no connection state at all. 642 A TCP connection progresses from one state to another in response to 643 events. The events are the user calls, OPEN, SEND, RECEIVE, CLOSE, 644 ABORT, and STATUS; the incoming segments, particularly those 645 containing the SYN, ACK, RST and FIN flags; and timeouts. 647 The state diagram in Figure 4 illustrates only state changes, 648 together with the causing events and resulting actions, but addresses 649 neither error conditions nor actions that are not connected with 650 state changes. In a later section, more detail is offered with 651 respect to the reaction of the TCP implementation to events. Some 652 state names are abbreviated or hyphenated differently in the diagram 653 from how they appear elsewhere in the document. 655 NOTA BENE: This diagram is only a summary and must not be taken as 656 the total specification. Many details are not included. 658 +---------+ ---------\ active OPEN 659 | CLOSED | \ ----------- 660 +---------+<---------\ \ create TCB 661 | ^ \ \ snd SYN 662 passive OPEN | | CLOSE \ \ 663 ------------ | | ---------- \ \ 664 create TCB | | delete TCB \ \ 665 V | \ \ 666 rcv RST (note 1) +---------+ CLOSE | \ 667 -------------------->| LISTEN | ---------- | | 668 / +---------+ delete TCB | | 669 / rcv SYN | | SEND | | 670 / ----------- | | ------- | V 671 +--------+ snd SYN,ACK / \ snd SYN +--------+ 672 | |<----------------- ------------------>| | 673 | SYN | rcv SYN | SYN | 674 | RCVD |<-----------------------------------------------| SENT | 675 | | snd SYN,ACK | | 676 | |------------------ -------------------| | 677 +--------+ rcv ACK of SYN \ / rcv SYN,ACK +--------+ 678 | -------------- | | ----------- 679 | x | | snd ACK 680 | V V 681 | CLOSE +---------+ 682 | ------- | ESTAB | 683 | snd FIN +---------+ 684 | CLOSE | | rcv FIN 685 V ------- | | ------- 686 +---------+ snd FIN / \ snd ACK +---------+ 687 | FIN |<----------------- ------------------>| CLOSE | 688 | WAIT-1 |------------------ | WAIT | 689 +---------+ rcv FIN \ +---------+ 690 | rcv ACK of FIN ------- | CLOSE | 691 | -------------- snd ACK | ------- | 692 V x V snd FIN V 693 +---------+ +---------+ +---------+ 694 |FINWAIT-2| | CLOSING | | LAST-ACK| 695 +---------+ +---------+ +---------+ 696 | rcv ACK of FIN | rcv ACK of FIN | 697 | rcv FIN -------------- | Timeout=2MSL -------------- | 698 | ------- x V ------------ x V 699 \ snd ACK +---------+delete TCB +---------+ 700 ------------------------>|TIME WAIT|------------------>| CLOSED | 701 +---------+ +---------+ 703 note 1: The transition from SYN-RECEIVED to LISTEN on receiving a RST is 704 conditional on having reached SYN-RECEIVED after a passive open. 706 note 2: An unshown transition exists from FIN-WAIT-1 to TIME-WAIT if 707 a FIN is received and the local FIN is also acknowledged. 709 Figure 4: TCP Connection State Diagram 711 3.3. Sequence Numbers 713 A fundamental notion in the design is that every octet of data sent 714 over a TCP connection has a sequence number. Since every octet is 715 sequenced, each of them can be acknowledged. The acknowledgment 716 mechanism employed is cumulative so that an acknowledgment of 717 sequence number X indicates that all octets up to but not including X 718 have been received. This mechanism allows for straight-forward 719 duplicate detection in the presence of retransmission. Numbering of 720 octets within a segment is that the first data octet immediately 721 following the header is the lowest numbered, and the following octets 722 are numbered consecutively. 724 It is essential to remember that the actual sequence number space is 725 finite, though very large. This space ranges from 0 to 2**32 - 1. 726 Since the space is finite, all arithmetic dealing with sequence 727 numbers must be performed modulo 2**32. This unsigned arithmetic 728 preserves the relationship of sequence numbers as they cycle from 729 2**32 - 1 to 0 again. There are some subtleties to computer modulo 730 arithmetic, so great care should be taken in programming the 731 comparison of such values. The symbol "=<" means "less than or 732 equal" (modulo 2**32). 734 The typical kinds of sequence number comparisons that the TCP 735 implementation must perform include: 737 (a) Determining that an acknowledgment refers to some sequence 738 number sent but not yet acknowledged. 740 (b) Determining that all sequence numbers occupied by a segment 741 have been acknowledged (e.g., to remove the segment from a 742 retransmission queue). 744 (c) Determining that an incoming segment contains sequence numbers 745 that are expected (i.e., that the segment "overlaps" the receive 746 window). 748 In response to sending data the TCP endpoint will receive 749 acknowledgments. The following comparisons are needed to process the 750 acknowledgments. 752 SND.UNA = oldest unacknowledged sequence number 754 SND.NXT = next sequence number to be sent 756 SEG.ACK = acknowledgment from the receiving TCP peer (next 757 sequence number expected by the receiving TCP peer) 758 SEG.SEQ = first sequence number of a segment 760 SEG.LEN = the number of octets occupied by the data in the segment 761 (counting SYN and FIN) 763 SEG.SEQ+SEG.LEN-1 = last sequence number of a segment 765 A new acknowledgment (called an "acceptable ack"), is one for which 766 the inequality below holds: 768 SND.UNA < SEG.ACK =< SND.NXT 770 A segment on the retransmission queue is fully acknowledged if the 771 sum of its sequence number and length is less or equal than the 772 acknowledgment value in the incoming segment. 774 When data is received the following comparisons are needed: 776 RCV.NXT = next sequence number expected on an incoming segments, 777 and is the left or lower edge of the receive window 779 RCV.NXT+RCV.WND-1 = last sequence number expected on an incoming 780 segment, and is the right or upper edge of the receive window 782 SEG.SEQ = first sequence number occupied by the incoming segment 784 SEG.SEQ+SEG.LEN-1 = last sequence number occupied by the incoming 785 segment 787 A segment is judged to occupy a portion of valid receive sequence 788 space if 790 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 792 or 794 RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND 796 The first part of this test checks to see if the beginning of the 797 segment falls in the window, the second part of the test checks to 798 see if the end of the segment falls in the window; if the segment 799 passes either part of the test it contains data in the window. 801 Actually, it is a little more complicated than this. Due to zero 802 windows and zero length segments, we have four cases for the 803 acceptability of an incoming segment: 805 Segment Receive Test 806 Length Window 807 ------- ------- ------------------------------------------- 809 0 0 SEG.SEQ = RCV.NXT 811 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 813 >0 0 not acceptable 815 >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 816 or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND 818 Note that when the receive window is zero no segments should be 819 acceptable except ACK segments. Thus, it is be possible for a TCP 820 implementation to maintain a zero receive window while transmitting 821 data and receiving ACKs. A TCP receiver MUST process the RST and URG 822 fields of all incoming segments, even when the receive window is zero 823 (MUST-66). 825 We have taken advantage of the numbering scheme to protect certain 826 control information as well. This is achieved by implicitly 827 including some control flags in the sequence space so they can be 828 retransmitted and acknowledged without confusion (i.e., one and only 829 one copy of the control will be acted upon). Control information is 830 not physically carried in the segment data space. Consequently, we 831 must adopt rules for implicitly assigning sequence numbers to 832 control. The SYN and FIN are the only controls requiring this 833 protection, and these controls are used only at connection opening 834 and closing. For sequence number purposes, the SYN is considered to 835 occur before the first actual data octet of the segment in which it 836 occurs, while the FIN is considered to occur after the last actual 837 data octet in a segment in which it occurs. The segment length 838 (SEG.LEN) includes both data and sequence space occupying controls. 839 When a SYN is present then SEG.SEQ is the sequence number of the SYN. 841 Initial Sequence Number Selection 843 The protocol places no restriction on a particular connection being 844 used over and over again. A connection is defined by a pair of 845 sockets. New instances of a connection will be referred to as 846 incarnations of the connection. The problem that arises from this is 847 -- "how does the TCP implementation identify duplicate segments from 848 previous incarnations of the connection?" This problem becomes 849 apparent if the connection is being opened and closed in quick 850 succession, or if the connection breaks with loss of memory and is 851 then reestablished. 853 To avoid confusion we must prevent segments from one incarnation of a 854 connection from being used while the same sequence numbers may still 855 be present in the network from an earlier incarnation. We want to 856 assure this, even if a TCP endpoint loses all knowledge of the 857 sequence numbers it has been using. When new connections are 858 created, an initial sequence number (ISN) generator is employed that 859 selects a new 32 bit ISN. There are security issues that result if 860 an off-path attacker is able to predict or guess ISN values. 862 The recommended ISN generator is based on the combination of a 863 (possibly fictitious) 32 bit clock whose low order bit is incremented 864 roughly every 4 microseconds, and a pseudorandom hash function (PRF). 865 The clock component is intended to insure that with a Maximum Segment 866 Lifetime (MSL), generated ISNs will be unique, since it cycles 867 approximately every 4.55 hours, which is much longer than the MSL. 868 This recommended algorithm is further described in RFC 6528 [35] and 869 builds on the basic clock-driven algorithm from RFC 793. 871 A TCP implementation MUST use a clock-driven selection of initial 872 sequence numbers (MUST-8), and SHOULD generate its Initial Sequence 873 Numbers with the expression: 875 ISN = M + F(localip, localport, remoteip, remoteport, secretkey) 877 where M is the 4 microsecond timer, and F() is a pseudorandom 878 function (PRF) of the connection's identifying parameters ("localip, 879 localport, remoteip, remoteport") and a secret key ("secretkey") 880 (SHLD-1). F() MUST NOT be computable from the outside (MUST-9), or 881 an attacker could still guess at sequence numbers from the ISN used 882 for some other connection. The PRF could be implemented as a 883 cryptographic hash of the concatenation of the TCP connection 884 parameters and some secret data. For discussion of the selection of 885 a specific hash algorithm and management of the secret key data, 886 please see Section 3 of [35]. 888 For each connection there is a send sequence number and a receive 889 sequence number. The initial send sequence number (ISS) is chosen by 890 the data sending TCP peer, and the initial receive sequence number 891 (IRS) is learned during the connection establishing procedure. 893 For a connection to be established or initialized, the two TCP peers 894 must synchronize on each other's initial sequence numbers. This is 895 done in an exchange of connection establishing segments carrying a 896 control bit called "SYN" (for synchronize) and the initial sequence 897 numbers. As a shorthand, segments carrying the SYN bit are also 898 called "SYNs". Hence, the solution requires a suitable mechanism for 899 picking an initial sequence number and a slightly involved handshake 900 to exchange the ISN's. 902 The synchronization requires each side to send its own initial 903 sequence number and to receive a confirmation of it in acknowledgment 904 from the remote TCP peer. Each side must also receive the remote 905 peer's initial sequence number and send a confirming acknowledgment. 907 1) A --> B SYN my sequence number is X 908 2) A <-- B ACK your sequence number is X 909 3) A <-- B SYN my sequence number is Y 910 4) A --> B ACK your sequence number is Y 912 Because steps 2 and 3 can be combined in a single message this is 913 called the three way (or three message) handshake. 915 A three way handshake is necessary because sequence numbers are not 916 tied to a global clock in the network, and TCP implementations may 917 have different mechanisms for picking the ISN's. The receiver of the 918 first SYN has no way of knowing whether the segment was an old 919 delayed one or not, unless it remembers the last sequence number used 920 on the connection (which is not always possible), and so it must ask 921 the sender to verify this SYN. The three way handshake and the 922 advantages of a clock-driven scheme are discussed in [54]. 924 Knowing When to Keep Quiet 926 A theoretical problem exists where data could be corrupted due to 927 confusion between old segments in the network and new ones after a 928 host reboots, if the same port numbers and sequence space are reused. 929 The "Quiet Time" concept discussed below addresses this and the 930 discussion of it is included for situations where it might be 931 relevant, although it is not felt to be necessary in most current 932 implementations. The problem have been more relevant earlier in the 933 history of TCP. In practical use on the Internet today, the error- 934 prone conditions are sufficiently unlikely that it is felt safe to 935 ignore. Reasons why it is now negligible include: (a) ISS and 936 ephemeral port randomization have reduced likelihood of reuse of 937 ports and sequency numbers after reboots, (b) the effective MSL of 938 the Internet has declined as links have become faster, and (c) 939 reboots often taking longer than an MSL anyways. 941 To be sure that a TCP implementation does not create a segment 942 carrying a sequence number that may be duplicated by an old segment 943 remaining in the network, the TCP endpoint must keep quiet for an MSL 944 before assigning any sequence numbers upon starting up or recovering 945 from a situation where memory of sequence numbers in use was lost. 946 For this specification the MSL is taken to be 2 minutes. This is an 947 engineering choice, and may be changed if experience indicates it is 948 desirable to do so. Note that if a TCP endpoint is reinitialized in 949 some sense, yet retains its memory of sequence numbers in use, then 950 it need not wait at all; it must only be sure to use sequence numbers 951 larger than those recently used. 953 The TCP Quiet Time Concept 955 Hosts that for any reason lose knowledge of the last sequence numbers 956 transmitted on each active (i.e., not closed) connection shall delay 957 emitting any TCP segments for at least the agreed MSL in the internet 958 system that the host is a part of. In the paragraphs below, an 959 explanation for this specification is given. TCP implementors may 960 violate the "quiet time" restriction, but only at the risk of causing 961 some old data to be accepted as new or new data rejected as old 962 duplicated by some receivers in the internet system. 964 TCP endpoints consume sequence number space each time a segment is 965 formed and entered into the network output queue at a source host. 966 The duplicate detection and sequencing algorithm in the TCP protocol 967 relies on the unique binding of segment data to sequence space to the 968 extent that sequence numbers will not cycle through all 2**32 values 969 before the segment data bound to those sequence numbers has been 970 delivered and acknowledged by the receiver and all duplicate copies 971 of the segments have "drained" from the internet. Without such an 972 assumption, two distinct TCP segments could conceivably be assigned 973 the same or overlapping sequence numbers, causing confusion at the 974 receiver as to which data is new and which is old. Remember that 975 each segment is bound to as many consecutive sequence numbers as 976 there are octets of data and SYN or FIN flags in the segment. 978 Under normal conditions, TCP implementations keep track of the next 979 sequence number to emit and the oldest awaiting acknowledgment so as 980 to avoid mistakenly using a sequence number over before its first use 981 has been acknowledged. This alone does not guarantee that old 982 duplicate data is drained from the net, so the sequence space has 983 been made very large to reduce the probability that a wandering 984 duplicate will cause trouble upon arrival. At 2 megabits/sec. it 985 takes 4.5 hours to use up 2**32 octets of sequence space. Since the 986 maximum segment lifetime in the net is not likely to exceed a few 987 tens of seconds, this is deemed ample protection for foreseeable 988 nets, even if data rates escalate to l0's of megabits/sec. At 100 989 megabits/sec, the cycle time is 5.4 minutes, which may be a little 990 short, but still within reason. 992 The basic duplicate detection and sequencing algorithm in TCP can be 993 defeated, however, if a source TCP endpoint does not have any memory 994 of the sequence numbers it last used on a given connection. For 995 example, if the TCP implementation were to start all connections with 996 sequence number 0, then upon the host rebooting, a TCP peer might re- 997 form an earlier connection (possibly after half-open connection 998 resolution) and emit packets with sequence numbers identical to or 999 overlapping with packets still in the network, which were emitted on 1000 an earlier incarnation of the same connection. In the absence of 1001 knowledge about the sequence numbers used on a particular connection, 1002 the TCP specification recommends that the source delay for MSL 1003 seconds before emitting segments on the connection, to allow time for 1004 segments from the earlier connection incarnation to drain from the 1005 system. 1007 Even hosts that can remember the time of day and used it to select 1008 initial sequence number values are not immune from this problem 1009 (i.e., even if time of day is used to select an initial sequence 1010 number for each new connection incarnation). 1012 Suppose, for example, that a connection is opened starting with 1013 sequence number S. Suppose that this connection is not used much and 1014 that eventually the initial sequence number function (ISN(t)) takes 1015 on a value equal to the sequence number, say S1, of the last segment 1016 sent by this TCP endpoint on a particular connection. Now suppose, 1017 at this instant, the host reboots and establishes a new incarnation 1018 of the connection. The initial sequence number chosen is S1 = ISN(t) 1019 -- last used sequence number on old incarnation of connection! If 1020 the recovery occurs quickly enough, any old duplicates in the net 1021 bearing sequence numbers in the neighborhood of S1 may arrive and be 1022 treated as new packets by the receiver of the new incarnation of the 1023 connection. 1025 The problem is that the recovering host may not know for how long it 1026 was down between rebooting nor does it know whether there are still 1027 old duplicates in the system from earlier connection incarnations. 1029 One way to deal with this problem is to deliberately delay emitting 1030 segments for one MSL after recovery from a reboot - this is the 1031 "quiet time" specification. Hosts that prefer to avoid waiting are 1032 willing to risk possible confusion of old and new packets at a given 1033 destination may choose not to wait for the "quiet time". 1034 Implementors may provide TCP users with the ability to select on a 1035 connection by connection basis whether to wait after a reboot, or may 1036 informally implement the "quiet time" for all connections. 1037 Obviously, even where a user selects to "wait," this is not necessary 1038 after the host has been "up" for at least MSL seconds. 1040 To summarize: every segment emitted occupies one or more sequence 1041 numbers in the sequence space, the numbers occupied by a segment are 1042 "busy" or "in use" until MSL seconds have passed, upon rebooting a 1043 block of space-time is occupied by the octets and SYN or FIN flags of 1044 the last emitted segment, if a new connection is started too soon and 1045 uses any of the sequence numbers in the space-time footprint of the 1046 last segment of the previous connection incarnation, there is a 1047 potential sequence number overlap area that could cause confusion at 1048 the receiver. 1050 3.4. Establishing a connection 1052 The "three-way handshake" is the procedure used to establish a 1053 connection. This procedure normally is initiated by one TCP peer and 1054 responded to by another TCP peer. The procedure also works if two 1055 TCP peers simultaneously initiate the procedure. When simultaneous 1056 open occurs, each TCP peer receives a "SYN" segment that carries no 1057 acknowledgment after it has sent a "SYN". Of course, the arrival of 1058 an old duplicate "SYN" segment can potentially make it appear, to the 1059 recipient, that a simultaneous connection initiation is in progress. 1060 Proper use of "reset" segments can disambiguate these cases. 1062 Several examples of connection initiation follow. Although these 1063 examples do not show connection synchronization using data-carrying 1064 segments, this is perfectly legitimate, so long as the receiving TCP 1065 endpoint doesn't deliver the data to the user until it is clear the 1066 data is valid (e.g., the data is buffered at the receiver until the 1067 connection reaches the ESTABLISHED state, given that the three-way 1068 handshake reduces the possibility of false connections). It is the 1069 implementation of a trade-off between memory and messages to provide 1070 information for this checking. 1072 The simplest three-way handshake is shown in Figure 5 below. The 1073 figures should be interpreted in the following way. Each line is 1074 numbered for reference purposes. Right arrows (-->) indicate 1075 departure of a TCP segment from TCP peer A to TCP peer B, or arrival 1076 of a segment at B from A. Left arrows (<--), indicate the reverse. 1077 Ellipsis (...) indicates a segment that is still in the network 1078 (delayed). Comments appear in parentheses. TCP connection states 1079 represent the state AFTER the departure or arrival of the segment 1080 (whose contents are shown in the center of each line). Segment 1081 contents are shown in abbreviated form, with sequence number, control 1082 flags, and ACK field. Other fields such as window, addresses, 1083 lengths, and text have been left out in the interest of clarity. 1085 TCP Peer A TCP Peer B 1087 1. CLOSED LISTEN 1089 2. SYN-SENT --> --> SYN-RECEIVED 1091 3. ESTABLISHED <-- <-- SYN-RECEIVED 1093 4. ESTABLISHED --> --> ESTABLISHED 1095 5. ESTABLISHED --> --> ESTABLISHED 1097 Figure 5: Basic 3-Way Handshake for Connection Synchronization 1099 In line 2 of Figure 5, TCP Peer A begins by sending a SYN segment 1100 indicating that it will use sequence numbers starting with sequence 1101 number 100. In line 3, TCP Peer B sends a SYN and acknowledges the 1102 SYN it received from TCP Peer A. Note that the acknowledgment field 1103 indicates TCP Peer B is now expecting to hear sequence 101, 1104 acknowledging the SYN that occupied sequence 100. 1106 At line 4, TCP Peer A responds with an empty segment containing an 1107 ACK for TCP Peer B's SYN; and in line 5, TCP Peer A sends some data. 1108 Note that the sequence number of the segment in line 5 is the same as 1109 in line 4 because the ACK does not occupy sequence number space (if 1110 it did, we would wind up ACKing ACK's!). 1112 Simultaneous initiation is only slightly more complex, as is shown in 1113 Figure 6. Each TCP peer's connection state cycles from CLOSED to 1114 SYN-SENT to SYN-RECEIVED to ESTABLISHED. 1116 TCP Peer A TCP Peer B 1118 1. CLOSED CLOSED 1120 2. SYN-SENT --> ... 1122 3. SYN-RECEIVED <-- <-- SYN-SENT 1124 4. ... --> SYN-RECEIVED 1126 5. SYN-RECEIVED --> ... 1128 6. ESTABLISHED <-- <-- SYN-RECEIVED 1130 7. ... --> ESTABLISHED 1132 Figure 6: Simultaneous Connection Synchronization 1134 A TCP implementation MUST support simultaneous open attempts (MUST- 1135 10). 1137 Note that a TCP implementation MUST keep track of whether a 1138 connection has reached SYN-RECEIVED state as the result of a passive 1139 OPEN or an active OPEN (MUST-11). 1141 The principal reason for the three-way handshake is to prevent old 1142 duplicate connection initiations from causing confusion. To deal 1143 with this, a special control message, reset, is specified. If the 1144 receiving TCP peer is in a non-synchronized state (i.e., SYN-SENT, 1145 SYN-RECEIVED), it returns to LISTEN on receiving an acceptable reset. 1146 If the TCP peer is in one of the synchronized states (ESTABLISHED, 1147 FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT), it 1148 aborts the connection and informs its user. We discuss this latter 1149 case under "half-open" connections below. 1151 TCP Peer A TCP Peer B 1153 1. CLOSED LISTEN 1155 2. SYN-SENT --> ... 1157 3. (duplicate) ... --> SYN-RECEIVED 1159 4. SYN-SENT <-- <-- SYN-RECEIVED 1161 5. SYN-SENT --> --> LISTEN 1163 6. ... --> SYN-RECEIVED 1165 7. SYN-SENT <-- <-- SYN-RECEIVED 1167 8. ESTABLISHED --> --> ESTABLISHED 1169 Figure 7: Recovery from Old Duplicate SYN 1171 As a simple example of recovery from old duplicates, consider 1172 Figure 7. At line 3, an old duplicate SYN arrives at TCP Peer B. 1173 TCP Peer B cannot tell that this is an old duplicate, so it responds 1174 normally (line 4). TCP Peer A detects that the ACK field is 1175 incorrect and returns a RST (reset) with its SEQ field selected to 1176 make the segment believable. TCP Peer B, on receiving the RST, 1177 returns to the LISTEN state. When the original SYN finally arrives 1178 at line 6, the synchronization proceeds normally. If the SYN at line 1179 6 had arrived before the RST, a more complex exchange might have 1180 occurred with RST's sent in both directions. 1182 Half-Open Connections and Other Anomalies 1184 An established connection is said to be "half-open" if one of the TCP 1185 peers has closed or aborted the connection at its end without the 1186 knowledge of the other, or if the two ends of the connection have 1187 become desynchronized owing to a failure or reboot that resulted in 1188 loss of memory. Such connections will automatically become reset if 1189 an attempt is made to send data in either direction. However, half- 1190 open connections are expected to be unusual. 1192 If at site A the connection no longer exists, then an attempt by the 1193 user at site B to send any data on it will result in the site B TCP 1194 endpoint receiving a reset control message. Such a message indicates 1195 to the site B TCP endpoint that something is wrong, and it is 1196 expected to abort the connection. 1198 Assume that two user processes A and B are communicating with one 1199 another when a failure or reboot occurs causing loss of memory to A's 1200 TCP implementation. Depending on the operating system supporting A's 1201 TCP implementation, it is likely that some error recovery mechanism 1202 exists. When the TCP endpoint is up again, A is likely to start 1203 again from the beginning or from a recovery point. As a result, A 1204 will probably try to OPEN the connection again or try to SEND on the 1205 connection it believes open. In the latter case, it receives the 1206 error message "connection not open" from the local (A's) TCP 1207 implementation. In an attempt to establish the connection, A's TCP 1208 implementation will send a segment containing SYN. This scenario 1209 leads to the example shown in Figure 8. After TCP Peer A reboots, 1210 the user attempts to re-open the connection. TCP Peer B, in the 1211 meantime, thinks the connection is open. 1213 TCP Peer A TCP Peer B 1215 1. (REBOOT) (send 300,receive 100) 1217 2. CLOSED ESTABLISHED 1219 3. SYN-SENT --> --> (??) 1221 4. (!!) <-- <-- ESTABLISHED 1223 5. SYN-SENT --> --> (Abort!!) 1225 6. SYN-SENT CLOSED 1227 7. SYN-SENT --> --> 1229 Figure 8: Half-Open Connection Discovery 1231 When the SYN arrives at line 3, TCP Peer B, being in a synchronized 1232 state, and the incoming segment outside the window, responds with an 1233 acknowledgment indicating what sequence it next expects to hear (ACK 1234 100). TCP Peer A sees that this segment does not acknowledge 1235 anything it sent and, being unsynchronized, sends a reset (RST) 1236 because it has detected a half-open connection. TCP Peer B aborts at 1237 line 5. TCP Peer A will continue to try to establish the connection; 1238 the problem is now reduced to the basic 3-way handshake of Figure 5. 1240 An interesting alternative case occurs when TCP Peer A reboots and 1241 TCP Peer B tries to send data on what it thinks is a synchronized 1242 connection. This is illustrated in Figure 9. In this case, the data 1243 arriving at TCP Peer A from TCP Peer B (line 2) is unacceptable 1244 because no such connection exists, so TCP Peer A sends a RST. The 1245 RST is acceptable so TCP Peer B processes it and aborts the 1246 connection. 1248 TCP Peer A TCP Peer B 1250 1. (REBOOT) (send 300,receive 100) 1252 2. (??) <-- <-- ESTABLISHED 1254 3. --> --> (ABORT!!) 1256 Figure 9: Active Side Causes Half-Open Connection Discovery 1258 In Figure 10, we find the two TCP Peers A and B with passive 1259 connections waiting for SYN. An old duplicate arriving at TCP Peer B 1260 (line 2) stirs B into action. A SYN-ACK is returned (line 3) and 1261 causes TCP A to generate a RST (the ACK in line 3 is not acceptable). 1262 TCP Peer B accepts the reset and returns to its passive LISTEN state. 1264 TCP Peer A TCP Peer B 1266 1. LISTEN LISTEN 1268 2. ... --> SYN-RECEIVED 1270 3. (??) <-- <-- SYN-RECEIVED 1272 4. --> --> (return to LISTEN!) 1274 5. LISTEN LISTEN 1276 Figure 10: Old Duplicate SYN Initiates a Reset on two Passive Sockets 1277 A variety of other cases are possible, all of which are accounted for 1278 by the following rules for RST generation and processing. 1280 Reset Generation 1282 As a general rule, reset (RST) is sent whenever a segment arrives 1283 that apparently is not intended for the current connection. A reset 1284 must not be sent if it is not clear that this is the case. 1286 There are three groups of states: 1288 1. If the connection does not exist (CLOSED) then a reset is sent 1289 in response to any incoming segment except another reset. A SYN 1290 segment that does not match an existing connection is rejected by 1291 this means. 1293 If the incoming segment has the ACK bit set, the reset takes its 1294 sequence number from the ACK field of the segment, otherwise the 1295 reset has sequence number zero and the ACK field is set to the sum 1296 of the sequence number and segment length of the incoming segment. 1297 The connection remains in the CLOSED state. 1299 2. If the connection is in any non-synchronized state (LISTEN, 1300 SYN-SENT, SYN-RECEIVED), and the incoming segment acknowledges 1301 something not yet sent (the segment carries an unacceptable ACK), 1302 or if an incoming segment has a security level or compartment that 1303 does not exactly match the level and compartment requested for the 1304 connection, a reset is sent. 1306 If the incoming segment has an ACK field, the reset takes its 1307 sequence number from the ACK field of the segment, otherwise the 1308 reset has sequence number zero and the ACK field is set to the sum 1309 of the sequence number and segment length of the incoming segment. 1310 The connection remains in the same state. 1312 3. If the connection is in a synchronized state (ESTABLISHED, 1313 FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT), 1314 any unacceptable segment (out of window sequence number or 1315 unacceptable acknowledgment number) must be responded to with an 1316 empty acknowledgment segment (without any user data) containing 1317 the current send-sequence number and an acknowledgment indicating 1318 the next sequence number expected to be received, and the 1319 connection remains in the same state. 1321 If an incoming segment has a security level, or compartment that 1322 does not exactly match the level and compartment requested for the 1323 connection, a reset is sent and the connection goes to the CLOSED 1324 state. The reset takes its sequence number from the ACK field of 1325 the incoming segment. 1327 Reset Processing 1329 In all states except SYN-SENT, all reset (RST) segments are validated 1330 by checking their SEQ-fields. A reset is valid if its sequence 1331 number is in the window. In the SYN-SENT state (a RST received in 1332 response to an initial SYN), the RST is acceptable if the ACK field 1333 acknowledges the SYN. 1335 The receiver of a RST first validates it, then changes state. If the 1336 receiver was in the LISTEN state, it ignores it. If the receiver was 1337 in SYN-RECEIVED state and had previously been in the LISTEN state, 1338 then the receiver returns to the LISTEN state, otherwise the receiver 1339 aborts the connection and goes to the CLOSED state. If the receiver 1340 was in any other state, it aborts the connection and advises the user 1341 and goes to the CLOSED state. 1343 TCP implementations SHOULD allow a received RST segment to include 1344 data (SHLD-2). 1346 3.5. Closing a Connection 1348 CLOSE is an operation meaning "I have no more data to send." The 1349 notion of closing a full-duplex connection is subject to ambiguous 1350 interpretation, of course, since it may not be obvious how to treat 1351 the receiving side of the connection. We have chosen to treat CLOSE 1352 in a simplex fashion. The user who CLOSEs may continue to RECEIVE 1353 until the TCP receiver is told that the remote peer has CLOSED also. 1354 Thus, a program could initiate several SENDs followed by a CLOSE, and 1355 then continue to RECEIVE until signaled that a RECEIVE failed because 1356 the remote peer has CLOSED. The TCP implementation will signal a 1357 user, even if no RECEIVEs are outstanding, that the remote peer has 1358 closed, so the user can terminate his side gracefully. A TCP 1359 implementation will reliably deliver all buffers SENT before the 1360 connection was CLOSED so a user who expects no data in return need 1361 only wait to hear the connection was CLOSED successfully to know that 1362 all their data was received at the destination TCP endpoint. Users 1363 must keep reading connections they close for sending until the TCP 1364 implementation indicates there is no more data. 1366 There are essentially three cases: 1368 1) The user initiates by telling the TCP implementation to CLOSE 1369 the connection 1370 2) The remote TCP endpoint initiates by sending a FIN control 1371 signal 1373 3) Both users CLOSE simultaneously 1375 Case 1: Local user initiates the close 1377 In this case, a FIN segment can be constructed and placed on the 1378 outgoing segment queue. No further SENDs from the user will be 1379 accepted by the TCP implementation, and it enters the FIN-WAIT-1 1380 state. RECEIVEs are allowed in this state. All segments 1381 preceding and including FIN will be retransmitted until 1382 acknowledged. When the other TCP peer has both acknowledged the 1383 FIN and sent a FIN of its own, the first TCP peer can ACK this 1384 FIN. Note that a TCP endpoint receiving a FIN will ACK but not 1385 send its own FIN until its user has CLOSED the connection also. 1387 Case 2: TCP endpoint receives a FIN from the network 1389 If an unsolicited FIN arrives from the network, the receiving TCP 1390 endpoint can ACK it and tell the user that the connection is 1391 closing. The user will respond with a CLOSE, upon which the TCP 1392 endpoint can send a FIN to the other TCP peer after sending any 1393 remaining data. The TCP endpoint then waits until its own FIN is 1394 acknowledged whereupon it deletes the connection. If an ACK is 1395 not forthcoming, after the user timeout the connection is aborted 1396 and the user is told. 1398 Case 3: Both users close simultaneously 1400 A simultaneous CLOSE by users at both ends of a connection causes 1401 FIN segments to be exchanged. When all segments preceding the 1402 FINs have been processed and acknowledged, each TCP peer can ACK 1403 the FIN it has received. Both will, upon receiving these ACKs, 1404 delete the connection. 1406 TCP Peer A TCP Peer B 1408 1. ESTABLISHED ESTABLISHED 1410 2. (Close) 1411 FIN-WAIT-1 --> --> CLOSE-WAIT 1413 3. FIN-WAIT-2 <-- <-- CLOSE-WAIT 1415 4. (Close) 1416 TIME-WAIT <-- <-- LAST-ACK 1418 5. TIME-WAIT --> --> CLOSED 1420 6. (2 MSL) 1421 CLOSED 1423 Figure 11: Normal Close Sequence 1425 TCP Peer A TCP Peer B 1427 1. ESTABLISHED ESTABLISHED 1429 2. (Close) (Close) 1430 FIN-WAIT-1 --> ... FIN-WAIT-1 1431 <-- <-- 1432 ... --> 1434 3. CLOSING --> ... CLOSING 1435 <-- <-- 1436 ... --> 1438 4. TIME-WAIT TIME-WAIT 1439 (2 MSL) (2 MSL) 1440 CLOSED CLOSED 1442 Figure 12: Simultaneous Close Sequence 1444 A TCP connection may terminate in two ways: (1) the normal TCP close 1445 sequence using a FIN handshake, and (2) an "abort" in which one or 1446 more RST segments are sent and the connection state is immediately 1447 discarded. If the local TCP connection is closed by the remote side 1448 due to a FIN or RST received from the remote side, then the local 1449 application MUST be informed whether it closed normally or was 1450 aborted (MUST-12). 1452 3.5.1. Half-Closed Connections 1454 The normal TCP close sequence delivers buffered data reliably in both 1455 directions. Since the two directions of a TCP connection are closed 1456 independently, it is possible for a connection to be "half closed," 1457 i.e., closed in only one direction, and a host is permitted to 1458 continue sending data in the open direction on a half-closed 1459 connection. 1461 A host MAY implement a "half-duplex" TCP close sequence, so that an 1462 application that has called CLOSE cannot continue to read data from 1463 the connection (MAY-1). If such a host issues a CLOSE call while 1464 received data is still pending in the TCP connection, or if new data 1465 is received after CLOSE is called, its TCP implementation SHOULD send 1466 a RST to show that data was lost (SHLD-3). See [17] section 2.17 for 1467 discussion. 1469 When a connection is closed actively, it MUST linger in TIME-WAIT 1470 state for a time 2xMSL (Maximum Segment Lifetime) (MUST-13). 1471 However, it MAY accept a new SYN from the remote TCP endpoint to 1472 reopen the connection directly from TIME-WAIT state (MAY-2), if it: 1474 (1) assigns its initial sequence number for the new connection to 1475 be larger than the largest sequence number it used on the previous 1476 connection incarnation, and 1478 (2) returns to TIME-WAIT state if the SYN turns out to be an old 1479 duplicate. 1481 When the TCP Timestamp options are available, an improved algorithm 1482 is described in [33] in order to support higher connection 1483 establishment rates. This algorithm for reducing TIME-WAIT is a Best 1484 Current Practice that SHOULD be implemented, since timestamp options 1485 are commonly used, and using them to reduce TIME-WAIT provides 1486 benefits for busy Internet servers (SHLD-4). 1488 3.6. Segmentation 1490 The term "segmentation" refers to the activity TCP performs when 1491 ingesting a stream of bytes from a sending application and 1492 packetizing that stream of bytes into TCP segments. Individual TCP 1493 segments often do not correspond one-for-one to individual send (or 1494 socket write) calls from the application. Applications may perform 1495 writes at the granularity of messages in the upper layer protocol, 1496 but TCP guarantees no boundary coherence between the TCP segments 1497 sent and received versus user application data read or write buffer 1498 boundaries. In some specific protocols, such as RDMA using DDP and 1499 MPA [25], there are performance optimizations possible when the 1500 relation between TCP segments and application data units can be 1501 controlled, and MPA includes a specific mechanism for detecting and 1502 verifying this relationship between TCP segments and application 1503 message data strcutures, but this is specific to applications like 1504 RDMA. In general, multiple goals influence the sizing of TCP 1505 segments created by a TCP implementation. 1507 Goals driving the sending of larger segments include: 1509 o Reducing the number of packets in flight within the network. 1511 o Increasing processing efficiency and potential performance by 1512 enabling a smaller number of interrupts and inter-layer 1513 interactions. 1515 o Limiting the overhead of TCP headers. 1517 Note that the performance benefits of sending larger segments may 1518 decrease as the size increases, and there may be boundaries where 1519 advantages are reversed. For instance, on some implementation 1520 architectures, 1025 bytes within a segment could lead to worse 1521 performance than 1024 bytes, due purely to data alignment on copy 1522 operations. 1524 Goals driving the sending of smaller segments include: 1526 o Avoiding sending a TCP segment that would result in an IP datagram 1527 larger than the smallest MTU along an IP network path, because 1528 this results in either packet loss or packet fragmentation. 1529 Making matters worse, some firewalls or middleboxes may drop 1530 fragmented packets or ICMP messages related related to 1531 fragmentation. 1533 o Preventing delays to the application data stream, especially when 1534 TCP is waiting on the application to generate more data, or when 1535 the application is waiting on an event or input from its peer in 1536 order to generate more data. 1538 o Enabling "fate sharing" between TCP segments and lower-layer data 1539 units (e.g. below IP, for links with cell or frame sizes smaller 1540 than the IP MTU). 1542 Towards meeting these competing sets of goals, TCP includes several 1543 mechanisms, including the Maximum Segment Size option, Path MTU 1544 Discovery, the Nagle algorithm, and support for IPv6 Jumbograms, as 1545 discussed in the following subsections. 1547 3.6.1. Maximum Segment Size Option 1549 TCP endpoints MUST implement both sending and receiving the MSS 1550 option (MUST-14). 1552 TCP implementations SHOULD send an MSS option in every SYN segment 1553 when its receive MSS differs from the default 536 for IPv4 or 1220 1554 for IPv6 (SHLD-5), and MAY send it always (MAY-3). 1556 If an MSS option is not received at connection setup, TCP 1557 implementations MUST assume a default send MSS of 536 (576-40) for 1558 IPv4 or 1220 (1280 - 60) for IPv6 (MUST-15). 1560 The maximum size of a segment that TCP endpoint really sends, the 1561 "effective send MSS," MUST be the smaller (MUST-16) of the send MSS 1562 (that reflects the available reassembly buffer size at the remote 1563 host, the EMTU_R [14]) and the largest transmission size permitted by 1564 the IP layer (EMTU_S [14]): 1566 Eff.snd.MSS = 1568 min(SendMSS+20, MMS_S) - TCPhdrsize - IPoptionsize 1570 where: 1572 o SendMSS is the MSS value received from the remote host, or the 1573 default 536 for IPv4 or 1220 for IPv6, if no MSS option is 1574 received. 1576 o MMS_S is the maximum size for a transport-layer message that TCP 1577 may send. 1579 o TCPhdrsize is the size of the fixed TCP header and any options. 1580 This is 20 in the (rare) case that no options are present, but may 1581 be larger if TCP options are to be sent. Note that some options 1582 may not be included on all segments, but that for each segment 1583 sent, the sender should adjust the data length accordingly, within 1584 the Eff.snd.MSS. 1586 o IPoptionsize is the size of any IP options associated with a TCP 1587 connection. Note that some options may not be included on all 1588 packets, but that for each segment sent, the sender should adjust 1589 the data length accordingly, within the Eff.snd.MSS. 1591 The MSS value to be sent in an MSS option should be equal to the 1592 effective MTU minus the fixed IP and TCP headers. By ignoring both 1593 IP and TCP options when calculating the value for the MSS option, if 1594 there are any IP or TCP options to be sent in a packet, then the 1595 sender must decrease the size of the TCP data accordingly. RFC 6691 1596 [36] discusses this in greater detail. 1598 The MSS value to be sent in an MSS option must be less than or equal 1599 to: 1601 MMS_R - 20 1603 where MMS_R is the maximum size for a transport-layer message that 1604 can be received (and reassembled at the IP layer) (MUST-67). TCP 1605 obtains MMS_R and MMS_S from the IP layer; see the generic call 1606 GET_MAXSIZES in Section 3.4 of RFC 1122. These are defined in terms 1607 of their IP MTU equivalents, EMTU_R and EMTU_S [14]. 1609 When TCP is used in a situation where either the IP or TCP headers 1610 are not fixed, the sender must reduce the amount of TCP data in any 1611 given packet by the number of octets used by the IP and TCP options. 1612 This has been a point of confusion historically, as explained in RFC 1613 6691, Section 3.1. 1615 3.6.2. Path MTU Discovery 1617 A TCP implementation may be aware of the MTU on directly connected 1618 links, but will rarely have insight about MTUs across an entire 1619 network path. For IPv4, RFC 1122 provides an IP-layer recommendation 1620 on the default effective MTU for sending to be less than or equal to 1621 576 for destinations not directly connected. For IPv6, this would be 1622 1280. In all cases, however, implementation of Path MTU Discovery 1623 (PMTUD) and Packetization Layer Path MTU Discovery (PLPMTUD) is 1624 strongly recommended in order for TCP to improve segmentation 1625 decisions. Both PMTUD and PLPMTUD help TCP choose segment sizes that 1626 avoid both on-path (for IPv4) and source fragmentation (IPv4 and 1627 IPv6). 1629 PMTUD for IPv4 [2] or IPv6 [3] is implemented in conjunction between 1630 TCP, IP, and ICMP protocols. It relies both on avoiding source 1631 fragmentation and setting the IPv4 DF (don't fragment) flag, the 1632 latter to inhibit on-path fragmentation. It relies on ICMP errors 1633 from routers along the path, whenever a segment is too large to 1634 traverse a link. Several adjustments to a TCP implementation with 1635 PMTUD are described in RFC 2923 in order to deal with problems 1636 experienced in practice [7]. PLPMTUD [22] is a Standards Track 1637 improvement to PMTUD that relaxes the requirement for ICMP support 1638 across a path, and improves performance in cases where ICMP is not 1639 consistently conveyed, but still tries to avoid source fragmentation. 1640 The mechanisms in all four of these RFCs are recommended to be 1641 included in TCP implementations. 1643 The TCP MSS option specifies an upper bound for the size of packets 1644 that can be received. Hence, setting the value in the MSS option too 1645 small can impact the ability for PMTUD or PLPMTUD to find a larger 1646 path MTU. RFC 1191 discusses this implication of many older TCP 1647 implementations setting MSS to 536 for non-local destinations, rather 1648 than deriving it from the MTUs of connected interfaces as 1649 recommended. 1651 3.6.3. Interfaces with Variable MTU Values 1653 The effective MTU can sometimes vary, as when used with variable 1654 compression, e.g., RObust Header Compression (ROHC) [29]. It is 1655 tempting for a TCP implementation to want to advertise the largest 1656 possible MSS, to support the most efficient use of compressed 1657 payloads. Unfortunately, some compression schemes occasionally need 1658 to transmit full headers (and thus smaller payloads) to resynchronize 1659 state at their endpoint compressors/decompressors. If the largest 1660 MTU is used to calculate the value to advertise in the MSS option, 1661 TCP retransmission may interfere with compressor resynchronization. 1663 As a result, when the effective MTU of an interface varies packet-to- 1664 packet, TCP implementations SHOULD use the smallest effective MTU of 1665 the interface to calculate the value to advertise in the MSS option 1666 (SHLD-6). 1668 3.6.4. Nagle Algorithm 1670 The "Nagle algorithm" was described in RFC 896 [13] and was 1671 recommended in RFC 1122 [14] for mitigation of an early problem of 1672 too many small packets being generated. It has been implemented in 1673 most current TCP code bases, sometimes with minor variations (see 1674 Appendix A.3). 1676 If there is unacknowledged data (i.e., SND.NXT > SND.UNA), then the 1677 sending TCP endpoint buffers all user data (regardless of the PSH 1678 bit), until the outstanding data has been acknowledged or until the 1679 TCP endpoint can send a full-sized segment (Eff.snd.MSS bytes). 1681 A TCP implementation SHOULD implement the Nagle Algorithm to coalesce 1682 short segments (SHLD-7). However, there MUST be a way for an 1683 application to disable the Nagle algorithm on an individual 1684 connection (MUST-17). In all cases, sending data is also subject to 1685 the limitation imposed by the Slow Start algorithm [28]. 1687 3.6.5. IPv6 Jumbograms 1689 In order to support TCP over IPv6 jumbograms, implementations need to 1690 be able to send TCP segments larger than the 64KB limit that the MSS 1691 option can convey. RFC 2675 [6] defines that an MSS value of 65,535 1692 bytes is to be treated as infinity, and Path MTU Discovery [3] is 1693 used to determine the actual MSS. 1695 The Jumbo Payload option need not be implemented or understood by 1696 IPv6 nodes that do not support attachment to links with a MTU greater 1697 than 65,575 [6], and the present IPv6 Node Requiements does not 1698 include support for Jumbograms [46]. 1700 3.7. Data Communication 1702 Once the connection is established data is communicated by the 1703 exchange of segments. Because segments may be lost due to errors 1704 (checksum test failure), or network congestion, TCP uses 1705 retransmission to ensure delivery of every segment. Duplicate 1706 segments may arrive due to network or TCP retransmission. As 1707 discussed in the section on sequence numbers the TCP implementation 1708 performs certain tests on the sequence and acknowledgment numbers in 1709 the segments to verify their acceptability. 1711 The sender of data keeps track of the next sequence number to use in 1712 the variable SND.NXT. The receiver of data keeps track of the next 1713 sequence number to expect in the variable RCV.NXT. The sender of 1714 data keeps track of the oldest unacknowledged sequence number in the 1715 variable SND.UNA. If the data flow is momentarily idle and all data 1716 sent has been acknowledged then the three variables will be equal. 1718 When the sender creates a segment and transmits it the sender 1719 advances SND.NXT. When the receiver accepts a segment it advances 1720 RCV.NXT and sends an acknowledgment. When the data sender receives 1721 an acknowledgment it advances SND.UNA. The extent to which the 1722 values of these variables differ is a measure of the delay in the 1723 communication. The amount by which the variables are advanced is the 1724 length of the data and SYN or FIN flags in the segment. Note that 1725 once in the ESTABLISHED state all segments must carry current 1726 acknowledgment information. 1728 The CLOSE user call implies a push function, as does the FIN control 1729 flag in an incoming segment. 1731 3.7.1. Retransmission Timeout 1733 Because of the variability of the networks that compose an 1734 internetwork system and the wide range of uses of TCP connections the 1735 retransmission timeout (RTO) must be dynamically determined. 1737 The RTO MUST be computed according to the algorithm in [9], including 1738 Karn's algorithm for taking RTT samples (MUST-18). 1740 RFC 793 contains an early example procedure for computing the RTO. 1741 This was then replaced by the algorithm described in RFC 1122, and 1742 subsequently updated in RFC 2988, and then again in RFC 6298. 1744 RFC 1122 allows that if a retransmitted packet is identical to the 1745 original packet (which implies not only that the data boundaries have 1746 not changed, but also that none of the headers have changed), then 1747 the same IPv4 Identification field MAY be used (see Section 3.2.1.5 1748 of RFC 1122) (MAY-4). The same IP identification field may be reused 1749 anyways, since it is only meaningful when a datagram is fragmented 1750 [37]. TCP implementations should not rely on or typically interact 1751 with this IPv4 header field in any way. It is not a reasonable way 1752 to either indicate duplicate sent segments, nor to identify duplicate 1753 received segments. 1755 3.7.2. TCP Congestion Control 1757 RFC 1122 required implementation of Van Jacobson's congestion control 1758 algorithm combining slow start with congestion avoidance. RFC 2581 1759 provided IETF Standards Track description of this, along with fast 1760 retransmit and fast recovery. RFC 5681 is the current description of 1761 these algorithms and is the current standard for TCP congestion 1762 control. 1764 A TCP endpoint MUST implement RFC 5681 (MUST-19). 1766 Explicit Congestion Notification (ECN) was defined in RFC 3168 and is 1767 an IETF Standards Track enhancement that has many benefits [43]. 1769 A TCP endpoint SHOULD implement ECN as described in RFC 3168 (SHLD- 1770 8). 1772 3.7.3. TCP Connection Failures 1774 Excessive retransmission of the same segment by a TCP endpoint 1775 indicates some failure of the remote host or the Internet path. This 1776 failure may be of short or long duration. The following procedure 1777 MUST be used to handle excessive retransmissions of data segments 1778 (MUST-20): 1780 (a) There are two thresholds R1 and R2 measuring the amount of 1781 retransmission that has occurred for the same segment. R1 and R2 1782 might be measured in time units or as a count of retransmissions. 1784 (b) When the number of transmissions of the same segment reaches 1785 or exceeds threshold R1, pass negative advice (see [14] 1786 Section 3.3.1.4) to the IP layer, to trigger dead-gateway 1787 diagnosis. 1789 (c) When the number of transmissions of the same segment reaches a 1790 threshold R2 greater than R1, close the connection. 1792 (d) An application MUST (MUST-21) be able to set the value for R2 1793 for a particular connection. For example, an interactive 1794 application might set R2 to "infinity," giving the user control 1795 over when to disconnect. 1797 (e) TCP implementations SHOULD inform the application of the 1798 delivery problem (unless such information has been disabled by the 1799 application; see Asynchronous Reports section), when R1 is reached 1800 and before R2 (SHLD-9). This will allow a remote login (User 1801 Telnet) application program to inform the user, for example. 1803 The value of R1 SHOULD correspond to at least 3 retransmissions, at 1804 the current RTO (SHLD-10). The value of R2 SHOULD correspond to at 1805 least 100 seconds (SHLD-11). 1807 An attempt to open a TCP connection could fail with excessive 1808 retransmissions of the SYN segment or by receipt of a RST segment or 1809 an ICMP Port Unreachable. SYN retransmissions MUST be handled in the 1810 general way just described for data retransmissions, including 1811 notification of the application layer. 1813 However, the values of R1 and R2 may be different for SYN and data 1814 segments. In particular, R2 for a SYN segment MUST be set large 1815 enough to provide retransmission of the segment for at least 3 1816 minutes (MUST-23). The application can close the connection (i.e., 1817 give up on the open attempt) sooner, of course. 1819 3.7.4. TCP Keep-Alives 1821 Implementors MAY include "keep-alives" in their TCP implementations 1822 (MAY-5), although this practice is not universally accepted. Some 1823 TCP implementations, however, have included a keep-alive mechanism. 1824 To confirm that an idle connection is still active, these 1825 implementations send a probe segment designed to elicit a response 1826 from the TCP peer. Such a segment generally contains SEG.SEQ = 1827 SND.NXT-1 and may or may not contain one garbage octet of data. If 1828 keep-alives are included, the application MUST be able to turn them 1829 on or off for each TCP connection (MUST-24), and they MUST default to 1830 off (MUST-25). 1832 Keep-alive packets MUST only be sent when no data or acknowledgement 1833 packets have been received for the connection within an interval 1834 (MUST-26). This interval MUST be configurable (MUST-27) and MUST 1835 default to no less than two hours (MUST-28). 1837 It is extremely important to remember that ACK segments that contain 1838 no data are not reliably transmitted by TCP. Consequently, if a 1839 keep-alive mechanism is implemented it MUST NOT interpret failure to 1840 respond to any specific probe as a dead connection (MUST-29). 1842 An implementation SHOULD send a keep-alive segment with no data 1843 (SHLD-12); however, it MAY be configurable to send a keep-alive 1844 segment containing one garbage octet (MAY-6), for compatibility with 1845 erroneous TCP implementations. 1847 3.7.5. The Communication of Urgent Information 1849 As a result of implementation differences and middlebox interactions, 1850 new applications SHOULD NOT employ the TCP urgent mechanism (SHLD- 1851 13). However, TCP implementations MUST still include support for the 1852 urgent mechanism (MUST-30). Details can be found in RFC 6093 [32]. 1854 The objective of the TCP urgent mechanism is to allow the sending 1855 user to stimulate the receiving user to accept some urgent data and 1856 to permit the receiving TCP endpoint to indicate to the receiving 1857 user when all the currently known urgent data has been received by 1858 the user. 1860 This mechanism permits a point in the data stream to be designated as 1861 the end of urgent information. Whenever this point is in advance of 1862 the receive sequence number (RCV.NXT) at the receiving TCP endpoint, 1863 that TCP must tell the user to go into "urgent mode"; when the 1864 receive sequence number catches up to the urgent pointer, the TCP 1865 implementation must tell user to go into "normal mode". If the 1866 urgent pointer is updated while the user is in "urgent mode", the 1867 update will be invisible to the user. 1869 The method employs a urgent field that is carried in all segments 1870 transmitted. The URG control flag indicates that the urgent field is 1871 meaningful and must be added to the segment sequence number to yield 1872 the urgent pointer. The absence of this flag indicates that there is 1873 no urgent data outstanding. 1875 To send an urgent indication the user must also send at least one 1876 data octet. If the sending user also indicates a push, timely 1877 delivery of the urgent information to the destination process is 1878 enhanced. 1880 A TCP implementation MUST support a sequence of urgent data of any 1881 length (MUST-31). [14] 1883 The urgent pointer MUST point to the sequence number of the octet 1884 following the urgent data (MUST-62). 1886 A TCP implementation MUST (MUST-32) inform the application layer 1887 asynchronously whenever it receives an Urgent pointer and there was 1888 previously no pending urgent data, or whenvever the Urgent pointer 1889 advances in the data stream. There MUST (MUST-33) be a way for the 1890 application to learn how much urgent data remains to be read from the 1891 connection, or at least to determine whether or not more urgent data 1892 remains to be read. [14] 1894 3.7.6. Managing the Window 1896 The window sent in each segment indicates the range of sequence 1897 numbers the sender of the window (the data receiver) is currently 1898 prepared to accept. There is an assumption that this is related to 1899 the currently available data buffer space available for this 1900 connection. 1902 The sending TCP endpoint packages the data to be transmitted into 1903 segments that fit the current window, and may repackage segments on 1904 the retransmission queue. Such repackaging is not required, but may 1905 be helpful. 1907 In a connection with a one-way data flow, the window information will 1908 be carried in acknowledgment segments that all have the same sequence 1909 number so there will be no way to reorder them if they arrive out of 1910 order. This is not a serious problem, but it will allow the window 1911 information to be on occasion temporarily based on old reports from 1912 the data receiver. A refinement to avoid this problem is to act on 1913 the window information from segments that carry the highest 1914 acknowledgment number (that is segments with acknowledgment number 1915 equal or greater than the highest previously received). 1917 Indicating a large window encourages transmissions. If more data 1918 arrives than can be accepted, it will be discarded. This will result 1919 in excessive retransmissions, adding unnecessarily to the load on the 1920 network and the TCP endpoints. Indicating a small window may 1921 restrict the transmission of data to the point of introducing a round 1922 trip delay between each new segment transmitted. 1924 The mechanisms provided allow a TCP endpoint to advertise a large 1925 window and to subsequently advertise a much smaller window without 1926 having accepted that much data. This, so called "shrinking the 1927 window," is strongly discouraged. The robustness principle [14] 1928 dictates that TCP peers will not shrink the window themselves, but 1929 will be prepared for such behavior on the part of other TCP peers. 1931 A TCP receiver SHOULD NOT shrink the window, i.e., move the right 1932 window edge to the left (SHLD-14). However, a sending TCP peer MUST 1933 be robust against window shrinking, which may cause the "useable 1934 window" (see Section 3.7.6.2.1) to become negative (MUST-34). 1936 If this happens, the sender SHOULD NOT send new data (SHLD-15), but 1937 SHOULD retransmit normally the old unacknowledged data between 1938 SND.UNA and SND.UNA+SND.WND (SHLD-16). The sender MAY also 1939 retransmit old data beyond SND.UNA+SND.WND (MAY-7), but SHOULD NOT 1940 time out the connection if data beyond the right window edge is not 1941 acknowledged (SHLD-17). If the window shrinks to zero, the TCP 1942 implementation MUST probe it in the standard way (described below) 1943 (MUST-35). 1945 3.7.6.1. Zero Window Probing 1947 The sending TCP peer must be prepared to accept from the user and 1948 send at least one octet of new data even if the send window is zero. 1949 The sending TCP peer must regularly retransmit to the receiving TCP 1950 peer even when the window is zero, in order to "probe" the window. 1951 Two minutes is recommended for the retransmission interval when the 1952 window is zero. This retransmission is essential to guarantee that 1953 when either TCP peer has a zero window the re-opening of the window 1954 will be reliably reported to the other. This is referred to as Zero- 1955 Window Probing (ZWP) in other documents. 1957 Probing of zero (offered) windows MUST be supported (MUST-36). 1959 A TCP implementation MAY keep its offered receive window closed 1960 indefinitely (MAY-8). As long as the receiving TCP peer continues to 1961 send acknowledgments in response to the probe segments, the sending 1962 TCP peer MUST allow the connection to stay open (MUST-37). This 1963 enables TCP to function in scenarios such as the "printer ran out of 1964 paper" situation described in Section 4.2.2.17 of RFC1122. The 1965 behavior is subject to the implementation's resource management 1966 concerns, as noted in [34]. 1968 When the receiving TCP peer has a zero window and a segment arrives 1969 it must still send an acknowledgment showing its next expected 1970 sequence number and current window (zero). 1972 The transmitting host SHOULD send the first zero-window probe when a 1973 zero window has existed for the retransmission timeout period (SHLD- 1974 29) (see Section 3.7.1), and SHOULD increase exponentially the 1975 interval between successive probes (SHLD-30). 1977 3.7.6.2. Silly Window Syndrome Avoidance 1979 The "Silly Window Syndrome" (SWS) is a stable pattern of small 1980 incremental window movements resulting in extremely poor TCP 1981 performance. Algorithms to avoid SWS are described below for both 1982 the sending side and the receiving side. RFC 1122 contains more 1983 detailed discussion of the SWS problem. Note that the Nagle 1984 algorithm and the sender SWS avoidance algorithm play complementary 1985 roles in improving performance. The Nagle algorithm discourages 1986 sending tiny segments when the data to be sent increases in small 1987 increments, while the SWS avoidance algorithm discourages small 1988 segments resulting from the right window edge advancing in small 1989 increments. 1991 3.7.6.2.1. Sender's Algorithm - When to Send Data 1993 A TCP implementation MUST include a SWS avoidance algorithm in the 1994 sender (MUST-38). 1996 The Nagle algorithm from Section 3.6.4 additionally describes how to 1997 coalesce short segments. 1999 The sender's SWS avoidance algorithm is more difficult than the 2000 receivers's, because the sender does not know (directly) the 2001 receiver's total buffer space RCV.BUFF. An approach that has been 2002 found to work well is for the sender to calculate Max(SND.WND), the 2003 maximum send window it has seen so far on the connection, and to use 2004 this value as an estimate of RCV.BUFF. Unfortunately, this can only 2005 be an estimate; the receiver may at any time reduce the size of 2006 RCV.BUFF. To avoid a resulting deadlock, it is necessary to have a 2007 timeout to force transmission of data, overriding the SWS avoidance 2008 algorithm. In practice, this timeout should seldom occur. 2010 The "useable window" is: 2012 U = SND.UNA + SND.WND - SND.NXT 2014 i.e., the offered window less the amount of data sent but not 2015 acknowledged. If D is the amount of data queued in the sending TCP 2016 endpoint but not yet sent, then the following set of rules is 2017 recommended. 2019 Send data: 2021 (1) if a maximum-sized segment can be sent, i.e, if: 2023 min(D,U) >= Eff.snd.MSS; 2025 (2) or if the data is pushed and all queued data can be sent now, 2026 i.e., if: 2028 [SND.NXT = SND.UNA and] PUSHED and D <= U 2030 (the bracketed condition is imposed by the Nagle algorithm); 2032 (3) or if at least a fraction Fs of the maximum window can be sent, 2033 i.e., if: 2035 [SND.NXT = SND.UNA and] 2037 min(D.U) >= Fs * Max(SND.WND); 2039 (4) or if data is PUSHed and the override timeout occurs. 2041 Here Fs is a fraction whose recommended value is 1/2. The override 2042 timeout should be in the range 0.1 - 1.0 seconds. It may be 2043 convenient to combine this timer with the timer used to probe zero 2044 windows (Section Section 3.7.6.1). 2046 3.7.6.2.2. Receiver's Algorithm - When to Send a Window Update 2048 A TCP implementation MUST include a SWS avoidance algorithm in the 2049 receiver (MUST-39). 2051 The receiver's SWS avoidance algorithm determines when the right 2052 window edge may be advanced; this is customarily known as "updating 2053 the window". This algorithm combines with the delayed ACK algorithm 2054 (see Section 3.7.6.3) to determine when an ACK segment containing the 2055 current window will really be sent to the receiver. 2057 The solution to receiver SWS is to avoid advancing the right window 2058 edge RCV.NXT+RCV.WND in small increments, even if data is received 2059 from the network in small segments. 2061 Suppose the total receive buffer space is RCV.BUFF. At any given 2062 moment, RCV.USER octets of this total may be tied up with data that 2063 has been received and acknowledged but that the user process has not 2064 yet consumed. When the connection is quiescent, RCV.WND = RCV.BUFF 2065 and RCV.USER = 0. 2067 Keeping the right window edge fixed as data arrives and is 2068 acknowledged requires that the receiver offer less than its full 2069 buffer space, i.e., the receiver must specify a RCV.WND that keeps 2070 RCV.NXT+RCV.WND constant as RCV.NXT increases. Thus, the total 2071 buffer space RCV.BUFF is generally divided into three parts: 2073 |<------- RCV.BUFF ---------------->| 2074 1 2 3 2075 ----|---------|------------------|------|---- 2076 RCV.NXT ^ 2077 (Fixed) 2079 1 - RCV.USER = data received but not yet consumed; 2080 2 - RCV.WND = space advertised to sender; 2081 3 - Reduction = space available but not yet 2082 advertised. 2084 The suggested SWS avoidance algorithm for the receiver is to keep 2085 RCV.NXT+RCV.WND fixed until the reduction satisfies: 2087 RCV.BUFF - RCV.USER - RCV.WND >= 2089 min( Fr * RCV.BUFF, Eff.snd.MSS ) 2091 where Fr is a fraction whose recommended value is 1/2, and 2092 Eff.snd.MSS is the effective send MSS for the connection (see 2093 Section 3.6.1). When the inequality is satisfied, RCV.WND is set to 2094 RCV.BUFF-RCV.USER. 2096 Note that the general effect of this algorithm is to advance RCV.WND 2097 in increments of Eff.snd.MSS (for realistic receive buffers: 2098 Eff.snd.MSS < RCV.BUFF/2). Note also that the receiver must use its 2099 own Eff.snd.MSS, assuming it is the same as the sender's. 2101 3.7.6.3. Delayed Acknowledgements - When to Send an ACK Segment 2103 A host that is receiving a stream of TCP data segments can increase 2104 efficiency in both the Internet and the hosts by sending fewer than 2105 one ACK (acknowledgment) segment per data segment received; this is 2106 known as a "delayed ACK". 2108 A TCP endpoint SHOULD implement a delayed ACK (SHLD-18), but an ACK 2109 should not be excessively delayed; in particular, the delay MUST be 2110 less than 0.5 seconds (MUST-40), and in a stream of full-sized 2111 segments there SHOULD be an ACK for at least every second segment 2112 (SHLD-19). Excessive delays on ACK's can disturb the round-trip 2113 timing and packet "clocking" algorithms. More complete discussion of 2114 delayed ACK behavior is in Section 4.2 of RFC 5681 [28], including 2115 rules for streams of segments that are not full-sized. Note that 2116 there are several current practices that further lead to a reduced 2117 number of ACKs, including generic receive offload (GRO), ACK 2118 compression, and ACK decimation [19]. 2120 3.8. Interfaces 2122 There are of course two interfaces of concern: the user/TCP interface 2123 and the TCP/lower-level interface. We have a fairly elaborate model 2124 of the user/TCP interface, but the interface to the lower level 2125 protocol module is left unspecified here, since it will be specified 2126 in detail by the specification of the lower level protocol. For the 2127 case that the lower level is IP we note some of the parameter values 2128 that TCP implementations might use. 2130 3.8.1. User/TCP Interface 2132 The following functional description of user commands to the TCP 2133 implementation is, at best, fictional, since every operating system 2134 will have different facilities. Consequently, we must warn readers 2135 that different TCP implementations may have different user 2136 interfaces. However, all TCP implementations must provide a certain 2137 minimum set of services to guarantee that all TCP implementations can 2138 support the same protocol hierarchy. This section specifies the 2139 functional interfaces required of all TCP implementations. 2141 Section 3.1 of [45] also identifies primitives provided by TCP, and 2142 could be used as an additional reference for implementers. 2144 TCP User Commands 2146 The following sections functionally characterize a USER/TCP 2147 interface. The notation used is similar to most procedure or 2148 function calls in high level languages, but this usage is not 2149 meant to rule out trap type service calls. 2151 The user commands described below specify the basic functions the 2152 TCP implementation must perform to support interprocess 2153 communication. Individual implementations must define their own 2154 exact format, and may provide combinations or subsets of the basic 2155 functions in single calls. In particular, some implementations 2156 may wish to automatically OPEN a connection on the first SEND or 2157 RECEIVE issued by the user for a given connection. 2159 In providing interprocess communication facilities, the TCP 2160 implementation must not only accept commands, but must also return 2161 information to the processes it serves. The latter consists of: 2163 (a) general information about a connection (e.g., interrupts, 2164 remote close, binding of unspecified remote socket). 2166 (b) replies to specific user commands indicating success or 2167 various types of failure. 2169 Open 2171 Format: OPEN (local port, remote socket, active/passive [, 2172 timeout] [, DiffServ field] [, security/compartment] [local IP 2173 address,] [, options]) -> local connection name 2175 If the active/passive flag is set to passive, then this is a 2176 call to LISTEN for an incoming connection. A passive open may 2177 have either a fully specified remote socket to wait for a 2178 particular connection or an unspecified remote socket to wait 2179 for any call. A fully specified passive call can be made 2180 active by the subsequent execution of a SEND. 2182 A transmission control block (TCB) is created and partially 2183 filled in with data from the OPEN command parameters. 2185 Every passive OPEN call either creates a new connection record 2186 in LISTEN state, or it returns an error; it MUST NOT affect any 2187 previously created connection record (MUST-41). 2189 A TCP implementation that supports multiple concurrent users 2190 MUST provide an OPEN call that will functionally allow an 2191 application to LISTEN on a port while a connection block with 2192 the same local port is in SYN-SENT or SYN-RECEIVED state (MUST- 2193 42). 2195 On an active OPEN command, the TCP endpoint will begin the 2196 procedure to synchronize (i.e., establish) the connection at 2197 once. 2199 The timeout, if present, permits the caller to set up a timeout 2200 for all data submitted to TCP. If data is not successfully 2201 delivered to the destination within the timeout period, the TCP 2202 endpoint will abort the connection. The present global default 2203 is five minutes. 2205 The TCP implementation or some component of the operating 2206 system will verify the users authority to open a connection 2207 with the specified DiffServ field value or security/ 2208 compartment. The absence of a DiffServ field value or 2209 security/compartment specification in the OPEN call indicates 2210 the default values must be used. 2212 TCP will accept incoming requests as matching only if the 2213 security/compartment information is exactly the same as that 2214 requested in the OPEN call. 2216 The DiffServ field value indicated by the user only impacts 2217 outgoing packets, may be altered en route through the network, 2218 and has no direct bearing or relation to received packets. 2220 A local connection name will be returned to the user by the TCP 2221 implementation. The local connection name can then be used as 2222 a short hand term for the connection defined by the pair. 2225 The optional "local IP address" parameter MUST be supported to 2226 allow the specification of the local IP address (MUST-43). 2227 This enables applications that need to select the local IP 2228 address used when multihoming is present. 2230 A passive OPEN call with a specified "local IP address" 2231 parameter will await an incoming connection request to that 2232 address. If the parameter is unspecified, a passive OPEN will 2233 await an incoming connection request to any local IP address, 2234 and then bind the local IP address of the connection to the 2235 particular address that is used. 2237 For an active OPEN call, a specified "local IP address" 2238 parameter will be used for opening the connection. If the 2239 parameter is unspecified, the host will choose an appropriate 2240 local IP address (see RFC 1122 section 3.3.4.2). 2242 If an application on a multihomed host does not specify the 2243 local IP address when actively opening a TCP connection, then 2244 the TCP implementation MUST ask the IP layer to select a local 2245 IP address before sending the (first) SYN (MUST-44). See the 2246 function GET_SRCADDR() in Section 3.4 of RFC 1122. 2248 At all other times, a previous segment has either been sent or 2249 received on this connection, and TCP implementations MUST use 2250 the same local address is used that was used in those previous 2251 segments (MUST-45). 2253 A TCP implementation MUST reject as an error a local OPEN call 2254 for an invalid remote IP address (e.g., a broadcast or 2255 multicast address) (MUST-46). 2257 Send 2258 Format: SEND (local connection name, buffer address, byte 2259 count, PUSH flag (optional), URGENT flag [,timeout]) 2261 This call causes the data contained in the indicated user 2262 buffer to be sent on the indicated connection. If the 2263 connection has not been opened, the SEND is considered an 2264 error. Some implementations may allow users to SEND first; in 2265 which case, an automatic OPEN would be done. For example, this 2266 might be one way for application data to be included in SYN 2267 segments. If the calling process is not authorized to use this 2268 connection, an error is returned. 2270 A TCP endpoint MAY implement PUSH flags on SEND calls (MAY-15). 2271 If PUSH flags are not implemented, then the sending TCP peer: 2272 (1) MUST NOT buffer data indefinitely (MUST-60), and (2) MUST 2273 set the PSH bit in the last buffered segment (i.e., when there 2274 is no more queued data to be sent) (MUST-61). The remaining 2275 description below assumes the PUSH flag is supported on SEND 2276 calls. 2278 If the PUSH flag is set, the application intends the data to be 2279 transmitted promptly to the receiver, and the PUSH bit will be 2280 set in the last TCP segment created from the buffer. When an 2281 application issues a series of SEND calls without setting the 2282 PUSH flag, the TCP implementation MAY aggregate the data 2283 internally without sending it (MAY-16). 2285 The PSH bit is not a record marker and is independent of 2286 segment boundaries. The transmitter SHOULD collapse successive 2287 bits when it packetizes data, to send the largest possible 2288 segment (SHLD-27). 2290 If the PUSH flag is not set, the data may be combined with data 2291 from subsequent SENDs for transmission efficiency. Note that 2292 when the Nagle algorithm is in use, TCP implementations may 2293 buffer the data before sending, without regard to the PUSH flag 2294 (see Section 3.6.4). 2296 An application program is logically required to set the PUSH 2297 flag in a SEND call whenever it needs to force delivery of the 2298 data to avoid a communication deadlock. However, a TCP 2299 implementation SHOULD send a maximum-sized segment whenever 2300 possible (SHLD-28), to improve performance (see 2301 Section 3.7.6.2.1). 2303 New applications SHOULD NOT set the URGENT flag [32] due to 2304 implementation differences and middlebox issues (SHLD-13). 2306 If the URGENT flag is set, segments sent to the destination TCP 2307 peer will have the urgent pointer set. The receiving TCP peer 2308 will signal the urgent condition to the receiving process if 2309 the urgent pointer indicates that data preceding the urgent 2310 pointer has not been consumed by the receiving process. The 2311 purpose of urgent is to stimulate the receiver to process the 2312 urgent data and to indicate to the receiver when all the 2313 currently known urgent data has been received. The number of 2314 times the sending user's TCP implementation signals urgent will 2315 not necessarily be equal to the number of times the receiving 2316 user will be notified of the presence of urgent data. 2318 If no remote socket was specified in the OPEN, but the 2319 connection is established (e.g., because a LISTENing connection 2320 has become specific due to a remote segment arriving for the 2321 local socket), then the designated buffer is sent to the 2322 implied remote socket. Users who make use of OPEN with an 2323 unspecified remote socket can make use of SEND without ever 2324 explicitly knowing the remote socket address. 2326 However, if a SEND is attempted before the remote socket 2327 becomes specified, an error will be returned. Users can use 2328 the STATUS call to determine the status of the connection. 2329 Some TCP implementations may notify the user when an 2330 unspecified socket is bound. 2332 If a timeout is specified, the current user timeout for this 2333 connection is changed to the new one. 2335 In the simplest implementation, SEND would not return control 2336 to the sending process until either the transmission was 2337 complete or the timeout had been exceeded. However, this 2338 simple method is both subject to deadlocks (for example, both 2339 sides of the connection might try to do SENDs before doing any 2340 RECEIVEs) and offers poor performance, so it is not 2341 recommended. A more sophisticated implementation would return 2342 immediately to allow the process to run concurrently with 2343 network I/O, and, furthermore, to allow multiple SENDs to be in 2344 progress. Multiple SENDs are served in first come, first 2345 served order, so the TCP endpoint will queue those it cannot 2346 service immediately. 2348 We have implicitly assumed an asynchronous user interface in 2349 which a SEND later elicits some kind of SIGNAL or pseudo- 2350 interrupt from the serving TCP endpoint. An alternative is to 2351 return a response immediately. For instance, SENDs might 2352 return immediate local acknowledgment, even if the segment sent 2353 had not been acknowledged by the distant TCP endpoint. We 2354 could optimistically assume eventual success. If we are wrong, 2355 the connection will close anyway due to the timeout. In 2356 implementations of this kind (synchronous), there will still be 2357 some asynchronous signals, but these will deal with the 2358 connection itself, and not with specific segments or buffers. 2360 In order for the process to distinguish among error or success 2361 indications for different SENDs, it might be appropriate for 2362 the buffer address to be returned along with the coded response 2363 to the SEND request. TCP-to-user signals are discussed below, 2364 indicating the information that should be returned to the 2365 calling process. 2367 Receive 2369 Format: RECEIVE (local connection name, buffer address, byte 2370 count) -> byte count, urgent flag, push flag (optional) 2372 This command allocates a receiving buffer associated with the 2373 specified connection. If no OPEN precedes this command or the 2374 calling process is not authorized to use this connection, an 2375 error is returned. 2377 In the simplest implementation, control would not return to the 2378 calling program until either the buffer was filled, or some 2379 error occurred, but this scheme is highly subject to deadlocks. 2380 A more sophisticated implementation would permit several 2381 RECEIVEs to be outstanding at once. These would be filled as 2382 segments arrive. This strategy permits increased throughput at 2383 the cost of a more elaborate scheme (possibly asynchronous) to 2384 notify the calling program that a PUSH has been seen or a 2385 buffer filled. 2387 A TCP receiver MAY pass a received PSH flag to the application 2388 layer via the PUSH flag in the interface (MAY-17), but it is 2389 not required (this was clarified in RFC 1122 section 4.2.2.2). 2390 The remainder of text describing the RECEIVE call below assumes 2391 that passing the PUSH indication is supported. 2393 If enough data arrive to fill the buffer before a PUSH is seen, 2394 the PUSH flag will not be set in the response to the RECEIVE. 2395 The buffer will be filled with as much data as it can hold. If 2396 a PUSH is seen before the buffer is filled the buffer will be 2397 returned partially filled and PUSH indicated. 2399 If there is urgent data the user will have been informed as 2400 soon as it arrived via a TCP-to-user signal. The receiving 2401 user should thus be in "urgent mode". If the URGENT flag is 2402 on, additional urgent data remains. If the URGENT flag is off, 2403 this call to RECEIVE has returned all the urgent data, and the 2404 user may now leave "urgent mode". Note that data following the 2405 urgent pointer (non-urgent data) cannot be delivered to the 2406 user in the same buffer with preceding urgent data unless the 2407 boundary is clearly marked for the user. 2409 To distinguish among several outstanding RECEIVEs and to take 2410 care of the case that a buffer is not completely filled, the 2411 return code is accompanied by both a buffer pointer and a byte 2412 count indicating the actual length of the data received. 2414 Alternative implementations of RECEIVE might have the TCP 2415 endpoint allocate buffer storage, or the TCP endpoint might 2416 share a ring buffer with the user. 2418 Close 2420 Format: CLOSE (local connection name) 2422 This command causes the connection specified to be closed. If 2423 the connection is not open or the calling process is not 2424 authorized to use this connection, an error is returned. 2425 Closing connections is intended to be a graceful operation in 2426 the sense that outstanding SENDs will be transmitted (and 2427 retransmitted), as flow control permits, until all have been 2428 serviced. Thus, it should be acceptable to make several SEND 2429 calls, followed by a CLOSE, and expect all the data to be sent 2430 to the destination. It should also be clear that users should 2431 continue to RECEIVE on CLOSING connections, since the remote 2432 peer may be trying to transmit the last of its data. Thus, 2433 CLOSE means "I have no more to send" but does not mean "I will 2434 not receive any more." It may happen (if the user level 2435 protocol is not well thought out) that the closing side is 2436 unable to get rid of all its data before timing out. In this 2437 event, CLOSE turns into ABORT, and the closing TCP peer gives 2438 up. 2440 The user may CLOSE the connection at any time on his own 2441 initiative, or in response to various prompts from the TCP 2442 implementation (e.g., remote close executed, transmission 2443 timeout exceeded, destination inaccessible). 2445 Because closing a connection requires communication with the 2446 remote TCP peer, connections may remain in the closing state 2447 for a short time. Attempts to reopen the connection before the 2448 TCP peer replies to the CLOSE command will result in error 2449 responses. 2451 Close also implies push function. 2453 Status 2455 Format: STATUS (local connection name) -> status data 2457 This is an implementation dependent user command and could be 2458 excluded without adverse effect. Information returned would 2459 typically come from the TCB associated with the connection. 2461 This command returns a data block containing the following 2462 information: 2464 local socket, 2465 remote socket, 2466 local connection name, 2467 receive window, 2468 send window, 2469 connection state, 2470 number of buffers awaiting acknowledgment, 2471 number of buffers pending receipt, 2472 urgent state, 2473 DiffServ field value, 2474 security/compartment, 2475 and transmission timeout. 2477 Depending on the state of the connection, or on the 2478 implementation itself, some of this information may not be 2479 available or meaningful. If the calling process is not 2480 authorized to use this connection, an error is returned. This 2481 prevents unauthorized processes from gaining information about 2482 a connection. 2484 Abort 2486 Format: ABORT (local connection name) 2488 This command causes all pending SENDs and RECEIVES to be 2489 aborted, the TCB to be removed, and a special RESET message to 2490 be sent to the remote TCP peer of the connection. Depending on 2491 the implementation, users may receive abort indications for 2492 each outstanding SEND or RECEIVE, or may simply receive an 2493 ABORT-acknowledgment. 2495 Flush 2497 Some TCP implementations have included a FLUSH call, which will 2498 empty the TCP send queue of any data that the user has issued 2499 SEND calls but is still to the right of the current send 2500 window. That is, it flushes as much queued send data as 2501 possible without losing sequence number synchronization. The 2502 FLUSH call MAY be implemented (MAY-14). 2504 Asynchronous Reports 2506 There MUST be a mechanism for reporting soft TCP error 2507 conditions to the application (MUST-47). Generically, we 2508 assume this takes the form of an application-supplied 2509 ERROR_REPORT routine that may be upcalled asynchronously from 2510 the transport layer: 2512 ERROR_REPORT(local connection name, reason, subreason) 2514 The precise encoding of the reason and subreason parameters is 2515 not specified here. However, the conditions that are reported 2516 asynchronously to the application MUST include: 2518 * ICMP error message arrived (see Section 3.8.2.2 for 2519 description of handling each ICMP message type, since some 2520 message types need to be suppressed from generating reports 2521 to the application) 2523 * Excessive retransmissions (see Section 3.7.3) 2525 * Urgent pointer advance (see Section 3.7.5) 2527 However, an application program that does not want to receive 2528 such ERROR_REPORT calls SHOULD be able to effectively disable 2529 these calls (SHLD-20). 2531 Set Differentiated Services Field (IPv4 TOS or IPv6 Traffic Class) 2533 The application layer MUST be able to specify the 2534 Differentiated Services field for segments that are sent on a 2535 connection (MUST-48). The Differentiated Services field 2536 includes the 6-bit Differentiated Services Code Point (DSCP) 2537 value. It is not required, but the application SHOULD be able 2538 to change the Differentiated Services field during the 2539 connection lifetime (SHLD-21). TCP implementations SHOULD pass 2540 the current Differentiated Services field value without change 2541 to the IP layer, when it sends segments on the connection 2542 (SHLD-22). 2544 The Differentiated Services field will be specified 2545 independently in each direction on the connection, so that the 2546 receiver application will specify the Differentiated Services 2547 field used for ACK segments. 2549 TCP implementations MAY pass the most recently received 2550 Differentiated Services field up to the application (MAY-9). 2552 3.8.2. TCP/Lower-Level Interface 2554 The TCP endpoint calls on a lower level protocol module to actually 2555 send and receive information over a network. The two current 2556 standard Internet Protocol (IP) versions layered below TCP are IPv4 2557 [1] and IPv6 [11]. 2559 If the lower level protocol is IPv4 it provides arguments for a type 2560 of service (used within the Differentiated Services field) and for a 2561 time to live. TCP uses the following settings for these parameters: 2563 DiffServ field: The IP header value for the DiffServ field is 2564 given by the user. This includes the bits of the DiffServ Code 2565 Point (DSCP). 2567 Time to Live (TTL): The TTL value used to send TCP segments MUST 2568 be configurable (MUST-49). 2570 Note that RFC 793 specified one minute (60 seconds) as a 2571 constant for the TTL, because the assumed maximum segment 2572 lifetime was two minutes. This was intended to explicitly ask 2573 that a segment be destroyed if it cannot be delivered by the 2574 internet system within one minute. RFC 1122 changed this 2575 specification to require that the TTL be configurable. 2577 Note that the DiffServ field is permitted to change during a 2578 connection (section 4.2.4.2 of RFC 1122). However, the 2579 application interface might not support this ability, and the 2580 application does not have knowledge about individual TCP 2581 segments, so this can only be done on a coarse granularity, at 2582 best. This limitation is further discussed in RFC 7657 (sec 2583 5.1, 5.3, and 6) [42]. Generally, an application SHOULD NOT 2584 change the DiffServ field value during the course of a 2585 connection (SHLD-23). 2587 Any lower level protocol will have to provide the source address, 2588 destination address, and protocol fields, and some way to determine 2589 the "TCP length", both to provide the functional equivalent service 2590 of IP and to be used in the TCP checksum. 2592 When received options are passed up to TCP from the IP layer, TCP 2593 implementations MUST ignore options that it does not understand 2594 (MUST-50). 2596 A TCP implementation MAY support the Time Stamp (MAY-10) and Record 2597 Route (MAY-11) options. 2599 3.8.2.1. Source Routing 2601 If the lower level is IP (or other protocol that provides this 2602 feature) and source routing is used, the interface must allow the 2603 route information to be communicated. This is especially important 2604 so that the source and destination addresses used in the TCP checksum 2605 be the originating source and ultimate destination. It is also 2606 important to preserve the return route to answer connection requests. 2608 An application MUST be able to specify a source route when it 2609 actively opens a TCP connection (MUST-51), and this MUST take 2610 precedence over a source route received in a datagram (MUST-52). 2612 When a TCP connection is OPENed passively and a packet arrives with a 2613 completed IP Source Route option (containing a return route), TCP 2614 implementations MUST save the return route and use it for all 2615 segments sent on this connection (MUST-53). If a different source 2616 route arrives in a later segment, the later definition SHOULD 2617 override the earlier one (SHLD-24). 2619 3.8.2.2. ICMP Messages 2621 TCP implementations MUST act on an ICMP error message passed up from 2622 the IP layer, directing it to the connection that created the error 2623 (MUST-54). The necessary demultiplexing information can be found in 2624 the IP header contained within the ICMP message. 2626 This applies to ICMPv6 in addition to IPv4 ICMP. 2628 [26] contains discussion of specific ICMP and ICMPv6 messages 2629 classified as either "soft" or "hard" errors that may bear different 2630 responses. Treatment for classes of ICMP messages is described 2631 below: 2633 Source Quench 2634 TCP implementations MUST silently discard any received ICMP Source 2635 Quench messages (MUST-55). See [10] for discussion. 2637 Soft Errors 2638 For ICMP these include: Destination Unreachable -- codes 0, 1, 5, 2639 Time Exceeded -- codes 0, 1, and Parameter Problem. 2641 For ICMPv6 these include: Destination Unreachable -- codes 0 and 3, 2642 Time Exceeded -- codes 0, 1, and Parameter Problem -- codes 0, 1, 2 2643 Since these Unreachable messages indicate soft error conditions, 2644 TCP implementations MUST NOT abort the connection (MUST-56), and it 2645 SHOULD make the information available to the application (SHLD-25). 2647 Hard Errors 2648 For ICMP these include Destination Unreachable -- codes 2-4"> 2649 These are hard error conditions, so TCP implementations SHOULD 2650 abort the connection (SHLD-26). [26] notes that some 2651 implementations do not abort connections when an ICMP hard error is 2652 received for a connection that is in any of the synchronized 2653 states. 2655 Note that [26] section 4 describes widespread implementation behavior 2656 that treats soft errors as hard errors during connection 2657 establishment. 2659 3.8.2.3. Remote Address Validation 2661 RFC 1122 requires addresses to be validated in incoming SYN packets: 2663 An incoming SYN with an invalid source address MUST be ignored 2664 either by TCP or by the IP layer (MUST-63) (see Section 3.2.1.3 of 2665 [14]). 2667 A TCP implementation MUST silently discard an incoming SYN segment 2668 that is addressed to a broadcast or multicast address (MUST-57). 2670 This prevents connection state and replies from being erroneously 2671 generated, and implementers should note that this guidance is 2672 applicable to all incoming segments, not just SYNs, as specifically 2673 indicated in RFC 1122. 2675 3.9. Event Processing 2677 The processing depicted in this section is an example of one possible 2678 implementation. Other implementations may have slightly different 2679 processing sequences, but they should differ from those in this 2680 section only in detail, not in substance. 2682 The activity of the TCP endpoint can be characterized as responding 2683 to events. The events that occur can be cast into three categories: 2684 user calls, arriving segments, and timeouts. This section describes 2685 the processing the TCP endpoint does in response to each of the 2686 events. In many cases the processing required depends on the state 2687 of the connection. 2689 Events that occur: 2691 User Calls 2693 OPEN 2694 SEND 2695 RECEIVE 2696 CLOSE 2697 ABORT 2698 STATUS 2700 Arriving Segments 2702 SEGMENT ARRIVES 2704 Timeouts 2706 USER TIMEOUT 2707 RETRANSMISSION TIMEOUT 2708 TIME-WAIT TIMEOUT 2710 The model of the TCP/user interface is that user commands receive an 2711 immediate return and possibly a delayed response via an event or 2712 pseudo interrupt. In the following descriptions, the term "signal" 2713 means cause a delayed response. 2715 Error responses in this document are identified by character strings. 2716 For example, user commands referencing connections that do not exist 2717 receive "error: connection not open". 2719 Please note in the following that all arithmetic on sequence numbers, 2720 acknowledgment numbers, windows, et cetera, is modulo 2**32 the size 2721 of the sequence number space. Also note that "=<" means less than or 2722 equal to (modulo 2**32). 2724 A natural way to think about processing incoming segments is to 2725 imagine that they are first tested for proper sequence number (i.e., 2726 that their contents lie in the range of the expected "receive window" 2727 in the sequence number space) and then that they are generally queued 2728 and processed in sequence number order. 2730 When a segment overlaps other already received segments we 2731 reconstruct the segment to contain just the new data, and adjust the 2732 header fields to be consistent. 2734 Note that if no state change is mentioned the TCP connection stays in 2735 the same state. 2737 OPEN Call 2739 CLOSED STATE (i.e., TCB does not exist) 2741 Create a new transmission control block (TCB) to hold 2742 connection state information. Fill in local socket identifier, 2743 remote socket, DiffServ field, security/compartment, and user 2744 timeout information. Note that some parts of the remote socket 2745 may be unspecified in a passive OPEN and are to be filled in by 2746 the parameters of the incoming SYN segment. Verify the 2747 security and DiffServ value requested are allowed for this 2748 user, if not return "error: precedence not allowed" or "error: 2749 security/compartment not allowed." If passive enter the LISTEN 2750 state and return. If active and the remote socket is 2751 unspecified, return "error: remote socket unspecified"; if 2752 active and the remote socket is specified, issue a SYN segment. 2753 An initial send sequence number (ISS) is selected. A SYN 2754 segment of the form is sent. Set SND.UNA to 2755 ISS, SND.NXT to ISS+1, enter SYN-SENT state, and return. 2757 If the caller does not have access to the local socket 2758 specified, return "error: connection illegal for this process". 2759 If there is no room to create a new connection, return "error: 2760 insufficient resources". 2762 LISTEN STATE 2764 If active and the remote socket is specified, then change the 2765 connection from passive to active, select an ISS. Send a SYN 2766 segment, set SND.UNA to ISS, SND.NXT to ISS+1. Enter SYN-SENT 2767 state. Data associated with SEND may be sent with SYN segment 2768 or queued for transmission after entering ESTABLISHED state. 2769 The urgent bit if requested in the command must be sent with 2770 the data segments sent as a result of this command. If there 2771 is no room to queue the request, respond with "error: 2772 insufficient resources". If Foreign socket was not specified, 2773 then return "error: remote socket unspecified". 2775 SYN-SENT STATE 2776 SYN-RECEIVED STATE 2777 ESTABLISHED STATE 2778 FIN-WAIT-1 STATE 2779 FIN-WAIT-2 STATE 2780 CLOSE-WAIT STATE 2781 CLOSING STATE 2782 LAST-ACK STATE 2783 TIME-WAIT STATE 2785 Return "error: connection already exists". 2787 SEND Call 2789 CLOSED STATE (i.e., TCB does not exist) 2791 If the user does not have access to such a connection, then 2792 return "error: connection illegal for this process". 2794 Otherwise, return "error: connection does not exist". 2796 LISTEN STATE 2798 If the remote socket is specified, then change the connection 2799 from passive to active, select an ISS. Send a SYN segment, set 2800 SND.UNA to ISS, SND.NXT to ISS+1. Enter SYN-SENT state. Data 2801 associated with SEND may be sent with SYN segment or queued for 2802 transmission after entering ESTABLISHED state. The urgent bit 2803 if requested in the command must be sent with the data segments 2804 sent as a result of this command. If there is no room to queue 2805 the request, respond with "error: insufficient resources". If 2806 Foreign socket was not specified, then return "error: remote 2807 socket unspecified". 2809 SYN-SENT STATE 2810 SYN-RECEIVED STATE 2812 Queue the data for transmission after entering ESTABLISHED 2813 state. If no space to queue, respond with "error: insufficient 2814 resources". 2816 ESTABLISHED STATE 2817 CLOSE-WAIT STATE 2819 Segmentize the buffer and send it with a piggybacked 2820 acknowledgment (acknowledgment value = RCV.NXT). If there is 2821 insufficient space to remember this buffer, simply return 2822 "error: insufficient resources". 2824 If the urgent flag is set, then SND.UP <- SND.NXT and set the 2825 urgent pointer in the outgoing segments. 2827 FIN-WAIT-1 STATE 2828 FIN-WAIT-2 STATE 2829 CLOSING STATE 2830 LAST-ACK STATE 2831 TIME-WAIT STATE 2833 Return "error: connection closing" and do not service request. 2835 RECEIVE Call 2837 CLOSED STATE (i.e., TCB does not exist) 2839 If the user does not have access to such a connection, return 2840 "error: connection illegal for this process". 2842 Otherwise return "error: connection does not exist". 2844 LISTEN STATE 2845 SYN-SENT STATE 2846 SYN-RECEIVED STATE 2848 Queue for processing after entering ESTABLISHED state. If 2849 there is no room to queue this request, respond with "error: 2850 insufficient resources". 2852 ESTABLISHED STATE 2853 FIN-WAIT-1 STATE 2854 FIN-WAIT-2 STATE 2856 If insufficient incoming segments are queued to satisfy the 2857 request, queue the request. If there is no queue space to 2858 remember the RECEIVE, respond with "error: insufficient 2859 resources". 2861 Reassemble queued incoming segments into receive buffer and 2862 return to user. Mark "push seen" (PUSH) if this is the case. 2864 If RCV.UP is in advance of the data currently being passed to 2865 the user notify the user of the presence of urgent data. 2867 When the TCP endpoint takes responsibility for delivering data 2868 to the user that fact must be communicated to the sender via an 2869 acknowledgment. The formation of such an acknowledgment is 2870 described below in the discussion of processing an incoming 2871 segment. 2873 CLOSE-WAIT STATE 2875 Since the remote side has already sent FIN, RECEIVEs must be 2876 satisfied by text already on hand, but not yet delivered to the 2877 user. If no text is awaiting delivery, the RECEIVE will get a 2878 "error: connection closing" response. Otherwise, any remaining 2879 text can be used to satisfy the RECEIVE. 2881 CLOSING STATE 2882 LAST-ACK STATE 2883 TIME-WAIT STATE 2885 Return "error: connection closing". 2887 CLOSE Call 2889 CLOSED STATE (i.e., TCB does not exist) 2891 If the user does not have access to such a connection, return 2892 "error: connection illegal for this process". 2894 Otherwise, return "error: connection does not exist". 2896 LISTEN STATE 2898 Any outstanding RECEIVEs are returned with "error: closing" 2899 responses. Delete TCB, enter CLOSED state, and return. 2901 SYN-SENT STATE 2903 Delete the TCB and return "error: closing" responses to any 2904 queued SENDs, or RECEIVEs. 2906 SYN-RECEIVED STATE 2908 If no SENDs have been issued and there is no pending data to 2909 send, then form a FIN segment and send it, and enter FIN-WAIT-1 2910 state; otherwise queue for processing after entering 2911 ESTABLISHED state. 2913 ESTABLISHED STATE 2915 Queue this until all preceding SENDs have been segmentized, 2916 then form a FIN segment and send it. In any case, enter FIN- 2917 WAIT-1 state. 2919 FIN-WAIT-1 STATE 2920 FIN-WAIT-2 STATE 2922 Strictly speaking, this is an error and should receive a 2923 "error: connection closing" response. An "ok" response would 2924 be acceptable, too, as long as a second FIN is not emitted (the 2925 first FIN may be retransmitted though). 2927 CLOSE-WAIT STATE 2929 Queue this request until all preceding SENDs have been 2930 segmentized; then send a FIN segment, enter LAST-ACK state. 2932 CLOSING STATE 2933 LAST-ACK STATE 2934 TIME-WAIT STATE 2935 Respond with "error: connection closing". 2937 ABORT Call 2939 CLOSED STATE (i.e., TCB does not exist) 2941 If the user should not have access to such a connection, return 2942 "error: connection illegal for this process". 2944 Otherwise return "error: connection does not exist". 2946 LISTEN STATE 2948 Any outstanding RECEIVEs should be returned with "error: 2949 connection reset" responses. Delete TCB, enter CLOSED state, 2950 and return. 2952 SYN-SENT STATE 2954 All queued SENDs and RECEIVEs should be given "connection 2955 reset" notification, delete the TCB, enter CLOSED state, and 2956 return. 2958 SYN-RECEIVED STATE 2959 ESTABLISHED STATE 2960 FIN-WAIT-1 STATE 2961 FIN-WAIT-2 STATE 2962 CLOSE-WAIT STATE 2964 Send a reset segment: 2966 2968 All queued SENDs and RECEIVEs should be given "connection 2969 reset" notification; all segments queued for transmission 2970 (except for the RST formed above) or retransmission should be 2971 flushed, delete the TCB, enter CLOSED state, and return. 2973 CLOSING STATE LAST-ACK STATE TIME-WAIT STATE 2975 Respond with "ok" and delete the TCB, enter CLOSED state, and 2976 return. 2978 STATUS Call 2980 CLOSED STATE (i.e., TCB does not exist) 2982 If the user should not have access to such a connection, return 2983 "error: connection illegal for this process". 2985 Otherwise return "error: connection does not exist". 2987 LISTEN STATE 2989 Return "state = LISTEN", and the TCB pointer. 2991 SYN-SENT STATE 2993 Return "state = SYN-SENT", and the TCB pointer. 2995 SYN-RECEIVED STATE 2997 Return "state = SYN-RECEIVED", and the TCB pointer. 2999 ESTABLISHED STATE 3001 Return "state = ESTABLISHED", and the TCB pointer. 3003 FIN-WAIT-1 STATE 3005 Return "state = FIN-WAIT-1", and the TCB pointer. 3007 FIN-WAIT-2 STATE 3009 Return "state = FIN-WAIT-2", and the TCB pointer. 3011 CLOSE-WAIT STATE 3013 Return "state = CLOSE-WAIT", and the TCB pointer. 3015 CLOSING STATE 3017 Return "state = CLOSING", and the TCB pointer. 3019 LAST-ACK STATE 3021 Return "state = LAST-ACK", and the TCB pointer. 3023 TIME-WAIT STATE 3025 Return "state = TIME-WAIT", and the TCB pointer. 3027 SEGMENT ARRIVES 3029 If the state is CLOSED (i.e., TCB does not exist) then 3031 all data in the incoming segment is discarded. An incoming 3032 segment containing a RST is discarded. An incoming segment not 3033 containing a RST causes a RST to be sent in response. The 3034 acknowledgment and sequence field values are selected to make 3035 the reset sequence acceptable to the TCP endpoint that sent the 3036 offending segment. 3038 If the ACK bit is off, sequence number zero is used, 3040 3042 If the ACK bit is on, 3044 3046 Return. 3048 If the state is LISTEN then 3050 first check for an RST 3052 An incoming RST should be ignored. Return. 3054 second check for an ACK 3056 Any acknowledgment is bad if it arrives on a connection 3057 still in the LISTEN state. An acceptable reset segment 3058 should be formed for any arriving ACK-bearing segment. The 3059 RST should be formatted as follows: 3061 3063 Return. 3065 third check for a SYN 3067 If the SYN bit is set, check the security. If the security/ 3068 compartment on the incoming segment does not exactly match 3069 the security/compartment in the TCB then send a reset and 3070 return. 3072 3074 Set RCV.NXT to SEG.SEQ+1, IRS is set to SEG.SEQ and any 3075 other control or text should be queued for processing later. 3076 ISS should be selected and a SYN segment sent of the form: 3078 3080 SND.NXT is set to ISS+1 and SND.UNA to ISS. The connection 3081 state should be changed to SYN-RECEIVED. Note that any 3082 other incoming control or data (combined with SYN) will be 3083 processed in the SYN-RECEIVED state, but processing of SYN 3084 and ACK should not be repeated. If the listen was not fully 3085 specified (i.e., the remote socket was not fully specified), 3086 then the unspecified fields should be filled in now. 3088 fourth other text or control 3090 Any other control or text-bearing segment (not containing 3091 SYN) must have an ACK and thus would be discarded by the ACK 3092 processing. An incoming RST segment could not be valid, 3093 since it could not have been sent in response to anything 3094 sent by this incarnation of the connection. So, if this 3095 unlikely condition is reached, the correct behavior is to 3096 drop the segment and return. 3098 If the state is SYN-SENT then 3100 first check the ACK bit 3102 If the ACK bit is set 3104 If SEG.ACK =< ISS, or SEG.ACK > SND.NXT, send a reset 3105 (unless the RST bit is set, if so drop the segment and 3106 return) 3108 3110 and discard the segment. Return. 3112 If SND.UNA < SEG.ACK =< SND.NXT then the ACK is 3113 acceptable. Some deployed TCP code has used the check 3114 SEG.ACK == SND.NXT (using "==" rather than "=<", but this 3115 is not appropriate when the stack is capable of sending 3116 data on the SYN, because the TCP peer may not accept and 3117 acknowledge all of the data on the SYN. 3119 second check the RST bit 3121 If the RST bit is set 3122 A potential blind reset attack is described in RFC 5961 3123 [31], with the mitigation that a TCP implementation 3124 SHOULD first check that the sequence number exactly 3125 matches RCV.NXT prior to executing the action in the next 3126 paragraph. 3128 If the ACK was acceptable then signal the user "error: 3129 connection reset", drop the segment, enter CLOSED state, 3130 delete TCB, and return. Otherwise (no ACK) drop the 3131 segment and return. 3133 third check the security 3135 If the security/compartment in the segment does not exactly 3136 match the security/compartment in the TCB, send a reset 3138 If there is an ACK 3140 3142 Otherwise 3144 3146 If a reset was sent, discard the segment and return. 3148 fourth check the SYN bit 3150 This step should be reached only if the ACK is ok, or there 3151 is no ACK, and it the segment did not contain a RST. 3153 If the SYN bit is on and the security/compartment is 3154 acceptable then, RCV.NXT is set to SEG.SEQ+1, IRS is set to 3155 SEG.SEQ. SND.UNA should be advanced to equal SEG.ACK (if 3156 there is an ACK), and any segments on the retransmission 3157 queue that are thereby acknowledged should be removed. 3159 If SND.UNA > ISS (our SYN has been ACKed), change the 3160 connection state to ESTABLISHED, form an ACK segment 3162 3164 and send it. Data or controls that were queued for 3165 transmission may be included. If there are other controls 3166 or text in the segment then continue processing at the sixth 3167 step below where the URG bit is checked, otherwise return. 3169 Otherwise enter SYN-RECEIVED, form a SYN,ACK segment 3170 3172 and send it. Set the variables: 3174 SND.WND <- SEG.WND 3175 SND.WL1 <- SEG.SEQ 3176 SND.WL2 <- SEG.ACK 3178 If there are other controls or text in the segment, queue 3179 them for processing after the ESTABLISHED state has been 3180 reached, return. 3182 Note that it is legal to send and receive application data 3183 on SYN segments (this is the "text in the segment" mentioned 3184 above. There has been significant misinformation and 3185 misunderstanding of this topic historically. Some firewalls 3186 and security devices consider this suspicious. However, the 3187 capability was used in T/TCP [16] and is used in TCP Fast 3188 Open (TFO) [40], so is important for implementations and 3189 network devices to permit. 3191 fifth, if neither of the SYN or RST bits is set then drop the 3192 segment and return. 3194 Otherwise, 3196 first check sequence number 3198 SYN-RECEIVED STATE 3199 ESTABLISHED STATE 3200 FIN-WAIT-1 STATE 3201 FIN-WAIT-2 STATE 3202 CLOSE-WAIT STATE 3203 CLOSING STATE 3204 LAST-ACK STATE 3205 TIME-WAIT STATE 3207 Segments are processed in sequence. Initial tests on 3208 arrival are used to discard old duplicates, but further 3209 processing is done in SEG.SEQ order. If a segment's 3210 contents straddle the boundary between old and new, only the 3211 new parts should be processed. 3213 In general, the processing of received segments MUST be 3214 implemented to aggregate ACK segments whenever possible 3215 (MUST-58). For example, if the TCP endpoint is processing a 3216 series of queued segments, it MUST process them all before 3217 sending any ACK segments (MUST-59). 3219 There are four cases for the acceptability test for an 3220 incoming segment: 3222 Segment Receive Test 3223 Length Window 3224 ------- ------- ------------------------------------------- 3226 0 0 SEG.SEQ = RCV.NXT 3228 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 3230 >0 0 not acceptable 3232 >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 3233 or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND 3235 In implementing sequence number validation as described 3236 here, please note Appendix A.2. 3238 If the RCV.WND is zero, no segments will be acceptable, but 3239 special allowance should be made to accept valid ACKs, URGs 3240 and RSTs. 3242 If an incoming segment is not acceptable, an acknowledgment 3243 should be sent in reply (unless the RST bit is set, if so 3244 drop the segment and return): 3246 3248 After sending the acknowledgment, drop the unacceptable 3249 segment and return. 3251 Note that for the TIME-WAIT state, there is an improved 3252 algorithm described in [33] for handling incoming SYN 3253 segments, that utilizes timestamps rather than relying on 3254 the sequence number check described here. When the improved 3255 algorithm is implemented, the logic above is not applicable 3256 for incoming SYN segments with timestamp options, received 3257 on a connection in the TIME-WAIT state. 3259 In the following it is assumed that the segment is the 3260 idealized segment that begins at RCV.NXT and does not exceed 3261 the window. One could tailor actual segments to fit this 3262 assumption by trimming off any portions that lie outside the 3263 window (including SYN and FIN), and only processing further 3264 if the segment then begins at RCV.NXT. Segments with higher 3265 beginning sequence numbers SHOULD be held for later 3266 processing (SHLD-31). 3268 second check the RST bit, 3270 RFC 5961 section 3 describes a potential blind reset attack 3271 and optional mitigation approach that SHOULD be implemented. 3272 For stacks implementing RFC 5961, the three checks below 3273 apply, otherwise processesing for these states is indicated 3274 further below. 3276 1) If the RST bit is set and the sequence number is 3277 outside the current receive window, silently drop the 3278 segment. 3280 2) If the RST bit is set and the sequence number exactly 3281 matches the next expected sequence number (RCV.NXT), then 3282 TCP endpoints MUST reset the connection in the manner 3283 prescribed below according to the connection state. 3285 3) If the RST bit is set and the sequence number does not 3286 exactly match the next expected sequence value, yet is 3287 within the current receive window, TCP endpoints MUST 3288 send an acknowledgement (challenge ACK): 3290 3292 After sending the challenge ACK, TCP endpoints MUST drop 3293 the unacceptable segment and stop processing the incoming 3294 packet further. Note that RFC 5961 and Errata ID 4772 3295 contain additional considerations for ACK throttling in 3296 an implementation. 3298 SYN-RECEIVED STATE 3300 If the RST bit is set 3302 If this connection was initiated with a passive OPEN 3303 (i.e., came from the LISTEN state), then return this 3304 connection to LISTEN state and return. The user need 3305 not be informed. If this connection was initiated 3306 with an active OPEN (i.e., came from SYN-SENT state) 3307 then the connection was refused, signal the user 3308 "connection refused". In either case, all segments on 3309 the retransmission queue should be removed. And in 3310 the active OPEN case, enter the CLOSED state and 3311 delete the TCB, and return. 3313 ESTABLISHED 3314 FIN-WAIT-1 3315 FIN-WAIT-2 3316 CLOSE-WAIT 3318 If the RST bit is set then, any outstanding RECEIVEs and 3319 SEND should receive "reset" responses. All segment 3320 queues should be flushed. Users should also receive an 3321 unsolicited general "connection reset" signal. Enter the 3322 CLOSED state, delete the TCB, and return. 3324 CLOSING STATE 3325 LAST-ACK STATE 3326 TIME-WAIT 3328 If the RST bit is set then, enter the CLOSED state, 3329 delete the TCB, and return. 3331 third check security 3333 SYN-RECEIVED 3335 If the security/compartment in the segment does not 3336 exactly match the security/compartment in the TCB then 3337 send a reset, and return. 3339 ESTABLISHED 3340 FIN-WAIT-1 3341 FIN-WAIT-2 3342 CLOSE-WAIT 3343 CLOSING 3344 LAST-ACK 3345 TIME-WAIT 3347 If the security/compartment in the segment does not 3348 exactly match the security/compartment in the TCB then 3349 send a reset, any outstanding RECEIVEs and SEND should 3350 receive "reset" responses. All segment queues should be 3351 flushed. Users should also receive an unsolicited 3352 general "connection reset" signal. Enter the CLOSED 3353 state, delete the TCB, and return. 3355 Note this check is placed following the sequence check to 3356 prevent a segment from an old connection between these ports 3357 with a different security from causing an abort of the 3358 current connection. 3360 fourth, check the SYN bit, 3362 SYN-RECEIVED 3364 If the connection was initiated with a passive OPEN, then 3365 return this connection to the LISTEN state and return. 3366 Otherwise, handle per the directions for synchronized 3367 states below. 3369 ESTABLISHED STATE 3370 FIN-WAIT STATE-1 3371 FIN-WAIT STATE-2 3372 CLOSE-WAIT STATE 3373 CLOSING STATE 3374 LAST-ACK STATE 3375 TIME-WAIT STATE 3377 If the SYN bit is set in these synchronized states, it 3378 may be either a legitimate new connection attempt (e.g. 3379 in the case of TIME-WAIT), an error where the connection 3380 should be reset, or the result of an attack attempt, as 3381 described in RFC 5961 [31]. For the TIME-WAIT state, new 3382 connections can be accepted if the timestamp option is 3383 used and meets expectations (per [33]). For all other 3384 caess, RFC 5961 provides a mitigation that SHOULD be 3385 implemented, though there are alternatives (see 3386 Section 6). RFC 5961 recommends that in these 3387 synchronized states, if the SYN bit is set, irrespective 3388 of the sequence number, TCP endpoints MUST send a 3389 "challenge ACK" to the remote peer: 3391 3393 After sending the acknowledgement, TCP implementations 3394 MUST drop the unacceptable segment and stop processing 3395 further. Note that RFC 5961 and Errata ID 4772 contain 3396 additional ACK throttling notes for an implementation. 3398 For implementations that do not follow RFC 5961, the 3399 original RFC 793 behavior follows in this paragraph. If 3400 the SYN is in the window it is an error, send a reset, 3401 any outstanding RECEIVEs and SEND should receive "reset" 3402 responses, all segment queues should be flushed, the user 3403 should also receive an unsolicited general "connection 3404 reset" signal, enter the CLOSED state, delete the TCB, 3405 and return. 3407 If the SYN is not in the window this step would not be 3408 reached and an ack would have been sent in the first step 3409 (sequence number check). 3411 fifth check the ACK field, 3413 if the ACK bit is off drop the segment and return 3415 if the ACK bit is on 3417 RFC 5961 section 5 describes a potential blind data 3418 injection attack, and mitigation that implementations MAY 3419 choose to include (MAY-12). TCP stacks that implement 3420 RFC 5961 MUST add an input check that the ACK value is 3421 acceptable only if it is in the range of ((SND.UNA - 3422 MAX.SND.WND) =< SEG.ACK =< SND.NXT). All incoming 3423 segments whose ACK value doesn't satisfy the above 3424 condition MUST be discarded and an ACK sent back. The 3425 new state variable MAX.SND.WND is defined as the largest 3426 window that the local sender has ever received from its 3427 peer (subject to window scaling) or may be hard-coded to 3428 a maximum permissible window value. When the ACK value 3429 is acceptable, the processing per-state below applies: 3431 SYN-RECEIVED STATE 3433 If SND.UNA < SEG.ACK =< SND.NXT then enter ESTABLISHED 3434 state and continue processing with variables below set 3435 to: 3437 SND.WND <- SEG.WND 3438 SND.WL1 <- SEG.SEQ 3439 SND.WL2 <- SEG.ACK 3441 If the segment acknowledgment is not acceptable, 3442 form a reset segment, 3444 3446 and send it. 3448 ESTABLISHED STATE 3450 If SND.UNA < SEG.ACK =< SND.NXT then, set SND.UNA <- 3451 SEG.ACK. Any segments on the retransmission queue 3452 that are thereby entirely acknowledged are removed. 3453 Users should receive positive acknowledgments for 3454 buffers that have been SENT and fully acknowledged 3455 (i.e., SEND buffer should be returned with "ok" 3456 response). If the ACK is a duplicate (SEG.ACK =< 3457 SND.UNA), it can be ignored. If the ACK acks 3458 something not yet sent (SEG.ACK > SND.NXT) then send 3459 an ACK, drop the segment, and return. 3461 If SND.UNA =< SEG.ACK =< SND.NXT, the send window 3462 should be updated. If (SND.WL1 < SEG.SEQ or (SND.WL1 3463 = SEG.SEQ and SND.WL2 =< SEG.ACK)), set SND.WND <- 3464 SEG.WND, set SND.WL1 <- SEG.SEQ, and set SND.WL2 <- 3465 SEG.ACK. 3467 Note that SND.WND is an offset from SND.UNA, that 3468 SND.WL1 records the sequence number of the last 3469 segment used to update SND.WND, and that SND.WL2 3470 records the acknowledgment number of the last segment 3471 used to update SND.WND. The check here prevents using 3472 old segments to update the window. 3474 FIN-WAIT-1 STATE 3476 In addition to the processing for the ESTABLISHED 3477 state, if the FIN segment is now acknowledged then 3478 enter FIN-WAIT-2 and continue processing in that 3479 state. 3481 FIN-WAIT-2 STATE 3483 In addition to the processing for the ESTABLISHED 3484 state, if the retransmission queue is empty, the 3485 user's CLOSE can be acknowledged ("ok") but do not 3486 delete the TCB. 3488 CLOSE-WAIT STATE 3490 Do the same processing as for the ESTABLISHED state. 3492 CLOSING STATE 3494 In addition to the processing for the ESTABLISHED 3495 state, if the ACK acknowledges our FIN then enter the 3496 TIME-WAIT state, otherwise ignore the segment. 3498 LAST-ACK STATE 3500 The only thing that can arrive in this state is an 3501 acknowledgment of our FIN. If our FIN is now 3502 acknowledged, delete the TCB, enter the CLOSED state, 3503 and return. 3505 TIME-WAIT STATE 3507 The only thing that can arrive in this state is a 3508 retransmission of the remote FIN. Acknowledge it, and 3509 restart the 2 MSL timeout. 3511 sixth, check the URG bit, 3513 ESTABLISHED STATE 3514 FIN-WAIT-1 STATE 3515 FIN-WAIT-2 STATE 3517 If the URG bit is set, RCV.UP <- max(RCV.UP,SEG.UP), and 3518 signal the user that the remote side has urgent data if 3519 the urgent pointer (RCV.UP) is in advance of the data 3520 consumed. If the user has already been signaled (or is 3521 still in the "urgent mode") for this continuous sequence 3522 of urgent data, do not signal the user again. 3524 CLOSE-WAIT STATE 3525 CLOSING STATE 3526 LAST-ACK STATE 3527 TIME-WAIT 3529 This should not occur, since a FIN has been received from 3530 the remote side. Ignore the URG. 3532 seventh, process the segment text, 3534 ESTABLISHED STATE 3535 FIN-WAIT-1 STATE 3536 FIN-WAIT-2 STATE 3538 Once in the ESTABLISHED state, it is possible to deliver 3539 segment text to user RECEIVE buffers. Text from segments 3540 can be moved into buffers until either the buffer is full 3541 or the segment is empty. If the segment empties and 3542 carries a PUSH flag, then the user is informed, when the 3543 buffer is returned, that a PUSH has been received. 3545 When the TCP endpoint takes responsibility for delivering 3546 the data to the user it must also acknowledge the receipt 3547 of the data. 3549 Once the TCP endpoint takes responsibility for the data 3550 it advances RCV.NXT over the data accepted, and adjusts 3551 RCV.WND as appropriate to the current buffer 3552 availability. The total of RCV.NXT and RCV.WND should 3553 not be reduced. 3555 A TCP implementation MAY send an ACK segment 3556 acknowledging RCV.NXT when a valid segment arrives that 3557 is in the window but not at the left window edge (MAY- 3558 13). 3560 Please note the window management suggestions in 3561 Section 3.7. 3563 Send an acknowledgment of the form: 3565 3567 This acknowledgment should be piggybacked on a segment 3568 being transmitted if possible without incurring undue 3569 delay. 3571 CLOSE-WAIT STATE 3572 CLOSING STATE 3573 LAST-ACK STATE 3574 TIME-WAIT STATE 3576 This should not occur, since a FIN has been received from 3577 the remote side. Ignore the segment text. 3579 eighth, check the FIN bit, 3581 Do not process the FIN if the state is CLOSED, LISTEN or 3582 SYN-SENT since the SEG.SEQ cannot be validated; drop the 3583 segment and return. 3585 If the FIN bit is set, signal the user "connection closing" 3586 and return any pending RECEIVEs with same message, advance 3587 RCV.NXT over the FIN, and send an acknowledgment for the 3588 FIN. Note that FIN implies PUSH for any segment text not 3589 yet delivered to the user. 3591 SYN-RECEIVED STATE 3592 ESTABLISHED STATE 3594 Enter the CLOSE-WAIT state. 3596 FIN-WAIT-1 STATE 3597 If our FIN has been ACKed (perhaps in this segment), 3598 then enter TIME-WAIT, start the time-wait timer, turn 3599 off the other timers; otherwise enter the CLOSING 3600 state. 3602 FIN-WAIT-2 STATE 3604 Enter the TIME-WAIT state. Start the time-wait timer, 3605 turn off the other timers. 3607 CLOSE-WAIT STATE 3609 Remain in the CLOSE-WAIT state. 3611 CLOSING STATE 3613 Remain in the CLOSING state. 3615 LAST-ACK STATE 3617 Remain in the LAST-ACK state. 3619 TIME-WAIT STATE 3621 Remain in the TIME-WAIT state. Restart the 2 MSL 3622 time-wait timeout. 3624 and return. 3626 USER TIMEOUT 3628 USER TIMEOUT 3630 For any state if the user timeout expires, flush all queues, 3631 signal the user "error: connection aborted due to user timeout" 3632 in general and for any outstanding calls, delete the TCB, enter 3633 the CLOSED state and return. 3635 RETRANSMISSION TIMEOUT 3637 For any state if the retransmission timeout expires on a 3638 segment in the retransmission queue, send the segment at the 3639 front of the retransmission queue again, reinitialize the 3640 retransmission timer, and return. 3642 TIME-WAIT TIMEOUT 3644 If the time-wait timeout expires on a connection delete the 3645 TCB, enter the CLOSED state and return. 3647 3.10. Glossary 3649 ACK 3650 A control bit (acknowledge) occupying no sequence space, 3651 which indicates that the acknowledgment field of this segment 3652 specifies the next sequence number the sender of this segment 3653 is expecting to receive, hence acknowledging receipt of all 3654 previous sequence numbers. 3656 connection 3657 A logical communication path identified by a pair of sockets. 3659 datagram 3660 A message sent in a packet switched computer communications 3661 network. 3663 Destination Address 3664 The network layer address of the remote endpoint. 3666 FIN 3667 A control bit (finis) occupying one sequence number, which 3668 indicates that the sender will send no more data or control 3669 occupying sequence space. 3671 fragment 3672 A portion of a logical unit of data, in particular an 3673 internet fragment is a portion of an internet datagram. 3675 header 3676 Control information at the beginning of a message, segment, 3677 fragment, packet or block of data. 3679 host 3680 A computer. In particular a source or destination of 3681 messages from the point of view of the communication network. 3683 Identification 3684 An Internet Protocol field. This identifying value assigned 3685 by the sender aids in assembling the fragments of a datagram. 3687 internet address 3688 A network layer address. 3690 internet datagram 3691 The unit of data exchanged between an internet module and the 3692 higher level protocol together with the internet header. 3694 internet fragment 3695 A portion of the data of an internet datagram with an 3696 internet header. 3698 IP 3699 Internet Protocol. See [1] and [11]. 3701 IRS 3702 The Initial Receive Sequence number. The first sequence 3703 number used by the sender on a connection. 3705 ISN 3706 The Initial Sequence Number. The first sequence number used 3707 on a connection, (either ISS or IRS). Selected in a way that 3708 is unique within a given period of time and is unpredictable 3709 to attackers. 3711 ISS 3712 The Initial Send Sequence number. The first sequence number 3713 used by the sender on a connection. 3715 left sequence 3716 This is the next sequence number to be acknowledged by the 3717 data receiving TCP endpoint (or the lowest currently 3718 unacknowledged sequence number) and is sometimes referred to 3719 as the left edge of the send window. 3721 module 3722 An implementation, usually in software, of a protocol or 3723 other procedure. 3725 MSL 3726 Maximum Segment Lifetime, the time a TCP segment can exist in 3727 the internetwork system. Arbitrarily defined to be 2 3728 minutes. 3730 octet 3731 An eight bit byte. 3733 Options 3734 An Option field may contain several options, and each option 3735 may be several octets in length. 3737 packet 3738 A package of data with a header that may or may not be 3739 logically complete. More often a physical packaging than a 3740 logical packaging of data. 3742 port 3743 The portion of a connection identifier used for 3744 demultiplexing connections at an endpoint. 3746 process 3747 A program in execution. A source or destination of data from 3748 the point of view of the TCP endpoint or other host-to-host 3749 protocol. 3751 PUSH 3752 A control bit occupying no sequence space, indicating that 3753 this segment contains data that must be pushed through to the 3754 receiving user. 3756 RCV.NXT 3757 receive next sequence number 3759 RCV.UP 3760 receive urgent pointer 3762 RCV.WND 3763 receive window 3765 receive next sequence number 3766 This is the next sequence number the local TCP endpoint is 3767 expecting to receive. 3769 receive window 3770 This represents the sequence numbers the local (receiving) 3771 TCP endpoint is willing to receive. Thus, the local TCP 3772 endpoint considers that segments overlapping the range 3773 RCV.NXT to RCV.NXT + RCV.WND - 1 carry acceptable data or 3774 control. Segments containing sequence numbers entirely 3775 outside of this range are considered duplicates and 3776 discarded. 3778 RST 3779 A control bit (reset), occupying no sequence space, 3780 indicating that the receiver should delete the connection 3781 without further interaction. The receiver can determine, 3782 based on the sequence number and acknowledgment fields of the 3783 incoming segment, whether it should honor the reset command 3784 or ignore it. In no case does receipt of a segment 3785 containing RST give rise to a RST in response. 3787 SEG.ACK 3788 segment acknowledgment 3790 SEG.LEN 3791 segment length 3793 SEG.SEQ 3794 segment sequence 3796 SEG.UP 3797 segment urgent pointer field 3799 SEG.WND 3800 segment window field 3802 segment 3803 A logical unit of data, in particular a TCP segment is the 3804 unit of data transfered between a pair of TCP modules. 3806 segment acknowledgment 3807 The sequence number in the acknowledgment field of the 3808 arriving segment. 3810 segment length 3811 The amount of sequence number space occupied by a segment, 3812 including any controls that occupy sequence space. 3814 segment sequence 3815 The number in the sequence field of the arriving segment. 3817 send sequence 3818 This is the next sequence number the local (sending) TCP 3819 endpoint will use on the connection. It is initially 3820 selected from an initial sequence number curve (ISN) and is 3821 incremented for each octet of data or sequenced control 3822 transmitted. 3824 send window 3825 This represents the sequence numbers that the remote 3826 (receiving) TCP endpoint is willing to receive. It is the 3827 value of the window field specified in segments from the 3828 remote (data receiving) TCP endpoint. The range of new 3829 sequence numbers that may be emitted by a TCP implementation 3830 lies between SND.NXT and SND.UNA + SND.WND - 1. 3831 (Retransmissions of sequence numbers between SND.UNA and 3832 SND.NXT are expected, of course.) 3834 SND.NXT 3835 send sequence 3837 SND.UNA 3838 left sequence 3840 SND.UP 3841 send urgent pointer 3843 SND.WL1 3844 segment sequence number at last window update 3846 SND.WL2 3847 segment acknowledgment number at last window update 3849 SND.WND 3850 send window 3852 socket (or socket number, or socket address, or socket identifier) 3853 An address that specifically includes a port identifier, that 3854 is, the concatenation of an Internet Address with a TCP port. 3856 Source Address 3857 The network layer address of the sending endpoint. 3859 SYN 3860 A control bit in the incoming segment, occupying one sequence 3861 number, used at the initiation of a connection, to indicate 3862 where the sequence numbering will start. 3864 TCB 3865 Transmission control block, the data structure that records 3866 the state of a connection. 3868 TCP 3869 Transmission Control Protocol: A host-to-host protocol for 3870 reliable communication in internetwork environments. 3872 TOS 3873 Type of Service, an obsoleted IPv4 field. The same header 3874 bits currently are used for the Differentiated Services field 3875 [5] containing the Differentiated Services Code Point (DSCP) 3876 value and the 2-bit ECN codepoint [8]. 3878 Type of Service 3879 An Internet Protocol field that indicates the type of service 3880 for this internet fragment. 3882 URG 3883 A control bit (urgent), occupying no sequence space, used to 3884 indicate that the receiving user should be notified to do 3885 urgent processing as long as there is data to be consumed 3886 with sequence numbers less than the value indicated in the 3887 urgent pointer. 3889 urgent pointer 3890 A control field meaningful only when the URG bit is on. This 3891 field communicates the value of the urgent pointer that 3892 indicates the data octet associated with the sending user's 3893 urgent call. 3895 4. Changes from RFC 793 3897 This document obsoletes RFC 793 as well as RFC 6093 and 6528, which 3898 updated 793. In all cases, only the normative protocol specification 3899 and requirements have been incorporated into this document, and some 3900 informational text with background and rationale may not have been 3901 carried in. The informational content of those documents is still 3902 valuable in learning about and understanding TCP, and they are valid 3903 Informational references, even though their normative content has 3904 been incorporated into this document. 3906 The main body of this document was adapted from RFC 793's Section 3, 3907 titled "FUNCTIONAL SPECIFICATION", with an attempt to keep formatting 3908 and layout as close as possible. 3910 The collection of applicable RFC Errata that have been reported and 3911 either accepted or held for an update to RFC 793 were incorporated 3912 (Errata IDs: 573, 574, 700, 701, 1283, 1561, 1562, 1564, 1565, 1571, 3913 1572, 2296, 2297, 2298, 2748, 2749, 2934, 3213, 3300, 3301). Some 3914 errata were not applicable due to other changes (Errata IDs: 572, 3915 575, 1569, 3305, 3602). 3917 Changes to the specification of the Urgent Pointer described in RFC 3918 1122 and 6093 were incorporated. See RFC 6093 for detailed 3919 discussion of why these changes were necessary. 3921 The discussion of the RTO from RFC 793 was updated to refer to RFC 3922 6298. The RFC 1122 text on the RTO originally replaced the 793 text, 3923 however, RFC 2988 should have updated 1122, and has subsequently been 3924 obsoleted by 6298. 3926 RFC 1122 contains a collection of other changes and clarifications to 3927 RFC 793. The normative items impacting the protocol have been 3928 incorporated here, though some historically useful implementation 3929 advice and informative discussion from RFC 1122 is not included here. 3931 RFC 1122 contains more than just TCP requirements, so this document 3932 can't obsolete RFC 1122 entirely. It is only marked as "updating" 3933 1122, however, it should be understood to effectively obsolete all of 3934 the RFC 1122 material on TCP. 3936 The more secure Initial Sequence Number generation algorithm from RFC 3937 6528 was incorporated. See RFC 6528 for discussion of the attacks 3938 that this mitigates, as well as advice on selecting PRF algorithms 3939 and managing secret key data. 3941 A note based on RFC 6429 was added to explicitly clarify that system 3942 resource mangement concerns allow connection resources to be 3943 reclaimed. RFC 6429 is obsoleted in the sense that this 3944 clarification has been reflected in this update to the base TCP 3945 specification now. 3947 RFC EDITOR'S NOTE: the content below is for detailed change tracking 3948 and planning, and not to be included with the final revision of the 3949 document. 3951 This document started as draft-eddy-rfc793bis-00, that was merely a 3952 proposal and rough plan for updating RFC 793. 3954 The -01 revision of this draft-eddy-rfc793bis incorporates the 3955 content of RFC 793 Section 3 titled "FUNCTIONAL SPECIFICATION". 3956 Other content from RFC 793 has not been incorporated. The -01 3957 revision of this document makes some minor formatting changes to the 3958 RFC 793 content in order to convert the content into XML2RFC format 3959 and account for left-out parts of RFC 793. For instance, figure 3960 numbering differs and some indentation is not exactly the same. 3962 The -02 revision of draft-eddy-rfc793bis incorporates errata that 3963 have been verified: 3965 Errata ID 573: Reported by Bob Braden (note: This errata basically 3966 is just a reminder that RFC 1122 updates 793. Some of the 3967 associated changes are left pending to a separate revision that 3968 incorporates 1122. Bob's mention of PUSH in 793 section 2.8 was 3969 not applicable here because that section was not part of the 3970 "functional specification". Also the 1122 text on the 3971 retransmission timeout also has been updated by subsequent RFCs, 3972 so the change here deviates from Bob's suggestion to apply the 3973 1122 text.) 3974 Errata ID 574: Reported by Yin Shuming 3975 Errata ID 700: Reported by Yin Shuming 3976 Errata ID 701: Reported by Yin Shuming 3977 Errata ID 1283: Reported by Pei-chun Cheng 3978 Errata ID 1561: Reported by Constantin Hagemeier 3979 Errata ID 1562: Reported by Constantin Hagemeier 3980 Errata ID 1564: Reported by Constantin Hagemeier 3981 Errata ID 1565: Reported by Constantin Hagemeier 3982 Errata ID 1571: Reported by Constantin Hagemeier 3983 Errata ID 1572: Reported by Constantin Hagemeier 3984 Errata ID 2296: Reported by Vishwas Manral 3985 Errata ID 2297: Reported by Vishwas Manral 3986 Errata ID 2298: Reported by Vishwas Manral 3987 Errata ID 2748: Reported by Mykyta Yevstifeyev 3988 Errata ID 2749: Reported by Mykyta Yevstifeyev 3989 Errata ID 2934: Reported by Constantin Hagemeier 3990 Errata ID 3213: Reported by EugnJun Yi 3991 Errata ID 3300: Reported by Botong Huang 3992 Errata ID 3301: Reported by Botong Huang 3993 Errata ID 3305: Reported by Botong Huang 3994 Note: Some verified errata were not used in this update, as they 3995 relate to sections of RFC 793 elided from this document. These 3996 include Errata ID 572, 575, and 1569. 3997 Note: Errata ID 3602 was not applied in this revision as it is 3998 duplicative of the 1122 corrections. 4000 Not related to RFC 793 content, this revision also makes small tweaks 4001 to the introductory text, fixes indentation of the pseudoheader 4002 diagram, and notes that the Security Considerations should also 4003 include privacy, when this section is written. 4005 The -03 revision of draft-eddy-rfc793bis revises all discussion of 4006 the urgent pointer in order to comply with RFC 6093, 1122, and 1011. 4007 Since 1122 held requirements on the urgent pointer, the full list of 4008 requirements was brought into an appendix of this document, so that 4009 it can be updated as-needed. 4011 The -04 revision of draft-eddy-rfc793bis includes the ISN generation 4012 changes from RFC 6528. 4014 The -05 revision of draft-eddy-rfc793bis incorporates MSS 4015 requirements and definitions from RFC 879, 1122, and 6691, as well as 4016 option-handling requirements from RFC 1122. 4018 The -00 revision of draft-ietf-tcpm-rfc793bis incorporates several 4019 additional clarifications and updates to the section on segmentation, 4020 many of which are based on feedback from Joe Touch improving from the 4021 initial text on this in the previous revision. 4023 The -01 revision incorporates the change to Reserved bits due to ECN, 4024 as well as many other changes that come from RFC 1122. 4026 The -02 revision has small formating modifications in order to 4027 address xml2rfc warnings about long lines. It was a quick update to 4028 avoid document expiration. TCPM working group discussion in 2015 4029 also indicated that that we should not try to add sections on 4030 implementation advice or similar non-normative information. 4032 The -03 revision incorporates more content from RFC 1122: Passive 4033 OPEN Calls, Time-To-Live, Multihoming, IP Options, ICMP messages, 4034 Data Communications, When to Send Data, When to Send a Window Update, 4035 Managing the Window, Probing Zero Windows, When to Send an ACK 4036 Segment. The section on data communications was re-organized into 4037 clearer subsections (previously headings were embedded in the 793 4038 text), and windows management advice from 793 was removed (as 4039 reviewed by TCPM working group) in favor of the 1122 additions on 4040 SWS, ZWP, and related topics. 4042 The -04 revision includes reference to RFC 6429 on the ZWP condition, 4043 RFC1122 material on TCP Connection Failures, TCP Keep-Alives, 4044 Acknowledging Queued Segments, and Remote Address Validation. RTO 4045 computation is referenced from RFC 6298 rather than RFC 1122. 4047 The -05 revision includes the requirement to implement TCP congestion 4048 control with recommendation to implemente ECN, the RFC 6633 update to 4049 1122, which changed the requirement on responding to source quench 4050 ICMP messages, and discussion of ICMP (and ICMPv6) soft and hard 4051 errors per RFC 5461 (ICMPv6 handling for TCP doesn't seem to be 4052 mentioned elsewhere in standards track). 4054 The -06 revision includes an appendix on "Other Implementation Notes" 4055 to capture widely-deployed fundamental features that are not 4056 contained in the RFC series yet. It also added mention of RFC 6994 4057 and the IANA TCP parameters registry as a reference. It includes 4058 references to RFC 5961 in appropriate places. The references to TOS 4059 were changed to DiffServ field, based on reflecting RFC 2474 as well 4060 as the IPv6 presence of traffic class (carrying DiffServ field) 4061 rather than TOS. 4063 The -07 revision includes reference to RFC 6191, updated security 4064 considerations, discussion of additional implementation 4065 considerations, and clarification of data on the SYN. 4067 The -08 revision includes changes based on: 4069 describing treatment of reserved bits (following TCPM mailing list 4070 thread from July 2014 on "793bis item - reserved bit behavior" 4071 addition a brief TCP key concepts section to make up for not 4072 including the outdated section 2 of RFC 793 4073 changed "TCP" to "host" to resolve conflict between 1122 wording 4074 on whether TCP or the network layer chooses an address when 4075 multihomed 4076 fixed/updated definition of options in glossary 4077 moved note on aggregating ACKs from 1122 to a more appropriate 4078 location 4079 resolved notes on IP precedence and security/compartment 4080 added implementation note on sequence number validation 4081 added note that PUSH does not apply when Nagle is active 4082 added 1122 content on asynchronous reports to replace 793 section 4083 on TCP to user messages 4085 The -09 revision fixes section numbering problems. 4087 The -10 revision includes additions to the security considerations 4088 based on comments from Joe Touch, and suggested edits on RST/FIN 4089 notification, RFC 2525 reference, and other edits suggested by 4090 Yuchung Cheng, as well as modifications to DiffServ text from Yuchung 4091 Cheng and Gorry Fairhurst. 4093 The -11 revision includes a start at identifying all of the 4094 requirements text and referencing each instance in the common table 4095 at the end of the document. 4097 The -12 revision completes the requirement language indexing started 4098 in -11 and adds necessary description of the PUSH functionality that 4099 was missing. 4101 The -13 revision contains only changes in the inline editor notes. 4103 The -14 revision includes updates with regard to several comments 4104 from the mailing list, including editorial fixes, adding IANA 4105 considerations for the header flags, improving figure title 4106 placement, and breaking up the "Terminology" section into more 4107 appropriately titled subsections. 4109 The -15 revision has many technical and editorial corrections from 4110 Gorry Fairhurst's review, and subsequent discussion on the TCPM list, 4111 as well as some other collected clarifications and improvements from 4112 mailing list discussion. 4114 The -16 revision addresses several discussions that rose from 4115 additional reviews and follow-up on some of Gorry Fairhurst's 4116 comments from revision 14. 4118 Some other suggested changes that will not be incorporated in this 4119 793 update unless TCPM consensus changes with regard to scope are: 4121 1. Tony Sabatini's suggestion for describing DO field 4122 2. Per discussion with Joe Touch (TAPS list, 6/20/2015), the 4123 description of the API could be revisited 4125 Early in the process of updating RFC 793, Scott Brim mentioned that 4126 this should include a PERPASS/privacy review. This may be something 4127 for the chairs or AD to request during WGLC or IETF LC. 4129 5. IANA Considerations 4131 In the "Transmission Control Protocol (TCP) Header Flags" registry, 4132 IANA is asked to assign values indicated below. RFC 3168 originally 4133 created this registry, but only populated it with the new bits 4134 defined in RFC 3168, not these earlier bits that had been described 4135 in RFC 793 and earlier documents. 4137 TCP Header Flags 4139 Bit Name Reference 4140 --- ---- --------- 4141 10 Urgent Pointer field significant (URG) (this document) 4142 11 Acknowledgment field significant (ACK) (this document) 4143 12 Push Function (PSH) (this document) 4144 13 Reset the connection (RST) (this document) 4145 14 Synchronize sequence numbers (SYN) (this document) 4146 15 No more data from sender (FIN) (this document) 4148 This TCP Header Flags registry should also be moved to a sub-registry 4149 under the global "Transmission Control Protocol (TCP) Parameters 4150 registry (https://www.iana.org/assignments/tcp-parameters/tcp- 4151 parameters.xhtml). 4153 6. Security and Privacy Considerations 4155 The TCP design includes only rudimentary security features that 4156 improve the robustness and reliability of connections and application 4157 data transfer, but there are no built-in cryptographic capabilities 4158 to support any form of privacy, authentication, or other typical 4159 security functions. Non-cryptographic enhancements (e.g. [31]) have 4160 been developed to improve robustness of TCP connections to particular 4161 types of attacks, but the applicability and protections of non- 4162 cryptographic enhancements are limited (e.g. see section 1.1 of 4163 [31]). Applications typically utilize lower-layer (e.g. IPsec) and 4164 upper-layer (e.g. TLS) protocols to provide security and privacy for 4165 TCP connections and application data carried in TCP. Methods based 4166 on TCP options have been developed as well, to support some security 4167 capabilities. 4169 In order to fully protect TCP connections (including their control 4170 flags) IPsec or the TCP Authentication Option (TCP-AO) [30] are the 4171 only current effective methods. Other methods discussed in this 4172 section may protect the payload, but either only a subset of the 4173 fields (e.g. tcpcrypt) or none at all (e.g. TLS). Other security 4174 features that have been added to TCP (e.g. ISN generation, sequence 4175 number checks, etc.) are only capable of partially hindering attacks. 4177 Applications using long-lived TCP flows have been vulnerable to 4178 attacks that exploit the processing of control flags described in 4179 earlier TCP specifications [24]. TCP-MD5 was a commonly implemented 4180 TCP option to support authentication for some of these connections, 4181 but had flaws and is now deprecated. TCP-AO provides a capability to 4182 protect long-lived TCP connections from attacks, and has superior 4183 properties to TCP-MD5. It does not provide any privacy for 4184 application data, nor for the TCP headers. 4186 The "tcpcrypt" [51] Experimental extension to TCP provides the 4187 ability to cryptographically protect connection data. Metadata 4188 aspects of the TCP flow are still visible, but the application stream 4189 is well-protected. Within the TCP header, only the urgent pointer 4190 and FIN flag are protected through tcpcrypt. 4192 The TCP Roadmap [41] includes notes about several RFCs related to TCP 4193 security. Many of the enhancements provided by these RFCs have been 4194 integrated into the present document, including ISN generation, 4195 mitigating blind in-window attacks, and improving handling of soft 4196 errors and ICMP packets. These are all discussed in greater detail 4197 in the referenced RFCs that originally described the changes needed 4198 to earlier TCP specifications. Additionally, see RFC 6093 [32] for 4199 discussion of security considerations related to the urgent pointer 4200 field, that has been deprecated. 4202 Since TCP is often used for bulk transfer flows, some attacks are 4203 possible that abuse the TCP congestion control logic. An example is 4204 "ACK-division" attacks. Updates that have been made to the TCP 4205 congestion control specifications include mechanisms like Appropriate 4206 Byte Counting (ABC) [20] that act as mitigations to these attacks. 4208 Other attacks are focused on exhausting the resources of a TCP 4209 server. Examples include SYN flooding [23] or wasting resources on 4210 non-progressing connections [34]. Operating systems commonly 4211 implement mitigations for these attacks. Some common defenses also 4212 utilize proxies, stateful firewalls, and other technologies outside 4213 of the end-host TCP implementation. 4215 7. Acknowledgements 4217 This document is largely a revision of RFC 793, which Jon Postel was 4218 the editor of. Due to his excellent work, it was able to last for 4219 three decades before we felt the need to revise it. 4221 Andre Oppermann was a contributor and helped to edit the first 4222 revision of this document. 4224 We are thankful for the assistance of the IETF TCPM working group 4225 chairs, over the course of work on this document: 4227 Michael Scharf 4228 Yoshifumi Nishida 4229 Pasi Sarolahti 4230 Michael Tuexen 4232 During the discussions of this work on the TCPM mailing list and in 4233 working group meetings, helpful comments, critiques, and reviews were 4234 received from (listed alphabetically): David Borman, Mohamed 4235 Boucadair, Bob Briscoe, Neal Cardwell, Yuchung Cheng, Martin Duke, 4236 Ted Faber, Gorry Fairhurst, Fernando Gont, Rodney Grimes, Mike Kosek, 4237 Kevin Lahey, Kevin Mason, Matt Mathis, Jonathan Morton, Tommy Pauly, 4238 Hagen Paul Pfeifer, Anthony Sabatini, Michael Scharf, Greg Skinner, 4239 Joe Touch, Michael Tuexen, Reji Varghese, Tim Wicinski, Lloyd Wood, 4240 and Alex Zimmermann. Joe Touch provided additional help in 4241 clarifying the description of segment size parameters and PMTUD/ 4242 PLPMTUD recommendations. 4244 This document includes content from errata that were reported by 4245 (listed chronologically): Yin Shuming, Bob Braden, Morris M. Keesan, 4246 Pei-chun Cheng, Constantin Hagemeier, Vishwas Manral, Mykyta 4247 Yevstifeyev, EungJun Yi, Botong Huang. 4249 8. References 4251 8.1. Normative References 4253 [1] Postel, J., "Internet Protocol", STD 5, RFC 791, 4254 DOI 10.17487/RFC0791, September 1981, 4255 . 4257 [2] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, 4258 DOI 10.17487/RFC1191, November 1990, 4259 . 4261 [3] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery 4262 for IP version 6", RFC 1981, DOI 10.17487/RFC1981, August 4263 1996, . 4265 [4] Bradner, S., "Key words for use in RFCs to Indicate 4266 Requirement Levels", BCP 14, RFC 2119, 4267 DOI 10.17487/RFC2119, March 1997, 4268 . 4270 [5] Nichols, K., Blake, S., Baker, F., and D. Black, 4271 "Definition of the Differentiated Services Field (DS 4272 Field) in the IPv4 and IPv6 Headers", RFC 2474, 4273 DOI 10.17487/RFC2474, December 1998, 4274 . 4276 [6] Borman, D., Deering, S., and R. Hinden, "IPv6 Jumbograms", 4277 RFC 2675, DOI 10.17487/RFC2675, August 1999, 4278 . 4280 [7] Lahey, K., "TCP Problems with Path MTU Discovery", 4281 RFC 2923, DOI 10.17487/RFC2923, September 2000, 4282 . 4284 [8] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition 4285 of Explicit Congestion Notification (ECN) to IP", 4286 RFC 3168, DOI 10.17487/RFC3168, September 2001, 4287 . 4289 [9] Paxson, V., Allman, M., Chu, J., and M. Sargent, 4290 "Computing TCP's Retransmission Timer", RFC 6298, 4291 DOI 10.17487/RFC6298, June 2011, 4292 . 4294 [10] Gont, F., "Deprecation of ICMP Source Quench Messages", 4295 RFC 6633, DOI 10.17487/RFC6633, May 2012, 4296 . 4298 [11] Deering, S. and R. Hinden, "Internet Protocol, Version 6 4299 (IPv6) Specification", STD 86, RFC 8200, 4300 DOI 10.17487/RFC8200, July 2017, 4301 . 4303 8.2. Informative References 4305 [12] Postel, J., "Transmission Control Protocol", STD 7, 4306 RFC 793, DOI 10.17487/RFC0793, September 1981, 4307 . 4309 [13] Nagle, J., "Congestion Control in IP/TCP Internetworks", 4310 RFC 896, DOI 10.17487/RFC0896, January 1984, 4311 . 4313 [14] Braden, R., Ed., "Requirements for Internet Hosts - 4314 Communication Layers", STD 3, RFC 1122, 4315 DOI 10.17487/RFC1122, October 1989, 4316 . 4318 [15] Almquist, P., "Type of Service in the Internet Protocol 4319 Suite", RFC 1349, DOI 10.17487/RFC1349, July 1992, 4320 . 4322 [16] Braden, R., "T/TCP -- TCP Extensions for Transactions 4323 Functional Specification", RFC 1644, DOI 10.17487/RFC1644, 4324 July 1994, . 4326 [17] Paxson, V., Allman, M., Dawson, S., Fenner, W., Griner, 4327 J., Heavens, I., Lahey, K., Semke, J., and B. Volz, "Known 4328 TCP Implementation Problems", RFC 2525, 4329 DOI 10.17487/RFC2525, March 1999, 4330 . 4332 [18] Xiao, X., Hannan, A., Paxson, V., and E. Crabbe, "TCP 4333 Processing of the IPv4 Precedence Field", RFC 2873, 4334 DOI 10.17487/RFC2873, June 2000, 4335 . 4337 [19] Balakrishnan, H., Padmanabhan, V., Fairhurst, G., and M. 4338 Sooriyabandara, "TCP Performance Implications of Network 4339 Path Asymmetry", BCP 69, RFC 3449, DOI 10.17487/RFC3449, 4340 December 2002, . 4342 [20] Allman, M., "TCP Congestion Control with Appropriate Byte 4343 Counting (ABC)", RFC 3465, DOI 10.17487/RFC3465, February 4344 2003, . 4346 [21] Fenner, B., "Experimental Values In IPv4, IPv6, ICMPv4, 4347 ICMPv6, UDP, and TCP Headers", RFC 4727, 4348 DOI 10.17487/RFC4727, November 2006, 4349 . 4351 [22] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 4352 Discovery", RFC 4821, DOI 10.17487/RFC4821, March 2007, 4353 . 4355 [23] Eddy, W., "TCP SYN Flooding Attacks and Common 4356 Mitigations", RFC 4987, DOI 10.17487/RFC4987, August 2007, 4357 . 4359 [24] Touch, J., "Defending TCP Against Spoofing Attacks", 4360 RFC 4953, DOI 10.17487/RFC4953, July 2007, 4361 . 4363 [25] Culley, P., Elzur, U., Recio, R., Bailey, S., and J. 4364 Carrier, "Marker PDU Aligned Framing for TCP 4365 Specification", RFC 5044, DOI 10.17487/RFC5044, October 4366 2007, . 4368 [26] Gont, F., "TCP's Reaction to Soft Errors", RFC 5461, 4369 DOI 10.17487/RFC5461, February 2009, 4370 . 4372 [27] StJohns, M., Atkinson, R., and G. Thomas, "Common 4373 Architecture Label IPv6 Security Option (CALIPSO)", 4374 RFC 5570, DOI 10.17487/RFC5570, July 2009, 4375 . 4377 [28] Allman, M., Paxson, V., and E. Blanton, "TCP Congestion 4378 Control", RFC 5681, DOI 10.17487/RFC5681, September 2009, 4379 . 4381 [29] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust 4382 Header Compression (ROHC) Framework", RFC 5795, 4383 DOI 10.17487/RFC5795, March 2010, 4384 . 4386 [30] Touch, J., Mankin, A., and R. Bonica, "The TCP 4387 Authentication Option", RFC 5925, DOI 10.17487/RFC5925, 4388 June 2010, . 4390 [31] Ramaiah, A., Stewart, R., and M. Dalal, "Improving TCP's 4391 Robustness to Blind In-Window Attacks", RFC 5961, 4392 DOI 10.17487/RFC5961, August 2010, 4393 . 4395 [32] Gont, F. and A. Yourtchenko, "On the Implementation of the 4396 TCP Urgent Mechanism", RFC 6093, DOI 10.17487/RFC6093, 4397 January 2011, . 4399 [33] Gont, F., "Reducing the TIME-WAIT State Using TCP 4400 Timestamps", BCP 159, RFC 6191, DOI 10.17487/RFC6191, 4401 April 2011, . 4403 [34] Bashyam, M., Jethanandani, M., and A. Ramaiah, "TCP Sender 4404 Clarification for Persist Condition", RFC 6429, 4405 DOI 10.17487/RFC6429, December 2011, 4406 . 4408 [35] Gont, F. and S. Bellovin, "Defending against Sequence 4409 Number Attacks", RFC 6528, DOI 10.17487/RFC6528, February 4410 2012, . 4412 [36] Borman, D., "TCP Options and Maximum Segment Size (MSS)", 4413 RFC 6691, DOI 10.17487/RFC6691, July 2012, 4414 . 4416 [37] Touch, J., "Updated Specification of the IPv4 ID Field", 4417 RFC 6864, DOI 10.17487/RFC6864, February 2013, 4418 . 4420 [38] Touch, J., "Shared Use of Experimental TCP Options", 4421 RFC 6994, DOI 10.17487/RFC6994, August 2013, 4422 . 4424 [39] Borman, D., Braden, B., Jacobson, V., and R. 4425 Scheffenegger, Ed., "TCP Extensions for High Performance", 4426 RFC 7323, DOI 10.17487/RFC7323, September 2014, 4427 . 4429 [40] Cheng, Y., Chu, J., Radhakrishnan, S., and A. Jain, "TCP 4430 Fast Open", RFC 7413, DOI 10.17487/RFC7413, December 2014, 4431 . 4433 [41] Duke, M., Braden, R., Eddy, W., Blanton, E., and A. 4434 Zimmermann, "A Roadmap for Transmission Control Protocol 4435 (TCP) Specification Documents", RFC 7414, 4436 DOI 10.17487/RFC7414, February 2015, 4437 . 4439 [42] Black, D., Ed. and P. Jones, "Differentiated Services 4440 (Diffserv) and Real-Time Communication", RFC 7657, 4441 DOI 10.17487/RFC7657, November 2015, 4442 . 4444 [43] Fairhurst, G. and M. Welzl, "The Benefits of Using 4445 Explicit Congestion Notification (ECN)", RFC 8087, 4446 DOI 10.17487/RFC8087, March 2017, 4447 . 4449 [44] Fairhurst, G., Ed., Trammell, B., Ed., and M. Kuehlewind, 4450 Ed., "Services Provided by IETF Transport Protocols and 4451 Congestion Control Mechanisms", RFC 8095, 4452 DOI 10.17487/RFC8095, March 2017, 4453 . 4455 [45] Welzl, M., Tuexen, M., and N. Khademi, "On the Usage of 4456 Transport Features Provided by IETF Transport Protocols", 4457 RFC 8303, DOI 10.17487/RFC8303, February 2018, 4458 . 4460 [46] Chown, T., Loughney, J., and T. Winters, "IPv6 Node 4461 Requirements", BCP 220, RFC 8504, DOI 10.17487/RFC8504, 4462 January 2019, . 4464 [47] IANA, "Transmission Control Protocol (TCP) Parameters, 4465 https://www.iana.org/assignments/tcp-parameters/tcp- 4466 parameters.xhtml", 2019. 4468 [48] IANA, "Transmission Control Protocol (TCP) Header Flags, 4469 https://www.iana.org/assignments/tcp-header-flags/tcp- 4470 header-flags.xhtml", 2019. 4472 [49] Gont, F., "Processing of IP Security/Compartment and 4473 Precedence Information by TCP", draft-gont-tcpm-tcp- 4474 seccomp-prec-00 (work in progress), March 2012. 4476 [50] Gont, F. and D. Borman, "On the Validation of TCP Sequence 4477 Numbers", draft-gont-tcpm-tcp-seq-validation-02 (work in 4478 progress), March 2015. 4480 [51] Bittau, A., Giffin, D., Handley, M., Mazieres, D., Slack, 4481 Q., and E. Smith, "Cryptographic protection of TCP Streams 4482 (tcpcrypt)", draft-ietf-tcpinc-tcpcrypt-09 (work in 4483 progress), November 2017. 4485 [52] Touch, J. and W. Eddy, "TCP Extended Data Offset Option", 4486 draft-ietf-tcpm-tcp-edo-10 (work in progress), July 2018. 4488 [53] Minshall, G., "A Proposed Modification to Nagle's 4489 Algorithm", draft-minshall-nagle-01 (work in progress), 4490 June 1999. 4492 [54] Dalal, Y. and C. Sunshine, "Connection Management in 4493 Transport Protocols", Computer Networks Vol. 2, No. 6, pp. 4494 454-473, December 1978. 4496 Appendix A. Other Implementation Notes 4498 This section includes additional notes and references on TCP 4499 implementation decisions that are currently not a part of the RFC 4500 series or included within the TCP standard. These items can be 4501 considered by implementers, but there was not yet a consensus to 4502 include them in the standard. 4504 A.1. IP Security Compartment and Precedence 4506 The IPv4 specification [1] includes a precedence value in the (now 4507 obsoleted) Type of Service field (TOS) field. It was modified in 4508 [15], and then obsoleted by the definition of Differentiated Services 4509 (DiffServ) [5]. Setting and conveying TOS between the network layer, 4510 TCP implementation, and applications is obsolete, and replaced by 4511 DiffServ in the current TCP specification. 4513 RFC 793 requires checking the IP security compartment and precedence 4514 on incoming TCP segments for consistency within a connection, and 4515 with application requests. Each of these aspects of IP have become 4516 outdated, without specific updates to RFC 793. The issues with 4517 precedence were fixed by [18], which is Standards Track, and so this 4518 present TCP specification includes those changes. However, the state 4519 of IP security options that may be used by MLS systems is not as 4520 clean. 4522 Reseting connections when incoming packets do not meet expected 4523 security compartment or precedence expectations has been recognized 4524 as a possible attack vector [49], and there has been discussion about 4525 ammending the TCP specification to prevent connections from being 4526 aborted due to non-matching IP security compartment and DiffServ 4527 codepoint values. 4529 A.1.1. Precedence 4531 In DiffServ the former precedence values are treated as Class 4532 Selector codepoints, and methods for compatible treatment are 4533 described in the DiffServ architecture. The RFC 793/1122 TCP 4534 specification includes logic intending to have connections use the 4535 highest precedence requested by either endpoint application, and to 4536 keep the precedence consistent throughout a connection. This logic 4537 from the obsolete TOS is not applicable for DiffServ, and should not 4538 be included in TCP implementations, though changes to DiffServ values 4539 within a connection are discouraged. For discussion of this, see RFC 4540 7657 (sec 5.1, 5.3, and 6) [42]. 4542 The obsoleted TOS processing rules in TCP assumed bidirectional (or 4543 symmetric) precedence values used on a connection, but the DiffServ 4544 architecture is asymmetric. Problems with the old TCP logic in this 4545 regard were described in [18] and the solution described is to ignore 4546 IP precedence in TCP. Since RFC 2873 is a Standards Track document 4547 (although not marked as updating RFC 793), current implementations 4548 are expected to be robust to these conditions. Note that the 4549 DiffServ field value used in each direction is a part of the 4550 interface between TCP and the network layer, and values in use can be 4551 indicated both ways between TCP and the application. 4553 A.1.2. MLS Systems 4555 The IP security option (IPSO) and compartment defined in [1] was 4556 refined in RFC 1038 that was later obsoleted by RFC 1108. The 4557 Commercial IP Security Option (CIPSO) is defined in FIPS-188, and is 4558 supported by some vendors and operating systems. RFC 1108 is now 4559 Historic, though RFC 791 itself has not been updated to remove the IP 4560 security option. For IPv6, a similar option (CALIPSO) has been 4561 defined [27]. RFC 793 includes logic that includes the IP security/ 4562 compartment information in treatment of TCP segments. References to 4563 the IP "security/compartment" in this document may be relevant for 4564 Multi-Level Secure (MLS) system implementers, but can be ignored for 4565 non-MLS implementations, consistent with running code on the 4566 Internet. See Appendix A.1 for further discussion. Note that RFC 4567 5570 describes some MLS networking scenarios where IPSO, CIPSO, or 4568 CALIPSO may be used. In these special cases, TCP implementers should 4569 see section 7.3.1 of RFC 5570, and follow the guidance in that 4570 document. 4572 A.2. Sequence Number Validation 4574 There are cases where the TCP sequence number validation rules can 4575 prevent ACK fields from being processed. This can result in 4576 connection issues, as described in [50], which includes descriptions 4577 of potential problems in conditions of simultaneous open, self- 4578 connects, simultaneous close, and simultaneous window probes. The 4579 document also describes potential changes to the TCP specification to 4580 mitigate the issue by expanding the acceptable sequence numbers. 4582 In Internet usage of TCP, these conditions are rarely occuring. 4583 Common operating systems include different alternative mitigations, 4584 and the standard has not been updated yet to codify one of them, but 4585 implementers should consider the problems described in [50]. 4587 A.3. Nagle Modification 4589 In common operating systems, both the Nagle algorithm and delayed 4590 acknowledgements are implemented and enabled by default. TCP is used 4591 by many applications that have a request-response style of 4592 communication, where the combination of the Nagle algorithm and 4593 delayed acknowledgements can result in poor application performance. 4594 A modification to the Nagle algorithm is described in [53] that 4595 improves the situation for these applications. 4597 This modification is implemented in some common operating systems, 4598 and does not impact TCP interoperability. Additionally, many 4599 applications simply disable Nagle, since this is generally supported 4600 by a socket option. The TCP standard has not been updated to include 4601 this Nagle modification, but implementers may find it beneficial to 4602 consider. 4604 A.4. Low Water Mark Settings 4606 Some operating system kernel TCP implementations include socket 4607 options that allow specifying the number of bytes in the buffer until 4608 the socket layer will pass sent data to TCP (SO_SNDLOWAT) or to the 4609 application on receiving (SO_RCVLOWAT). 4611 In addition, another socket option (TCP_NOTSENT_LOWAT) can be used to 4612 control the amount of unsent bytes in the write queue. This can help 4613 a sending TCP application to avoid creating large amounts of buffered 4614 data (and corresponding latency). As an example, this may be useful 4615 for applications that are multiplexing data from multiple upper level 4616 streams onto a connection, especially when streams may be a mix of 4617 interactive/realtime and bulk data transfer. 4619 Appendix B. TCP Requirement Summary 4621 This section is adapted from RFC 1122. 4623 Note that there is no requirement related to PLPMTUD in this list, 4624 but that PLPMTUD is recommended. 4626 | | | | |S| | 4627 | | | | |H| |F 4628 | | | | |O|M|o 4629 | | |S| |U|U|o 4630 | | |H| |L|S|t 4631 | |M|O| |D|T|n 4632 | |U|U|M| | |o 4633 | |S|L|A|N|N|t 4634 | |T|D|Y|O|O|t 4635 FEATURE | ReqID | | | |T|T|e 4636 -------------------------------------------------|--------|-|-|-|-|-|-- 4637 | | | | | | | 4638 Push flag | | | | | | | 4639 Aggregate or queue un-pushed data | MAY-16 | | |x| | | 4640 Sender collapse successive PSH flags | SHLD-27| |x| | | | 4641 SEND call can specify PUSH | MAY-15 | | |x| | | 4642 If cannot: sender buffer indefinitely | MUST-60| | | | |x| 4643 If cannot: PSH last segment | MUST-61|x| | | | | 4644 Notify receiving ALP of PSH | MAY-17 | | |x| | |1 4645 Send max size segment when possible | SHLD-28| |x| | | | 4646 | | | | | | | 4647 Window | | | | | | | 4648 Treat as unsigned number | MUST-1 |x| | | | | 4649 Handle as 32-bit number | REC-1 | |x| | | | 4650 Shrink window from right | SHLD-14| | | |x| | 4651 - Send new data when window shrinks | SHLD-15| | | |x| | 4652 - Retransmit old unacked data within window | SHLD-16| |x| | | | 4653 - Time out conn for data past right edge | SHLD-17| | | |x| | 4654 Robust against shrinking window | MUST-34|x| | | | | 4655 Receiver's window closed indefinitely | MAY-8 | | |x| | | 4656 Use standard probing logic | MUST-35|x| | | | | 4657 Sender probe zero window | MUST-36|x| | | | | 4658 First probe after RTO | SHLD-29| |x| | | | 4659 Exponential backoff | SHLD-30| |x| | | | 4660 Allow window stay zero indefinitely | MUST-37|x| | | | | 4661 Retransmit old data beyond SND.UNA+SND.WND | MAY-7 | | |x| | | 4662 Process RST and URG even with zero window | MUST-66|x| | | | | 4663 | | | | | | | 4664 Urgent Data | | | | | | | 4665 Include support for urgent pointer | MUST-30|x| | | | | 4666 Pointer indicates first non-urgent octet | MUST-62|x| | | | | 4667 Arbitrary length urgent data sequence | MUST-31|x| | | | | 4668 Inform ALP asynchronously of urgent data | MUST-32|x| | | | |1 4669 ALP can learn if/how much urgent data Q'd | MUST-33|x| | | | |1 4670 ALP employ the urgent mechanism | SHLD-13| | | |x| | 4671 | | | | | | | 4672 TCP Options | | | | | | | 4673 Support the mandatory option set | MUST-4 |x| | | | | 4674 Receive TCP option in any segment | MUST-5 |x| | | | | 4675 Ignore unsupported options | MUST-6 |x| | | | | 4676 Cope with illegal option length | MUST-7 |x| | | | | 4677 Process options regardless of word alignment | MUST-64|x| | | | | 4678 Implement sending & receiving MSS option | MUST-14|x| | | | | 4679 IPv4 Send MSS option unless 536 | SHLD-5 | |x| | | | 4680 IPv6 Send MSS option unless 1220 | SHLD-5 | |x| | | | 4681 Send MSS option always | MAY-3 | | |x| | | 4682 IPv4 Send-MSS default is 536 | MUST-15|x| | | | | 4683 IPv6 Send-MSS default is 1220 | MUST-15|x| | | | | 4684 Calculate effective send seg size | MUST-16|x| | | | | 4685 MSS accounts for varying MTU | SHLD-6 | |x| | | | 4686 MSS not sent on non-SYN segments | MUST-65| | | | |x| 4687 MSS value based on MMS_R | MUST-67|x| | | | | 4688 | | | | | | | 4689 TCP Checksums | | | | | | | 4690 Sender compute checksum | MUST-2 |x| | | | | 4691 Receiver check checksum | MUST-3 |x| | | | | 4692 | | | | | | | 4693 ISN Selection | | | | | | | 4694 Include a clock-driven ISN generator component | MUST-8 |x| | | | | 4695 Secure ISN generator with a PRF component | SHLD-1 | |x| | | | 4696 PRF computable from outside the host | MUST-9 | | | | |x| 4697 | | | | | | | 4698 Opening Connections | | | | | | | 4699 Support simultaneous open attempts | MUST-10|x| | | | | 4700 SYN-RECEIVED remembers last state | MUST-11|x| | | | | 4701 Passive Open call interfere with others | MUST-41| | | | |x| 4702 Function: simultan. LISTENs for same port | MUST-42|x| | | | | 4703 Ask IP for src address for SYN if necc. | MUST-44|x| | | | | 4704 Otherwise, use local addr of conn. | MUST-45|x| | | | | 4705 OPEN to broadcast/multicast IP Address | MUST-46| | | | |x| 4706 Silently discard seg to bcast/mcast addr | MUST-57|x| | | | | 4707 | | | | | | | 4708 Closing Connections | | | | | | | 4709 RST can contain data | SHLD-2 | |x| | | | 4710 Inform application of aborted conn | MUST-12|x| | | | | 4711 Half-duplex close connections | MAY-1 | | |x| | | 4712 Send RST to indicate data lost | SHLD-3 | |x| | | | 4713 In TIME-WAIT state for 2MSL seconds | MUST-13|x| | | | | 4714 Accept SYN from TIME-WAIT state | MAY-2 | | |x| | | 4715 Use Timestamps to reduce TIME-WAIT | SHLD-4 | |x| | | | 4716 | | | | | | | 4717 Retransmissions | | | | | | | 4718 Implement RFC 5681 | MUST-19|x| | | | | 4719 Retransmit with same IP ident | MAY-4 | | |x| | | 4720 Karn's algorithm | MUST-18|x| | | | | 4721 | | | | | | | 4722 Generating ACK's: | | | | | | | 4723 Aggregate whenever possible | MUST-58|x| | | | | 4724 Queue out-of-order segments | SHLD-31| |x| | | | 4725 Process all Q'd before send ACK | MUST-59|x| | | | | 4726 Send ACK for out-of-order segment | MAY-13 | | |x| | | 4727 Delayed ACK's | SHLD-18| |x| | | | 4728 Delay < 0.5 seconds | MUST-40|x| | | | | 4729 Every 2nd full-sized segment ACK'd | SHLD-19|x| | | | | 4730 Receiver SWS-Avoidance Algorithm | MUST-39|x| | | | | 4731 | | | | | | | 4732 Sending data | | | | | | | 4733 Configurable TTL | MUST-49|x| | | | | 4734 Sender SWS-Avoidance Algorithm | MUST-38|x| | | | | 4735 Nagle algorithm | SHLD-7 | |x| | | | 4736 Application can disable Nagle algorithm | MUST-17|x| | | | | 4737 | | | | | | | 4738 Connection Failures: | | | | | | | 4739 Negative advice to IP on R1 retxs | MUST-20|x| | | | | 4740 Close connection on R2 retxs | MUST-20|x| | | | | 4741 ALP can set R2 | MUST-21|x| | | | |1 4742 Inform ALP of R1<=retxs inform ALP | SHLD-25| |x| | | | 4770 Dest. Unreach (0,1,5) => abort conn | MUST-56| | | | |x| 4771 Dest. Unreach (2-4) => abort conn | SHLD-26| |x| | | | 4772 Source Quench => silent discard | MUST-55|x| | | | | 4773 Time Exceeded => tell ALP, don't abort | MUST-56| | | | |x| 4774 Param Problem => tell ALP, don't abort | MUST-56| | | | |x| 4775 | | | | | | | 4776 Address Validation | | | | | | | 4777 Reject OPEN call to invalid IP address | MUST-46|x| | | | | 4778 Reject SYN from invalid IP address | MUST-63|x| | | | | 4779 Silently discard SYN to bcast/mcast addr | MUST-57|x| | | | | 4780 | | | | | | | 4781 TCP/ALP Interface Services | | | | | | | 4782 Error Report mechanism | MUST-47|x| | | | | 4783 ALP can disable Error Report Routine | SHLD-20| |x| | | | 4784 ALP can specify DiffServ field for sending | MUST-48|x| | | | | 4785 Passed unchanged to IP | SHLD-22| |x| | | | 4786 ALP can change DiffServ field during connection| SHLD-21| |x| | | | 4787 ALP generally changing DiffServ during conn. | SHLD-23| | | |x| | 4788 Pass received DiffServ field up to ALP | MAY-9 | | |x| | | 4789 FLUSH call | MAY-14 | | |x| | | 4790 Optional local IP addr parm. in OPEN | MUST-43|x| | | | | 4791 | | | | | | | 4793 RFC 5961 Support: | | | | | | | 4794 Implement data injection protection | MAY-12 | | |x| | | 4795 | | | | | | | 4796 Explicit Congestion Notification: | | | | | | | 4797 Support ECN | SHLD-8 | |x| | | | 4798 -------------------------------------------------|--------|-|-|-|-|-|- 4800 FOOTNOTES: (1) "ALP" means Application-Layer program. 4802 Author's Address 4804 Wesley M. Eddy (editor) 4805 MTI Systems 4806 US 4808 Email: wes@mti-systems.com