idnits 2.17.1 draft-ietf-tcpm-rfc793bis-06.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 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. -- The draft header indicates that this document obsoletes RFC6528, 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 (July 17, 2017) is 2473 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) ** Obsolete normative reference: RFC 2460 (ref. '5') (Obsoleted by RFC 8200) ** Downref: Normative reference to an Informational RFC: RFC 2923 (ref. '8') -- 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 6093 (ref. '21') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6429 (ref. '22') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6528 (ref. '23') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6691 (ref. '24') (Obsoleted by RFC 9293) Summary: 4 errors (**), 0 flaws (~~), 2 warnings (==), 12 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, 6093, 6429, 6528, July 17, 2017 5 6691 (if approved) 6 Updates: 5961, 1122 (if approved) 7 Intended status: Standards Track 8 Expires: January 18, 2018 10 Transmission Control Protocol Specification 11 draft-ietf-tcpm-rfc793bis-06 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, 6093, 6429, 6528, 23 and 6691. It updates RFC 1122, and should be considered as a 24 replacement for the portions of that document dealing with TCP 25 requirements. It updates RFC 5961 due to a small clarification in 26 reset handling while in the SYN-RECEIVED state. (TODO: double-check 27 this list for all actual RFCs when finished) 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 http://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 January 18, 2018. 55 Copyright Notice 57 Copyright (c) 2017 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 (http://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 3. Functional Specification . . . . . . . . . . . . . . . . . . 5 87 3.1. Header Format . . . . . . . . . . . . . . . . . . . . . . 5 88 3.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 10 89 3.3. Sequence Numbers . . . . . . . . . . . . . . . . . . . . 15 90 3.4. Establishing a connection . . . . . . . . . . . . . . . . 21 91 3.4.1. Remote Address Validation . . . . . . . . . . . . . . 28 92 3.5. Closing a Connection . . . . . . . . . . . . . . . . . . 28 93 3.5.1. Half-Closed Connections . . . . . . . . . . . . . . . 31 94 3.6. Precedence and Security . . . . . . . . . . . . . . . . . 31 95 3.7. Segmentation . . . . . . . . . . . . . . . . . . . . . . 32 96 3.7.1. Maximum Segment Size Option . . . . . . . . . . . . . 33 97 3.7.2. Path MTU Discovery . . . . . . . . . . . . . . . . . 35 98 3.7.3. Interfaces with Variable MTU Values . . . . . . . . . 35 99 3.7.4. Nagle Algorithm . . . . . . . . . . . . . . . . . . . 36 100 3.7.5. IPv6 Jumbograms . . . . . . . . . . . . . . . . . . . 36 101 3.8. Data Communication . . . . . . . . . . . . . . . . . . . 36 102 3.8.1. Retransmission Timeout . . . . . . . . . . . . . . . 37 103 3.8.2. TCP Congestion Control . . . . . . . . . . . . . . . 37 104 3.8.3. TCP Connection Failures . . . . . . . . . . . . . . . 38 105 3.8.4. TCP Keep-Alives . . . . . . . . . . . . . . . . . . . 39 106 3.8.5. The Communication of Urgent Information . . . . . . . 39 107 3.8.6. Managing the Window . . . . . . . . . . . . . . . . . 40 108 3.9. Interfaces . . . . . . . . . . . . . . . . . . . . . . . 44 109 3.9.1. User/TCP Interface . . . . . . . . . . . . . . . . . 45 110 3.9.2. TCP/Lower-Level Interface . . . . . . . . . . . . . . 53 111 3.10. Event Processing . . . . . . . . . . . . . . . . . . . . 55 112 3.11. Glossary . . . . . . . . . . . . . . . . . . . . . . . . 80 113 4. Changes from RFC 793 . . . . . . . . . . . . . . . . . . . . 86 114 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 90 115 6. Security and Privacy Considerations . . . . . . . . . . . . . 90 116 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 90 117 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 91 118 8.1. Normative References . . . . . . . . . . . . . . . . . . 91 119 8.2. Informative References . . . . . . . . . . . . . . . . . 92 120 Appendix A. Other Implementation Notes . . . . . . . . . . . . . 93 121 Appendix B. TCP Requirement Summary . . . . . . . . . . . . . . 94 122 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 97 124 1. Purpose and Scope 126 In 1981, RFC 793 [12] was released, documenting the Transmission 127 Control Protocol (TCP), and replacing earlier specifications for TCP 128 that had been published in the past. 130 Since then, TCP has been implemented many times, and has been used as 131 a transport protocol for numerous applications on the Internet. 133 For several decades, RFC 793 plus a number of other documents have 134 combined to serve as the specification for TCP [27]. Over time, a 135 number of errata have been identified on RFC 793, as well as 136 deficiencies in security, performance, and other aspects. A number 137 of enhancements has grown and been documented separately. These were 138 never accumulated together into an update to the base specification. 140 The purpose of this document is to bring together all of the IETF 141 Standards Track changes that have been made to the basic TCP 142 functional specification and unify them into an update of the RFC 793 143 protocol specification. Some companion documents are referenced for 144 important algorithms that TCP uses (e.g. for congestion control), but 145 have not been attempted to include in this document. This is a 146 conscious choice, as this base specification can be used with 147 multiple additional algorithms that are developed and incorporated 148 separately, but all TCP implementations need to implement this 149 specification as a common basis in order to interoperate. As some 150 additional TCP features have become quite complicated themselves 151 (e.g. advanced loss recovery and congestion control), future 152 companion documents may attempt to similarly bring these together. 154 In addition to the protocol specification that descibes the TCP 155 segment format, generation, and processing rules that are to be 156 implemented in code, RFC 793 and other updates also contain 157 informative and descriptive text for human readers to understand 158 aspects of the protocol design and operation. This document does not 159 attempt to alter or update this informative text, and is focused only 160 on updating the normative protocol specification. We preserve 161 references to the documentation containing the important explanations 162 and rationale, where appropriate. 164 This document is intended to be useful both in checking existing TCP 165 implementations for conformance, as well as in writing new 166 implementations. 168 2. Introduction 170 RFC 793 contains a discussion of the TCP design goals and provides 171 examples of its operation, including examples of connection 172 establishment, closing connections, and retransmitting packets to 173 repair losses. 175 This document describes the basic functionality expected in modern 176 implementations of TCP, and replaces the protocol specification in 177 RFC 793. It does not replicate or attempt to update the examples and 178 other discussion in RFC 793. Other documents are referenced to 179 provide explanation of the theory of operation, rationale, and 180 detailed discussion of design decisions. This document only focuses 181 on the normative behavior of the protocol. 183 The "TCP Roadmap" [27] provides a more extensive guide to the RFCs 184 that define TCP and describe various important algorithms. The TCP 185 Roadmap contains sections on strongly encouraged enhancements that 186 improve performance and other aspects of TCP beyond the basic 187 operation specified in this document. As one example, implementing 188 congestion control (e.g. [18]) is a TCP requirement, but is a complex 189 topic on its own, and not described in detail in this document, as 190 there are many options and possibilities that do not impact basic 191 interoperability. Similarly, most common TCP implementations today 192 include the high-performance extensions in [26], but these are not 193 strictly required or discussed in this document. 195 TEMPORARY EDITOR'S NOTE: This is an early revision in the process of 196 updating RFC 793. Many planned changes are not yet incorporated. 198 ***Please do not use this revision as a basis for any work or 199 reference.*** 201 A list of changes from RFC 793 is contained in Section 4. 203 TEMPORARY EDITOR'S NOTE: the current revision of this document does 204 not yet collect all of the changes that will be in the final version. 205 The set of content changes planned for future revisions is kept in 206 Section 4. 208 3. Functional Specification 210 3.1. Header Format 212 TCP segments are sent as internet datagrams. The Internet Protocol 213 (IP) header carries several information fields, including the source 214 and destination host addresses [1] [5]. A TCP header follows the 215 internet header, supplying information specific to the TCP protocol. 216 This division allows for the existence of host level protocols other 217 than TCP. (Editorial TODO - this last sentence makes sense in 793 218 context, but may be a candidate to remove here? ... additionally, 219 Section 2 of 793 is not includeed here, but some parts may be useful, 220 to quickly define basic concepts of ports, bytestream service, etc. 221 at high-level before delving into protocol details?) 223 TCP Header Format 224 0 1 2 3 225 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 226 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 227 | Source Port | Destination Port | 228 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 229 | Sequence Number | 230 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 231 | Acknowledgment Number | 232 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 233 | Data | |C|E|U|A|P|R|S|F| | 234 | Offset| Rsrvd |W|C|R|C|S|S|Y|I| Window | 235 | | |R|E|G|K|H|T|N|N| | 236 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 237 | Checksum | Urgent Pointer | 238 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 239 | Options | Padding | 240 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 241 | data | 242 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 244 TCP Header Format 246 Note that one tick mark represents one bit position. 248 Figure 1 250 Source Port: 16 bits 252 The source port number. 254 Destination Port: 16 bits 256 The destination port number. 258 Sequence Number: 32 bits 260 The sequence number of the first data octet in this segment (except 261 when SYN is present). If SYN is present the sequence number is the 262 initial sequence number (ISN) and the first data octet is ISN+1. 264 Acknowledgment Number: 32 bits 266 If the ACK control bit is set this field contains the value of the 267 next sequence number the sender of the segment is expecting to 268 receive. Once a connection is established this is always sent. 270 Data Offset: 4 bits 271 The number of 32 bit words in the TCP Header. This indicates where 272 the data begins. The TCP header (even one including options) is an 273 integral number of 32 bits long. 275 Rsrvd - Reserved: 4 bits 277 Reserved for future use. Must be zero in generated segments and 278 must be ignored in received segments. TODO -- no RFC reference for 279 this sentence ... do we want this change or should we keep the 280 prior 793 description which is only "Must be zero." ... need to 281 discuss on TCPM list 283 Control Bits: 8 bits (from left to right): 285 CWR: Congestion Window Reduced (see [9]) 286 ECE: ECN-Echo (see [9]) 287 URG: Urgent Pointer field significant 288 ACK: Acknowledgment field significant 289 PSH: Push Function 290 RST: Reset the connection 291 SYN: Synchronize sequence numbers 292 FIN: No more data from sender 294 Window: 16 bits 296 The number of data octets beginning with the one indicated in the 297 acknowledgment field which the sender of this segment is willing to 298 accept. 300 The window size MUST be treated as an unsigned number, or else 301 large window sizes will appear like negative windows and TCP will 302 now work. It is RECOMMENDED that implementations will reserve 303 32-bit fields for the send and receive window sizes in the 304 connection record and do all window computations with 32 bits. 306 Checksum: 16 bits 308 The checksum field is the 16 bit one's complement of the one's 309 complement sum of all 16 bit words in the header and text. If a 310 segment contains an odd number of header and text octets to be 311 checksummed, the last octet is padded on the right with zeros to 312 form a 16 bit word for checksum purposes. The pad is not 313 transmitted as part of the segment. While computing the checksum, 314 the checksum field itself is replaced with zeros. 316 The checksum also covers a pseudo header conceptually prefixed to 317 the TCP header. The pseudo header is 96 bits for IPv4 and 320 bits 318 for IPv6. For IPv4, this pseudo header contains the Source 319 Address, the Destination Address, the Protocol, and TCP length. 320 This gives the TCP protection against misrouted segments. This 321 information is carried in IPv4 and is transferred across the TCP/ 322 Network interface in the arguments or results of calls by the TCP 323 on the IP. 325 +--------+--------+--------+--------+ 326 | Source Address | 327 +--------+--------+--------+--------+ 328 | Destination Address | 329 +--------+--------+--------+--------+ 330 | zero | PTCL | TCP Length | 331 +--------+--------+--------+--------+ 333 The TCP Length is the TCP header length plus the data length in 334 octets (this is not an explicitly transmitted quantity, but is 335 computed), and it does not count the 12 octets of the pseudo 336 header. 338 For IPv6, the pseudo header is contained in section 8.1 of RFC 2460 339 [5], and contains the IPv6 Source Address and Destination Address, 340 an Upper Layer Packet Length (a 32-bit value otherwise equivalent 341 to TCP Length in the IPv4 pseudo header), three bytes of zero- 342 padding, and a Next Header value (differing from the IPv6 header 343 value in the case of extension headers present in between IPv6 and 344 TCP). 346 The TCP checksum is never optional. The sender MUST generate it 347 and the receiver MUST check it. 349 Urgent Pointer: 16 bits 351 This field communicates the current value of the urgent pointer as 352 a positive offset from the sequence number in this segment. The 353 urgent pointer points to the sequence number of the octet following 354 the urgent data. This field is only be interpreted in segments 355 with the URG control bit set. 357 Options: variable 359 Options may occupy space at the end of the TCP header and are a 360 multiple of 8 bits in length. All options are included in the 361 checksum. An option may begin on any octet boundary. There are 362 two cases for the format of an option: 364 Case 1: A single octet of option-kind. 366 Case 2: An octet of option-kind, an octet of option-length, and 367 the actual option-data octets. 369 The option-length counts the two octets of option-kind and option- 370 length as well as the option-data octets. 372 Note that the list of options may be shorter than the data offset 373 field might imply. The content of the header beyond the End-of- 374 Option option must be header padding (i.e., zero). 376 The list of all currently defined options is managed by IANA [29], 377 and each option is defined in other RFCs, as indicated there. That 378 set includes experimental options that can be extended to support 379 multiple concurrent uses [25]. 381 A given TCP implementation can support any currently defined 382 options, but the following options MUST be supported (kind 383 indicated in octal): 385 Kind Length Meaning 386 ---- ------ ------- 387 0 - End of option list. 388 1 - No-Operation. 389 2 4 Maximum Segment Size. 391 A TCP MUST be able to receive a TCP option in any segment. 392 A TCP MUST ignore without error any TCP option it does not 393 implement, assuming that the option has a length field (all TCP 394 options except End of option list and No-Operation have length 395 fields). TCP MUST be prepared to handle an illegal option length 396 (e.g., zero) without crashing; a suggested procedure is to reset 397 the connection and log the reason. 399 Specific Option Definitions 401 End of Option List 403 +--------+ 404 |00000000| 405 +--------+ 406 Kind=0 408 This option code indicates the end of the option list. This 409 might not coincide with the end of the TCP header according to 410 the Data Offset field. This is used at the end of all options, 411 not the end of each option, and need only be used if the end of 412 the options would not otherwise coincide with the end of the TCP 413 header. 415 No-Operation 417 +--------+ 418 |00000001| 419 +--------+ 420 Kind=1 422 This option code may be used between options, for example, to 423 align the beginning of a subsequent option on a word boundary. 424 There is no guarantee that senders will use this option, so 425 receivers must be prepared to process options even if they do 426 not begin on a word boundary. 428 Maximum Segment Size (MSS) 430 +--------+--------+---------+--------+ 431 |00000010|00000100| max seg size | 432 +--------+--------+---------+--------+ 433 Kind=2 Length=4 435 Maximum Segment Size Option Data: 16 bits 437 If this option is present, then it communicates the maximum 438 receive segment size at the TCP which sends this segment. This 439 value is limited by the IP reassembly limit. This field may be 440 sent in the initial connection request (i.e., in segments with 441 the SYN control bit set) and must not be sent in other segments. 442 If this option is not used, any segment size is allowed. A more 443 complete description of this option is in Section 3.7.1. 445 Padding: variable 447 The TCP header padding is used to ensure that the TCP header ends 448 and data begins on a 32 bit boundary. The padding is composed of 449 zeros. 451 3.2. Terminology 453 Before we can discuss very much about the operation of the TCP we 454 need to introduce some detailed terminology. The maintenance of a 455 TCP connection requires the remembering of several variables. We 456 conceive of these variables being stored in a connection record 457 called a Transmission Control Block or TCB. Among the variables 458 stored in the TCB are the local and remote socket numbers, the 459 security and precedence of the connection, pointers to the user's 460 send and receive buffers, pointers to the retransmit queue and to the 461 current segment. In addition several variables relating to the send 462 and receive sequence numbers are stored in the TCB. 464 Send Sequence Variables 466 SND.UNA - send unacknowledged 467 SND.NXT - send next 468 SND.WND - send window 469 SND.UP - send urgent pointer 470 SND.WL1 - segment sequence number used for last window update 471 SND.WL2 - segment acknowledgment number used for last window 472 update 473 ISS - initial send sequence number 475 Receive Sequence Variables 477 RCV.NXT - receive next 478 RCV.WND - receive window 479 RCV.UP - receive urgent pointer 480 IRS - initial receive sequence number 482 The following diagrams may help to relate some of these variables to 483 the sequence space. 485 Send Sequence Space 487 1 2 3 4 488 ----------|----------|----------|---------- 489 SND.UNA SND.NXT SND.UNA 490 +SND.WND 492 1 - old sequence numbers which have been acknowledged 493 2 - sequence numbers of unacknowledged data 494 3 - sequence numbers allowed for new data transmission 495 4 - future sequence numbers which are not yet allowed 497 Send Sequence Space 499 Figure 2 501 The send window is the portion of the sequence space labeled 3 in 502 Figure 2. 504 Receive Sequence Space 506 1 2 3 507 ----------|----------|---------- 508 RCV.NXT RCV.NXT 509 +RCV.WND 511 1 - old sequence numbers which have been acknowledged 512 2 - sequence numbers allowed for new reception 513 3 - future sequence numbers which are not yet allowed 515 Receive Sequence Space 517 Figure 3 519 The receive window is the portion of the sequence space labeled 2 in 520 Figure 3. 522 There are also some variables used frequently in the discussion that 523 take their values from the fields of the current segment. 525 Current Segment Variables 527 SEG.SEQ - segment sequence number 528 SEG.ACK - segment acknowledgment number 529 SEG.LEN - segment length 530 SEG.WND - segment window 531 SEG.UP - segment urgent pointer 532 SEG.PRC - segment precedence value 534 A connection progresses through a series of states during its 535 lifetime. The states are: LISTEN, SYN-SENT, SYN-RECEIVED, 536 ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, 537 TIME-WAIT, and the fictional state CLOSED. CLOSED is fictional 538 because it represents the state when there is no TCB, and therefore, 539 no connection. Briefly the meanings of the states are: 541 LISTEN - represents waiting for a connection request from any 542 remote TCP and port. 544 SYN-SENT - represents waiting for a matching connection request 545 after having sent a connection request. 547 SYN-RECEIVED - represents waiting for a confirming connection 548 request acknowledgment after having both received and sent a 549 connection request. 551 ESTABLISHED - represents an open connection, data received can be 552 delivered to the user. The normal state for the data transfer 553 phase of the connection. 555 FIN-WAIT-1 - represents waiting for a connection termination 556 request from the remote TCP, or an acknowledgment of the 557 connection termination request previously sent. 559 FIN-WAIT-2 - represents waiting for a connection termination 560 request from the remote TCP. 562 CLOSE-WAIT - represents waiting for a connection termination 563 request from the local user. 565 CLOSING - represents waiting for a connection termination request 566 acknowledgment from the remote TCP. 568 LAST-ACK - represents waiting for an acknowledgment of the 569 connection termination request previously sent to the remote TCP 570 (this termination request sent to the remote TCP already included 571 an acknowledgment of the termination request sent from the remote 572 TCP). 574 TIME-WAIT - represents waiting for enough time to pass to be sure 575 the remote TCP received the acknowledgment of its connection 576 termination request. 578 CLOSED - represents no connection state at all. 580 A TCP connection progresses from one state to another in response to 581 events. The events are the user calls, OPEN, SEND, RECEIVE, CLOSE, 582 ABORT, and STATUS; the incoming segments, particularly those 583 containing the SYN, ACK, RST and FIN flags; and timeouts. 585 The state diagram in Figure 4 illustrates only state changes, 586 together with the causing events and resulting actions, but addresses 587 neither error conditions nor actions which are not connected with 588 state changes. In a later section, more detail is offered with 589 respect to the reaction of the TCP to events. Some state names are 590 abbreviated or hyphenated differently in the diagram from how they 591 appear elsewhere in the document. 593 NOTA BENE: This diagram is only a summary and must not be taken as 594 the total specification. Many details are not included. 596 +---------+ ---------\ active OPEN 597 | CLOSED | \ ----------- 598 +---------+<---------\ \ create TCB 599 | ^ \ \ snd SYN 600 passive OPEN | | CLOSE \ \ 601 ------------ | | ---------- \ \ 602 create TCB | | delete TCB \ \ 603 V | \ \ 604 rcv RST (note 1) +---------+ CLOSE | \ 605 -------------------->| LISTEN | ---------- | | 606 / +---------+ delete TCB | | 607 / rcv SYN | | SEND | | 608 / ----------- | | ------- | V 609 +--------+ snd SYN,ACK / \ snd SYN +--------+ 610 | |<----------------- ------------------>| | 611 | SYN | rcv SYN | SYN | 612 | RCVD |<-----------------------------------------------| SENT | 613 | | snd SYN,ACK | | 614 | |------------------ -------------------| | 615 +--------+ rcv ACK of SYN \ / rcv SYN,ACK +--------+ 616 | -------------- | | ----------- 617 | x | | snd ACK 618 | V V 619 | CLOSE +---------+ 620 | ------- | ESTAB | 621 | snd FIN +---------+ 622 | CLOSE | | rcv FIN 623 V ------- | | ------- 624 +---------+ snd FIN / \ snd ACK +---------+ 625 | FIN |<----------------- ------------------>| CLOSE | 626 | WAIT-1 |------------------ | WAIT | 627 +---------+ rcv FIN \ +---------+ 628 | rcv ACK of FIN ------- | CLOSE | 629 | -------------- snd ACK | ------- | 630 V x V snd FIN V 631 +---------+ +---------+ +---------+ 632 |FINWAIT-2| | CLOSING | | LAST-ACK| 633 +---------+ +---------+ +---------+ 634 | rcv ACK of FIN | rcv ACK of FIN | 635 | rcv FIN -------------- | Timeout=2MSL -------------- | 636 | ------- x V ------------ x V 637 \ snd ACK +---------+delete TCB +---------+ 638 ------------------------>|TIME WAIT|------------------>| CLOSED | 639 +---------+ +---------+ 641 note 1: The transition from SYN-RECEIVED to LISTEN on receiving a RST is 642 conditional on having reached SYN-RECEIVED after a passive open. 644 note 2: An unshown transition exists from FIN-WAIT-1 to TIME-WAIT if 645 a FIN is received and the local FIN is also acknowledged. 647 TCP Connection State Diagram 649 Figure 4 651 3.3. Sequence Numbers 653 A fundamental notion in the design is that every octet of data sent 654 over a TCP connection has a sequence number. Since every octet is 655 sequenced, each of them can be acknowledged. The acknowledgment 656 mechanism employed is cumulative so that an acknowledgment of 657 sequence number X indicates that all octets up to but not including X 658 have been received. This mechanism allows for straight-forward 659 duplicate detection in the presence of retransmission. Numbering of 660 octets within a segment is that the first data octet immediately 661 following the header is the lowest numbered, and the following octets 662 are numbered consecutively. 664 It is essential to remember that the actual sequence number space is 665 finite, though very large. This space ranges from 0 to 2**32 - 1. 666 Since the space is finite, all arithmetic dealing with sequence 667 numbers must be performed modulo 2**32. This unsigned arithmetic 668 preserves the relationship of sequence numbers as they cycle from 669 2**32 - 1 to 0 again. There are some subtleties to computer modulo 670 arithmetic, so great care should be taken in programming the 671 comparison of such values. The symbol "=<" means "less than or 672 equal" (modulo 2**32). 674 The typical kinds of sequence number comparisons which the TCP must 675 perform include: 677 (a) Determining that an acknowledgment refers to some sequence 678 number sent but not yet acknowledged. 680 (b) Determining that all sequence numbers occupied by a segment 681 have been acknowledged (e.g., to remove the segment from a 682 retransmission queue). 684 (c) Determining that an incoming segment contains sequence numbers 685 which are expected (i.e., that the segment "overlaps" the receive 686 window). 688 In response to sending data the TCP will receive acknowledgments. 689 The following comparisons are needed to process the acknowledgments. 691 SND.UNA = oldest unacknowledged sequence number 693 SND.NXT = next sequence number to be sent 694 SEG.ACK = acknowledgment from the receiving TCP (next sequence 695 number expected by the receiving TCP) 697 SEG.SEQ = first sequence number of a segment 699 SEG.LEN = the number of octets occupied by the data in the segment 700 (counting SYN and FIN) 702 SEG.SEQ+SEG.LEN-1 = last sequence number of a segment 704 A new acknowledgment (called an "acceptable ack"), is one for which 705 the inequality below holds: 707 SND.UNA < SEG.ACK =< SND.NXT 709 A segment on the retransmission queue is fully acknowledged if the 710 sum of its sequence number and length is less or equal than the 711 acknowledgment value in the incoming segment. 713 When data is received the following comparisons are needed: 715 RCV.NXT = next sequence number expected on an incoming segments, 716 and is the left or lower edge of the receive window 718 RCV.NXT+RCV.WND-1 = last sequence number expected on an incoming 719 segment, and is the right or upper edge of the receive window 721 SEG.SEQ = first sequence number occupied by the incoming segment 723 SEG.SEQ+SEG.LEN-1 = last sequence number occupied by the incoming 724 segment 726 A segment is judged to occupy a portion of valid receive sequence 727 space if 729 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 731 or 733 RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND 735 The first part of this test checks to see if the beginning of the 736 segment falls in the window, the second part of the test checks to 737 see if the end of the segment falls in the window; if the segment 738 passes either part of the test it contains data in the window. 740 Actually, it is a little more complicated than this. Due to zero 741 windows and zero length segments, we have four cases for the 742 acceptability of an incoming segment: 744 Segment Receive Test 745 Length Window 746 ------- ------- ------------------------------------------- 748 0 0 SEG.SEQ = RCV.NXT 750 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 752 >0 0 not acceptable 754 >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 755 or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND 757 Note that when the receive window is zero no segments should be 758 acceptable except ACK segments. Thus, it is be possible for a TCP to 759 maintain a zero receive window while transmitting data and receiving 760 ACKs. However, even when the receive window is zero, a TCP must 761 process the RST and URG fields of all incoming segments. 763 We have taken advantage of the numbering scheme to protect certain 764 control information as well. This is achieved by implicitly 765 including some control flags in the sequence space so they can be 766 retransmitted and acknowledged without confusion (i.e., one and only 767 one copy of the control will be acted upon). Control information is 768 not physically carried in the segment data space. Consequently, we 769 must adopt rules for implicitly assigning sequence numbers to 770 control. The SYN and FIN are the only controls requiring this 771 protection, and these controls are used only at connection opening 772 and closing. For sequence number purposes, the SYN is considered to 773 occur before the first actual data octet of the segment in which it 774 occurs, while the FIN is considered to occur after the last actual 775 data octet in a segment in which it occurs. The segment length 776 (SEG.LEN) includes both data and sequence space occupying controls. 777 When a SYN is present then SEG.SEQ is the sequence number of the SYN. 779 Initial Sequence Number Selection 781 The protocol places no restriction on a particular connection being 782 used over and over again. A connection is defined by a pair of 783 sockets. New instances of a connection will be referred to as 784 incarnations of the connection. The problem that arises from this is 785 -- "how does the TCP identify duplicate segments from previous 786 incarnations of the connection?" This problem becomes apparent if 787 the connection is being opened and closed in quick succession, or if 788 the connection breaks with loss of memory and is then reestablished. 790 To avoid confusion we must prevent segments from one incarnation of a 791 connection from being used while the same sequence numbers may still 792 be present in the network from an earlier incarnation. We want to 793 assure this, even if a TCP crashes and loses all knowledge of the 794 sequence numbers it has been using. When new connections are 795 created, an initial sequence number (ISN) generator is employed which 796 selects a new 32 bit ISN. There are security issues that result if 797 an off-path attacker is able to predict or guess ISN values. 799 The recommended ISN generator is based on the combination of a 800 (possibly fictitious) 32 bit clock whose low order bit is incremented 801 roughly every 4 microseconds, and a pseudorandom hash function (PRF). 802 The clock component is intended to insure that with a Maximum Segment 803 Lifetime (MSL), generated ISNs will be unique, since it cycles 804 approximately every 4.55 hours, which is much longer than the MSL. 805 This recommended algorithm is further described in RFC 1948 and 806 builds on the basic clock-driven algorithm from RFC 793. 808 A TCP MUST use a clock-driven selection of initial sequence numbers, 809 and SHOULD generate its Initial Sequence Numbers with the expression: 811 ISN = M + F(localip, localport, remoteip, remoteport, secretkey) 813 where M is the 4 microsecond timer, and F() is a pseudorandom 814 function (PRF) of the connection's identifying parameters ("localip, 815 localport, remoteip, remoteport") and a secret key ("secretkey"). 816 F() MUST NOT be computable from the outside, or an attacker could 817 still guess at sequence numbers from the ISN used for some other 818 connection. The PRF could be implemented as a cryptographic has of 819 the concatenation of the TCP connection parameters and some secret 820 data. For discussion of the selection of a specific hash algorithm 821 and management of the secret key data, please see Section 3 of [23]. 823 For each connection there is a send sequence number and a receive 824 sequence number. The initial send sequence number (ISS) is chosen by 825 the data sending TCP, and the initial receive sequence number (IRS) 826 is learned during the connection establishing procedure. 828 For a connection to be established or initialized, the two TCPs must 829 synchronize on each other's initial sequence numbers. This is done 830 in an exchange of connection establishing segments carrying a control 831 bit called "SYN" (for synchronize) and the initial sequence numbers. 832 As a shorthand, segments carrying the SYN bit are also called "SYNs". 833 Hence, the solution requires a suitable mechanism for picking an 834 initial sequence number and a slightly involved handshake to exchange 835 the ISN's. 837 The synchronization requires each side to send it's own initial 838 sequence number and to receive a confirmation of it in acknowledgment 839 from the other side. Each side must also receive the other side's 840 initial sequence number and send a confirming acknowledgment. 842 1) A --> B SYN my sequence number is X 843 2) A <-- B ACK your sequence number is X 844 3) A <-- B SYN my sequence number is Y 845 4) A --> B ACK your sequence number is Y 847 Because steps 2 and 3 can be combined in a single message this is 848 called the three way (or three message) handshake. 850 A three way handshake is necessary because sequence numbers are not 851 tied to a global clock in the network, and TCPs may have different 852 mechanisms for picking the ISN's. The receiver of the first SYN has 853 no way of knowing whether the segment was an old delayed one or not, 854 unless it remembers the last sequence number used on the connection 855 (which is not always possible), and so it must ask the sender to 856 verify this SYN. The three way handshake and the advantages of a 857 clock-driven scheme are discussed in [3]. 859 Knowing When to Keep Quiet 861 To be sure that a TCP does not create a segment that carries a 862 sequence number which may be duplicated by an old segment remaining 863 in the network, the TCP must keep quiet for an MSL before assigning 864 any sequence numbers upon starting up or recovering from a crash in 865 which memory of sequence numbers in use was lost. For this 866 specification the MSL is taken to be 2 minutes. This is an 867 engineering choice, and may be changed if experience indicates it is 868 desirable to do so. Note that if a TCP is reinitialized in some 869 sense, yet retains its memory of sequence numbers in use, then it 870 need not wait at all; it must only be sure to use sequence numbers 871 larger than those recently used. 873 The TCP Quiet Time Concept 875 This specification provides that hosts which "crash" without 876 retaining any knowledge of the last sequence numbers transmitted on 877 each active (i.e., not closed) connection shall delay emitting any 878 TCP segments for at least the agreed MSL in the internet system of 879 which the host is a part. In the paragraphs below, an explanation 880 for this specification is given. TCP implementors may violate the 881 "quiet time" restriction, but only at the risk of causing some old 882 data to be accepted as new or new data rejected as old duplicated by 883 some receivers in the internet system. 885 TCPs consume sequence number space each time a segment is formed and 886 entered into the network output queue at a source host. The 887 duplicate detection and sequencing algorithm in the TCP protocol 888 relies on the unique binding of segment data to sequence space to the 889 extent that sequence numbers will not cycle through all 2**32 values 890 before the segment data bound to those sequence numbers has been 891 delivered and acknowledged by the receiver and all duplicate copies 892 of the segments have "drained" from the internet. Without such an 893 assumption, two distinct TCP segments could conceivably be assigned 894 the same or overlapping sequence numbers, causing confusion at the 895 receiver as to which data is new and which is old. Remember that 896 each segment is bound to as many consecutive sequence numbers as 897 there are octets of data and SYN or FIN flags in the segment. 899 Under normal conditions, TCPs keep track of the next sequence number 900 to emit and the oldest awaiting acknowledgment so as to avoid 901 mistakenly using a sequence number over before its first use has been 902 acknowledged. This alone does not guarantee that old duplicate data 903 is drained from the net, so the sequence space has been made very 904 large to reduce the probability that a wandering duplicate will cause 905 trouble upon arrival. At 2 megabits/sec. it takes 4.5 hours to use 906 up 2**32 octets of sequence space. Since the maximum segment 907 lifetime in the net is not likely to exceed a few tens of seconds, 908 this is deemed ample protection for foreseeable nets, even if data 909 rates escalate to l0's of megabits/sec. At 100 megabits/sec, the 910 cycle time is 5.4 minutes which may be a little short, but still 911 within reason. 913 The basic duplicate detection and sequencing algorithm in TCP can be 914 defeated, however, if a source TCP does not have any memory of the 915 sequence numbers it last used on a given connection. For example, if 916 the TCP were to start all connections with sequence number 0, then 917 upon crashing and restarting, a TCP might re-form an earlier 918 connection (possibly after half-open connection resolution) and emit 919 packets with sequence numbers identical to or overlapping with 920 packets still in the network which were emitted on an earlier 921 incarnation of the same connection. In the absence of knowledge 922 about the sequence numbers used on a particular connection, the TCP 923 specification recommends that the source delay for MSL seconds before 924 emitting segments on the connection, to allow time for segments from 925 the earlier connection incarnation to drain from the system. 927 Even hosts which can remember the time of day and used it to select 928 initial sequence number values are not immune from this problem 929 (i.e., even if time of day is used to select an initial sequence 930 number for each new connection incarnation). 932 Suppose, for example, that a connection is opened starting with 933 sequence number S. Suppose that this connection is not used much and 934 that eventually the initial sequence number function (ISN(t)) takes 935 on a value equal to the sequence number, say S1, of the last segment 936 sent by this TCP on a particular connection. Now suppose, at this 937 instant, the host crashes, recovers, and establishes a new 938 incarnation of the connection. The initial sequence number chosen is 939 S1 = ISN(t) -- last used sequence number on old incarnation of 940 connection! If the recovery occurs quickly enough, any old 941 duplicates in the net bearing sequence numbers in the neighborhood of 942 S1 may arrive and be treated as new packets by the receiver of the 943 new incarnation of the connection. 945 The problem is that the recovering host may not know for how long it 946 crashed nor does it know whether there are still old duplicates in 947 the system from earlier connection incarnations. 949 One way to deal with this problem is to deliberately delay emitting 950 segments for one MSL after recovery from a crash- this is the "quiet 951 time" specification. Hosts which prefer to avoid waiting are willing 952 to risk possible confusion of old and new packets at a given 953 destination may choose not to wait for the "quite time". 954 Implementors may provide TCP users with the ability to select on a 955 connection by connection basis whether to wait after a crash, or may 956 informally implement the "quite time" for all connections. 957 Obviously, even where a user selects to "wait," this is not necessary 958 after the host has been "up" for at least MSL seconds. 960 To summarize: every segment emitted occupies one or more sequence 961 numbers in the sequence space, the numbers occupied by a segment are 962 "busy" or "in use" until MSL seconds have passed, upon crashing a 963 block of space-time is occupied by the octets and SYN or FIN flags of 964 the last emitted segment, if a new connection is started too soon and 965 uses any of the sequence numbers in the space-time footprint of the 966 last segment of the previous connection incarnation, there is a 967 potential sequence number overlap area which could cause confusion at 968 the receiver. 970 3.4. Establishing a connection 972 The "three-way handshake" is the procedure used to establish a 973 connection. This procedure normally is initiated by one TCP and 974 responded to by another TCP. The procedure also works if two TCP 975 simultaneously initiate the procedure. When simultaneous attempt 976 occurs, each TCP receives a "SYN" segment which carries no 977 acknowledgment after it has sent a "SYN". Of course, the arrival of 978 an old duplicate "SYN" segment can potentially make it appear, to the 979 recipient, that a simultaneous connection initiation is in progress. 980 Proper use of "reset" segments can disambiguate these cases. 982 Several examples of connection initiation follow. Although these 983 examples do not show connection synchronization using data-carrying 984 segments, this is perfectly legitimate, so long as the receiving TCP 985 doesn't deliver the data to the user until it is clear the data is 986 valid (i.e., the data must be buffered at the receiver until the 987 connection reaches the ESTABLISHED state). The three-way handshake 988 reduces the possibility of false connections. It is the 989 implementation of a trade-off between memory and messages to provide 990 information for this checking. 992 The simplest three-way handshake is shown in Figure 5 below. The 993 figures should be interpreted in the following way. Each line is 994 numbered for reference purposes. Right arrows (-->) indicate 995 departure of a TCP segment from TCP A to TCP B, or arrival of a 996 segment at B from A. Left arrows (<--), indicate the reverse. 997 Ellipsis (...) indicates a segment which is still in the network 998 (delayed). An "XXX" indicates a segment which is lost or rejected. 999 Comments appear in parentheses. TCP states represent the state AFTER 1000 the departure or arrival of the segment (whose contents are shown in 1001 the center of each line). Segment contents are shown in abbreviated 1002 form, with sequence number, control flags, and ACK field. Other 1003 fields such as window, addresses, lengths, and text have been left 1004 out in the interest of clarity. 1006 TCP A TCP B 1008 1. CLOSED LISTEN 1010 2. SYN-SENT --> --> SYN-RECEIVED 1012 3. ESTABLISHED <-- <-- SYN-RECEIVED 1014 4. ESTABLISHED --> --> ESTABLISHED 1016 5. ESTABLISHED --> --> ESTABLISHED 1018 Basic 3-Way Handshake for Connection Synchronization 1020 Figure 5 1022 In line 2 of Figure 5, TCP A begins by sending a SYN segment 1023 indicating that it will use sequence numbers starting with sequence 1024 number 100. In line 3, TCP B sends a SYN and acknowledges the SYN it 1025 received from TCP A. Note that the acknowledgment field indicates 1026 TCP B is now expecting to hear sequence 101, acknowledging the SYN 1027 which occupied sequence 100. 1029 At line 4, TCP A responds with an empty segment containing an ACK for 1030 TCP B's SYN; and in line 5, TCP A sends some data. Note that the 1031 sequence number of the segment in line 5 is the same as in line 4 1032 because the ACK does not occupy sequence number space (if it did, we 1033 would wind up ACKing ACK's!). 1035 Simultaneous initiation is only slightly more complex, as is shown in 1036 Figure 6. Each TCP cycles from CLOSED to SYN-SENT to SYN-RECEIVED to 1037 ESTABLISHED. 1039 TCP A TCP B 1041 1. CLOSED CLOSED 1043 2. SYN-SENT --> ... 1045 3. SYN-RECEIVED <-- <-- SYN-SENT 1047 4. ... --> SYN-RECEIVED 1049 5. SYN-RECEIVED --> ... 1051 6. ESTABLISHED <-- <-- SYN-RECEIVED 1053 7. ... --> ESTABLISHED 1055 Simultaneous Connection Synchronization 1057 Figure 6 1059 A TCP MUST support simultaneous open attempts. 1061 Note that a TCP implementation MUST keep track of whether a 1062 connection has reached SYN-RECEIVED state as the result of a passive 1063 OPEN or an active OPEN. 1065 The principle reason for the three-way handshake is to prevent old 1066 duplicate connection initiations from causing confusion. To deal 1067 with this, a special control message, reset, has been devised. If 1068 the receiving TCP is in a non-synchronized state (i.e., SYN-SENT, 1069 SYN-RECEIVED), it returns to LISTEN on receiving an acceptable reset. 1070 If the TCP is in one of the synchronized states (ESTABLISHED, FIN- 1071 WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT), it 1072 aborts the connection and informs its user. We discuss this latter 1073 case under "half-open" connections below. 1075 TCP A TCP B 1077 1. CLOSED LISTEN 1079 2. SYN-SENT --> ... 1081 3. (duplicate) ... --> SYN-RECEIVED 1083 4. SYN-SENT <-- <-- SYN-RECEIVED 1085 5. SYN-SENT --> --> LISTEN 1087 6. ... --> SYN-RECEIVED 1089 7. SYN-SENT <-- <-- SYN-RECEIVED 1091 8. ESTABLISHED --> --> ESTABLISHED 1093 Recovery from Old Duplicate SYN 1095 Figure 7 1097 As a simple example of recovery from old duplicates, consider 1098 Figure 7. At line 3, an old duplicate SYN arrives at TCP B. TCP B 1099 cannot tell that this is an old duplicate, so it responds normally 1100 (line 4). TCP A detects that the ACK field is incorrect and returns 1101 a RST (reset) with its SEQ field selected to make the segment 1102 believable. TCP B, on receiving the RST, returns to the LISTEN 1103 state. When the original SYN (pun intended) finally arrives at line 1104 6, the synchronization proceeds normally. If the SYN at line 6 had 1105 arrived before the RST, a more complex exchange might have occurred 1106 with RST's sent in both directions. 1108 Half-Open Connections and Other Anomalies 1110 An established connection is said to be "half-open" if one of the 1111 TCPs has closed or aborted the connection at its end without the 1112 knowledge of the other, or if the two ends of the connection have 1113 become desynchronized owing to a crash that resulted in loss of 1114 memory. Such connections will automatically become reset if an 1115 attempt is made to send data in either direction. However, half-open 1116 connections are expected to be unusual, and the recovery procedure is 1117 mildly involved. 1119 If at site A the connection no longer exists, then an attempt by the 1120 user at site B to send any data on it will result in the site B TCP 1121 receiving a reset control message. Such a message indicates to the 1122 site B TCP that something is wrong, and it is expected to abort the 1123 connection. 1125 Assume that two user processes A and B are communicating with one 1126 another when a crash occurs causing loss of memory to A's TCP. 1127 Depending on the operating system supporting A's TCP, it is likely 1128 that some error recovery mechanism exists. When the TCP is up again, 1129 A is likely to start again from the beginning or from a recovery 1130 point. As a result, A will probably try to OPEN the connection again 1131 or try to SEND on the connection it believes open. In the latter 1132 case, it receives the error message "connection not open" from the 1133 local (A's) TCP. In an attempt to establish the connection, A's TCP 1134 will send a segment containing SYN. This scenario leads to the 1135 example shown in Figure 8. After TCP A crashes, the user attempts to 1136 re-open the connection. TCP B, in the meantime, thinks the 1137 connection is open. 1139 TCP A TCP B 1141 1. (CRASH) (send 300,receive 100) 1143 2. CLOSED ESTABLISHED 1145 3. SYN-SENT --> --> (??) 1147 4. (!!) <-- <-- ESTABLISHED 1149 5. SYN-SENT --> --> (Abort!!) 1151 6. SYN-SENT CLOSED 1153 7. SYN-SENT --> --> 1155 Half-Open Connection Discovery 1157 Figure 8 1159 When the SYN arrives at line 3, TCP B, being in a synchronized state, 1160 and the incoming segment outside the window, responds with an 1161 acknowledgment indicating what sequence it next expects to hear (ACK 1162 100). TCP A sees that this segment does not acknowledge anything it 1163 sent and, being unsynchronized, sends a reset (RST) because it has 1164 detected a half-open connection. TCP B aborts at line 5. TCP A will 1165 continue to try to establish the connection; the problem is now 1166 reduced to the basic 3-way handshake of Figure 5. 1168 An interesting alternative case occurs when TCP A crashes and TCP B 1169 tries to send data on what it thinks is a synchronized connection. 1170 This is illustrated in Figure 9. In this case, the data arriving at 1171 TCP A from TCP B (line 2) is unacceptable because no such connection 1172 exists, so TCP A sends a RST. The RST is acceptable so TCP B 1173 processes it and aborts the connection. 1175 TCP A TCP B 1177 1. (CRASH) (send 300,receive 100) 1179 2. (??) <-- <-- ESTABLISHED 1181 3. --> --> (ABORT!!) 1183 Active Side Causes Half-Open Connection Discovery 1185 Figure 9 1187 In Figure 10, we find the two TCPs A and B with passive connections 1188 waiting for SYN. An old duplicate arriving at TCP B (line 2) stirs B 1189 into action. A SYN-ACK is returned (line 3) and causes TCP A to 1190 generate a RST (the ACK in line 3 is not acceptable). TCP B accepts 1191 the reset and returns to its passive LISTEN state. 1193 TCP A TCP B 1195 1. LISTEN LISTEN 1197 2. ... --> SYN-RECEIVED 1199 3. (??) <-- <-- SYN-RECEIVED 1201 4. --> --> (return to LISTEN!) 1203 5. LISTEN LISTEN 1205 Old Duplicate SYN Initiates a Reset on two Passive Sockets 1207 Figure 10 1209 A variety of other cases are possible, all of which are accounted for 1210 by the following rules for RST generation and processing. 1212 Reset Generation 1213 As a general rule, reset (RST) must be sent whenever a segment 1214 arrives which apparently is not intended for the current connection. 1215 A reset must not be sent if it is not clear that this is the case. 1217 There are three groups of states: 1219 1. If the connection does not exist (CLOSED) then a reset is sent 1220 in response to any incoming segment except another reset. In 1221 particular, SYNs addressed to a non-existent connection are 1222 rejected by this means. 1224 If the incoming segment has the ACK bit set, the reset takes its 1225 sequence number from the ACK field of the segment, otherwise the 1226 reset has sequence number zero and the ACK field is set to the sum 1227 of the sequence number and segment length of the incoming segment. 1228 The connection remains in the CLOSED state. 1230 2. If the connection is in any non-synchronized state (LISTEN, 1231 SYN-SENT, SYN-RECEIVED), and the incoming segment acknowledges 1232 something not yet sent (the segment carries an unacceptable ACK), 1233 or if an incoming segment has a security level or compartment 1234 which does not exactly match the level and compartment requested 1235 for the connection, a reset is sent. 1237 If our SYN has not been acknowledged and the precedence level of 1238 the incoming segment is higher than the precedence level requested 1239 then either raise the local precedence level (if allowed by the 1240 user and the system) or send a reset; or if the precedence level 1241 of the incoming segment is lower than the precedence level 1242 requested then continue as if the precedence matched exactly (if 1243 the remote TCP cannot raise the precedence level to match ours 1244 this will be detected in the next segment it sends, and the 1245 connection will be terminated then). If our SYN has been 1246 acknowledged (perhaps in this incoming segment) the precedence 1247 level of the incoming segment must match the local precedence 1248 level exactly, if it does not a reset must be sent. 1250 If the incoming segment has an ACK field, the reset takes its 1251 sequence number from the ACK field of the segment, otherwise the 1252 reset has sequence number zero and the ACK field is set to the sum 1253 of the sequence number and segment length of the incoming segment. 1254 The connection remains in the same state. 1256 3. If the connection is in a synchronized state (ESTABLISHED, 1257 FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT), 1258 any unacceptable segment (out of window sequence number or 1259 unacceptable acknowledgment number) must elicit only an empty 1260 acknowledgment segment containing the current send-sequence number 1261 and an acknowledgment indicating the next sequence number expected 1262 to be received, and the connection remains in the same state. 1264 If an incoming segment has a security level, or compartment, or 1265 precedence which does not exactly match the level, and 1266 compartment, and precedence requested for the connection,a reset 1267 is sent and the connection goes to the CLOSED state. The reset 1268 takes its sequence number from the ACK field of the incoming 1269 segment. 1271 Reset Processing 1273 In all states except SYN-SENT, all reset (RST) segments are validated 1274 by checking their SEQ-fields. A reset is valid if its sequence 1275 number is in the window. In the SYN-SENT state (a RST received in 1276 response to an initial SYN), the RST is acceptable if the ACK field 1277 acknowledges the SYN. 1279 The receiver of a RST first validates it, then changes state. If the 1280 receiver was in the LISTEN state, it ignores it. If the receiver was 1281 in SYN-RECEIVED state and had previously been in the LISTEN state, 1282 then the receiver returns to the LISTEN state, otherwise the receiver 1283 aborts the connection and goes to the CLOSED state. If the receiver 1284 was in any other state, it aborts the connection and advises the user 1285 and goes to the CLOSED state. 1287 TCP SHOULD allow a received RST segment to include data. 1289 3.4.1. Remote Address Validation 1291 TODO - figure out if this section would fit better elsewhere, for 1292 instance in the more detailed description of the OPEN call later on 1294 A TCP implementation MUST reject as an error a local OPEN call for an 1295 invalid remote IP address (e.g., a broadcast or multicast address). 1297 An incoming SYN with an invalid source address must be ignored either 1298 by TCP or by the IP layer (see Section 3.2.1.3 of [14]). 1300 A TCP implementation MUST silently discard an incoming SYN segment 1301 that is addressed to a broadcast or multicast address. 1303 3.5. Closing a Connection 1305 CLOSE is an operation meaning "I have no more data to send." The 1306 notion of closing a full-duplex connection is subject to ambiguous 1307 interpretation, of course, since it may not be obvious how to treat 1308 the receiving side of the connection. We have chosen to treat CLOSE 1309 in a simplex fashion. The user who CLOSEs may continue to RECEIVE 1310 until he is told that the other side has CLOSED also. Thus, a 1311 program could initiate several SENDs followed by a CLOSE, and then 1312 continue to RECEIVE until signaled that a RECEIVE failed because the 1313 other side has CLOSED. We assume that the TCP will signal a user, 1314 even if no RECEIVEs are outstanding, that the other side has closed, 1315 so the user can terminate his side gracefully. A TCP will reliably 1316 deliver all buffers SENT before the connection was CLOSED so a user 1317 who expects no data in return need only wait to hear the connection 1318 was CLOSED successfully to know that all his data was received at the 1319 destination TCP. Users must keep reading connections they close for 1320 sending until the TCP says no more data. 1322 There are essentially three cases: 1324 1) The user initiates by telling the TCP to CLOSE the connection 1326 2) The remote TCP initiates by sending a FIN control signal 1328 3) Both users CLOSE simultaneously 1330 Case 1: Local user initiates the close 1332 In this case, a FIN segment can be constructed and placed on the 1333 outgoing segment queue. No further SENDs from the user will be 1334 accepted by the TCP, and it enters the FIN-WAIT-1 state. RECEIVEs 1335 are allowed in this state. All segments preceding and including 1336 FIN will be retransmitted until acknowledged. When the other TCP 1337 has both acknowledged the FIN and sent a FIN of its own, the first 1338 TCP can ACK this FIN. Note that a TCP receiving a FIN will ACK 1339 but not send its own FIN until its user has CLOSED the connection 1340 also. 1342 Case 2: TCP receives a FIN from the network 1344 If an unsolicited FIN arrives from the network, the receiving TCP 1345 can ACK it and tell the user that the connection is closing. The 1346 user will respond with a CLOSE, upon which the TCP can send a FIN 1347 to the other TCP after sending any remaining data. The TCP then 1348 waits until its own FIN is acknowledged whereupon it deletes the 1349 connection. If an ACK is not forthcoming, after the user timeout 1350 the connection is aborted and the user is told. 1352 Case 3: both users close simultaneously 1354 A simultaneous CLOSE by users at both ends of a connection causes 1355 FIN segments to be exchanged. When all segments preceding the 1356 FINs have been processed and acknowledged, each TCP can ACK the 1357 FIN it has received. Both will, upon receiving these ACKs, delete 1358 the connection. 1360 TCP A TCP B 1362 1. ESTABLISHED ESTABLISHED 1364 2. (Close) 1365 FIN-WAIT-1 --> --> CLOSE-WAIT 1367 3. FIN-WAIT-2 <-- <-- CLOSE-WAIT 1369 4. (Close) 1370 TIME-WAIT <-- <-- LAST-ACK 1372 5. TIME-WAIT --> --> CLOSED 1374 6. (2 MSL) 1375 CLOSED 1377 Normal Close Sequence 1379 Figure 11 1381 TCP A TCP B 1383 1. ESTABLISHED ESTABLISHED 1385 2. (Close) (Close) 1386 FIN-WAIT-1 --> ... FIN-WAIT-1 1387 <-- <-- 1388 ... --> 1390 3. CLOSING --> ... CLOSING 1391 <-- <-- 1392 ... --> 1394 4. TIME-WAIT TIME-WAIT 1395 (2 MSL) (2 MSL) 1396 CLOSED CLOSED 1398 Simultaneous Close Sequence 1400 Figure 12 1402 A TCP connection may terminate in two ways: (1) the normal TCP close 1403 sequence using a FIN handshake, and (2) an "abort" in which one or 1404 more RST segments are sent and the connection state is immediately 1405 discarded. If a TCP connection is closed by the remote site, the 1406 local application MUST be informed whether it closed normally or was 1407 aborted. 1409 3.5.1. Half-Closed Connections 1411 The normal TCP close sequence delivers buffered data reliably in both 1412 directions. Since the two directions of a TCP connection are closed 1413 independently, it is possible for a connection to be "half closed," 1414 i.e., closed in only one direction, and a host is permitted to 1415 continue sending data in the open direction on a half-closed 1416 connection. 1418 A host MAY implement a "half-duplex" TCP close sequence, so that an 1419 application that has called CLOSE cannot continue to read data from 1420 the connection. If such a host issues a CLOSE call while received 1421 data is still pending in TCP, or if new data is received after CLOSE 1422 is called, its TCP SHOULD send a RST to show that data was lost. 1424 When a connection is closed actively, it MUST linger in TIME-WAIT 1425 state for a time 2xMSL (Maximum Segment Lifetime). However, it MAY 1426 accept a new SYN from the remote TCP to reopen the connection 1427 directly from TIME-WAIT state, if it: 1429 (1) assigns its initial sequence number for the new connection to 1430 be larger than the largest sequence number it used on the previous 1431 connection incarnation, and 1433 (2) returns to TIME-WAIT state if the SYN turns out to be an old 1434 duplicate. 1436 3.6. Precedence and Security 1438 TODO - talk to TCPM about what to do about precedence and security 1439 compartment throughout the document ... security compartment material 1440 for IPv4 may be fine nearly as-is, but precedence was a subset of 1441 what DSCP includes and it's not clear that running code actually does 1442 what 793 says about precedence anyways, especially since now as a 1443 DSCP it doesn't make sense to do greater-than comparisons on, nor to 1444 reset connections if it changes. 1446 The intent is that connection be allowed only between ports operating 1447 with exactly the same security and compartment values and at the 1448 higher of the precedence level requested by the two ports. 1450 The precedence and security parameters used in TCP are exactly those 1451 defined in the Internet Protocol (IP) [1]. Throughout this TCP 1452 specification the term "security/compartment" is intended to indicate 1453 the security parameters used in IP including security, compartment, 1454 user group, and handling restriction. 1456 A connection attempt with mismatched security/compartment values or a 1457 lower precedence value must be rejected by sending a reset. 1458 Rejecting a connection due to too low a precedence only occurs after 1459 an acknowledgment of the SYN has been received. 1461 Note that TCP modules which operate only at the default value of 1462 precedence will still have to check the precedence of incoming 1463 segments and possibly raise the precedence level they use on the 1464 connection. 1466 The security parameters may be used even in a non-secure environment 1467 (the values would indicate unclassified data), thus hosts in non- 1468 secure environments must be prepared to receive the security 1469 parameters, though they need not send them. 1471 3.7. Segmentation 1473 The term "segmentation" refers to the activity TCP performs when 1474 ingesting a stream of bytes from a sending application and 1475 packetizing that stream of bytes into TCP segments. Individual TCP 1476 segments often do not correspond one-for-one to individual send (or 1477 socket write) calls from the application. Applications may perform 1478 writes at the granularity of messages in the upper layer protocol, 1479 but TCP guarantees no boundary coherence between the TCP segments 1480 sent and received versus user application data read or write buffer 1481 boundaries. In some specific protocols, such as RDMA using DDP and 1482 MPA [16], there are performance optimizations possible when the 1483 relation between TCP segments and application data units can be 1484 controlled, and MPA includes a specific mechanism for detecting and 1485 verifying this relationship between TCP segments and application 1486 message data strcutures, but this is specific to applications like 1487 RDMA. In general, multiple goals influence the sizing of TCP 1488 segments created by a TCP implementation. 1490 Goals driving the sending of larger segments include: 1492 o Reducing the number of packets in flight within the network. 1494 o Increasing processing efficiency and potential performance by 1495 enabling a smaller number of interrupts and inter-layer 1496 interactions. 1498 o Limiting the overhead of TCP headers. 1500 Note that the performance benefits of sending larger segments may 1501 decrease as the size increases, and there may be boundaries where 1502 advantages are reversed. For instance, on some machines 1025 bytes 1503 within a segment could lead to worse performance than 1024 bytes, due 1504 purely to data alignment on copy operations. 1506 Goals driving the sending of smaller segments include: 1508 o Avoiding sending segments larger than the smallest MTU within an 1509 IP network path, because this results in either packet loss or 1510 fragmentation. Making matters worse, some firewalls or 1511 middleboxes may drop fragmented packets or ICMP messages related 1512 related to fragmentation. 1514 o Preventing delays to the application data stream, especially when 1515 TCP is waiting on the application to generate more data, or when 1516 the application is waiting on an event or input from its peer in 1517 order to generate more data. 1519 o Enabling "fate sharing" between TCP segments and lower-layer data 1520 units (e.g. below IP, for links with cell or frame sizes smaller 1521 than the IP MTU). 1523 Towards meeting these competing sets of goals, TCP includes several 1524 mechanisms, including the Maximum Segment Size option, Path MTU 1525 Discovery, the Nagle algorithm, and support for IPv6 Jumbograms, as 1526 discussed in the following subsections. 1528 3.7.1. Maximum Segment Size Option 1530 TCP MUST implement both sending and receiving the MSS option. 1532 TCP SHOULD send an MSS option in every SYN segment when its receive 1533 MSS differs from the default 536 for IPv4 or 1220 for IPv6, and MAY 1534 send it always. 1536 If an MSS option is not received at connection setup, TCP MUST assume 1537 a default send MSS of 536 (576-40) for IPv4 or 1220 (1280 - 60) for 1538 IPv6. 1540 The maximum size of a segment that TCP really sends, the "effective 1541 send MSS," MUST be the smaller of the send MSS (which reflects the 1542 available reassembly buffer size at the remote host, the EMTU_R [14]) 1543 and the largest transmission size permitted by the IP layer (EMTU_S 1544 [14]): 1546 Eff.snd.MSS = 1547 min(SendMSS+20, MMS_S) - TCPhdrsize - IPoptionsize 1549 where: 1551 o SendMSS is the MSS value received from the remote host, or the 1552 default 536 for IPv4 or 1220 for IPv6, if no MSS option is 1553 received. 1555 o MMS_S is the maximum size for a transport-layer message that TCP 1556 may send. 1558 o TCPhdrsize is the size of the fixed TCP header and any options. 1559 This is 20 in the (rare) case that no options are present, but may 1560 be larger if TCP options are to be sent. Note that some options 1561 may not be included on all segments, but that for each segment 1562 sent, the sender should adjust the data length accordingly, within 1563 the Eff.snd.MSS. 1565 o IPoptionsize is the size of any IP options associated with a TCP 1566 connection. Note that some options may not be included on all 1567 packets, but that for each segment sent, the sender should adjust 1568 the data length accordingly, within the Eff.snd.MSS. 1570 The MSS value to be sent in an MSS option should be equal to the 1571 effective MTU minus the fixed IP and TCP headers. By ignoring both 1572 IP and TCP options when calculating the value for the MSS option, if 1573 there are any IP or TCP options to be sent in a packet, then the 1574 sender must decrease the size of the TCP data accordingly. RFC 6691 1575 [24] discusses this in greater detail. 1577 The MSS value to be sent in an MSS option must be less than or equal 1578 to: 1580 MMS_R - 20 1582 where MMS_R is the maximum size for a transport-layer message that 1583 can be received (and reassembled at the IP layer). TCP obtains MMS_R 1584 and MMS_S from the IP layer; see the generic call GET_MAXSIZES in 1585 Section 3.4 of RFC 1122. These are defined in terms of their IP MTU 1586 equivalents, EMTU_R and EMTU_S [14]. 1588 When TCP is used in a situation where either the IP or TCP headers 1589 are not fixed, the sender must reduce the amount of TCP data in any 1590 given packet by the number of octets used by the IP and TCP options. 1591 This has been a point of confusion historically, as explained in RFC 1592 6691, Section 3.1. 1594 3.7.2. Path MTU Discovery 1596 A TCP implementation may be aware of the MTU on directly connected 1597 links, but will rarely have insight about MTUs across an entire 1598 network path. For IPv4, RFC 1122 provides an IP-layer recommendation 1599 on the default effective MTU for sending to be less than or equal to 1600 576 for destinations not directly connected. For IPv6, this would be 1601 1280. In all cases, however, implementation of Path MTU Discovery 1602 (PMTUD) and Packetization Layer Path MTU Discovery (PLPMTUD) is 1603 strongly recommended in order for TCP to improve segmentation 1604 decisions. Both PMTUD and PLPMTUD help TCP choose segment sizes that 1605 avoid both on-path (for IPv4) and source fragmentation (IPv4 and 1606 IPv6). 1608 PMTUD for IPv4 [2] or IPv6 [3] is implemented in conjunction between 1609 TCP, IP, and ICMP protocols. It relies both on avoiding source 1610 fragmentation and setting the IPv4 DF (don't fragment) flag, the 1611 latter to inhibit on-path fragmentation. It relies on ICMP errors 1612 from routers along the path, whenever a segment is too large to 1613 traverse a link. Several adjustments to a TCP implementation with 1614 PMTUD are described in RFC 2923 in order to deal with problems 1615 experienced in practice [8]. PLPMTUD [15] is a Standards Track 1616 improvement to PMTUD that relaxes the requirement for ICMP support 1617 across a path, and improves performance in cases where ICMP is not 1618 consistently conveyed, but still tries to avoid source fragmentation. 1619 The mechanisms in all four of these RFCs are recommended to be 1620 included in TCP implementations. 1622 The TCP MSS option specifies an upper bound for the size of packets 1623 that can be received. Hence, setting the value in the MSS option too 1624 small can impact the ability for PMTUD or PLPMTUD to find a larger 1625 path MTU. RFC 1191 discusses this implication of many older TCP 1626 implementations setting MSS to 536 for non-local destinations, rather 1627 than deriving it from the MTUs of connected interfaces as 1628 recommended. 1630 3.7.3. Interfaces with Variable MTU Values 1632 The effective MTU can sometimes vary, as when used with variable 1633 compression, e.g., RObust Header Compression (ROHC) [19]. It is 1634 tempting for TCP to want to advertise the largest possible MSS, to 1635 support the most efficient use of compressed payloads. 1636 Unfortunately, some compression schemes occasionally need to transmit 1637 full headers (and thus smaller payloads) to resynchronize state at 1638 their endpoint compressors/decompressors. If the largest MTU is used 1639 to calculate the value to advertise in the MSS option, TCP 1640 retransmission may interfere with compressor resynchronization. 1642 As a result, when the effective MTU of an interface varies, TCP 1643 SHOULD use the smallest effective MTU of the interface to calculate 1644 the value to advertise in the MSS option. 1646 3.7.4. Nagle Algorithm 1648 The "Nagle algorithm" was described in RFC 896 [13] and was 1649 recommended in RFC 1122 [14] for mitigation of an early problem of 1650 too many small packets being generated. It has been implemented in 1651 most current TCP code bases, sometimes with minor variations. 1653 If there is unacknowledged data (i.e., SND.NXT > SND.UNA), then the 1654 sending TCP buffers all user data (regardless of the PSH bit), until 1655 the outstanding data has been acknowledged or until the TCP can send 1656 a full-sized segment (Eff.snd.MSS bytes). 1658 TODO - see if SEND description later should be updated to reflect 1659 this 1661 A TCP SHOULD implement the Nagle Algorithm to coalesce short 1662 segments. However, there MUST be a way for an application to disable 1663 the Nagle algorithm on an individual connection. In all cases, 1664 sending data is also subject to the limitation imposed by the Slow 1665 Start algorithm [18]. 1667 3.7.5. IPv6 Jumbograms 1669 In order to support TCP over IPv6 jumbograms, implementations need to 1670 be able to send TCP segments larger than the 64KB limit that the MSS 1671 option can convey. RFC 2675 [7] defines that an MSS value of 65,535 1672 bytes is to be treated as infinity, and Path MTU Discovery [3] is 1673 used to determine the actual MSS. 1675 3.8. Data Communication 1677 Once the connection is established data is communicated by the 1678 exchange of segments. Because segments may be lost due to errors 1679 (checksum test failure), or network congestion, TCP uses 1680 retransmission (after a timeout) to ensure delivery of every segment. 1681 Duplicate segments may arrive due to network or TCP retransmission. 1682 As discussed in the section on sequence numbers the TCP performs 1683 certain tests on the sequence and acknowledgment numbers in the 1684 segments to verify their acceptability. 1686 The sender of data keeps track of the next sequence number to use in 1687 the variable SND.NXT. The receiver of data keeps track of the next 1688 sequence number to expect in the variable RCV.NXT. The sender of 1689 data keeps track of the oldest unacknowledged sequence number in the 1690 variable SND.UNA. If the data flow is momentarily idle and all data 1691 sent has been acknowledged then the three variables will be equal. 1693 When the sender creates a segment and transmits it the sender 1694 advances SND.NXT. When the receiver accepts a segment it advances 1695 RCV.NXT and sends an acknowledgment. When the data sender receives 1696 an acknowledgment it advances SND.UNA. The extent to which the 1697 values of these variables differ is a measure of the delay in the 1698 communication. The amount by which the variables are advanced is the 1699 length of the data and SYN or FIN flags in the segment. Note that 1700 once in the ESTABLISHED state all segments must carry current 1701 acknowledgment information. 1703 The CLOSE user call implies a push function, as does the FIN control 1704 flag in an incoming segment. 1706 3.8.1. Retransmission Timeout 1708 Because of the variability of the networks that compose an 1709 internetwork system and the wide range of uses of TCP connections the 1710 retransmission timeout (RTO) must be dynamically determined. 1712 The RTO MUST be computed according to the algorithm in [10], 1713 including Karn's algorithm for taking RTT samples. 1715 RFC 793 contains an early example procedure for computing the RTO. 1716 This was then replaced by the algorithm described in RFC 1122, and 1717 subsequently updated in RFC 2988, and then again in RFC 6298. 1719 If a retransmitted packet is identical to the original packet (which 1720 implies not only that the data boundaries have not changed, but also 1721 that the window and acknowledgment fields of the header have not 1722 changed), then the same IP Identification field MAY be used (see 1723 Section 3.2.1.5 of RFC 1122). 1725 3.8.2. TCP Congestion Control 1727 RFC 1122 required implementation of Van Jacobson's congestion control 1728 algorithm combining slow start with congestion avoidance. RFC 2581 1729 provided IETF Standards Track description of this, along with fast 1730 retransmit and fast recovery. RFC 5681 is the current description of 1731 these algorithms and is the current standard for TCP congestion 1732 control. 1734 A TCP MUST implement RFC 5681. 1736 Explicit Congestion Notification (ECN) was defined in RFC 3168 and is 1737 an IETF Standards Track enhancement that has many benefits [28]. 1739 A TCP SHOULD implement ECN as described in RFC 3168. 1741 3.8.3. TCP Connection Failures 1743 Excessive retransmission of the same segment by TCP indicates some 1744 failure of the remote host or the Internet path. This failure may be 1745 of short or long duration. The following procedure MUST be used to 1746 handle excessive retransmissions of data segments: 1748 (a) There are two thresholds R1 and R2 measuring the amount of 1749 retransmission that has occurred for the same segment. R1 and R2 1750 might be measured in time units or as a count of retransmissions. 1752 (b) When the number of transmissions of the same segment reaches 1753 or exceeds threshold R1, pass negative advice (see [14] 1754 Section 3.3.1.4) to the IP layer, to trigger dead-gateway 1755 diagnosis. 1757 (c) When the number of transmissions of the same segment reaches a 1758 threshold R2 greater than R1, close the connection. 1760 (d) An application MUST be able to set the value for R2 for a 1761 particular connection. For example, an interactive application 1762 might set R2 to "infinity," giving the user control over when to 1763 disconnect. 1765 (d) TCP SHOULD inform the application of the delivery problem 1766 (unless such information has been disabled by the application; see 1767 RFC1122 Section 4.2.4.1 - TODO update to error reporting 1768 description in this document), when R1 is reached and before R2. 1769 This will allow a remote login (User Telnet) application program 1770 to inform the user, for example. 1772 The value of R1 SHOULD correspond to at least 3 retransmissions, at 1773 the current RTO. The value of R2 SHOULD correspond to at least 100 1774 seconds. 1776 An attempt to open a TCP connection could fail with excessive 1777 retransmissions of the SYN segment or by receipt of a RST segment or 1778 an ICMP Port Unreachable. SYN retransmissions MUST be handled in the 1779 general way just described for data retransmissions, including 1780 notification of the application layer. 1782 However, the values of R1 and R2 may be different for SYN and data 1783 segments. In particular, R2 for a SYN segment MUST be set large 1784 enough to provide retransmission of the segment for at least 3 1785 minutes. The application can close the connection (i.e., give up on 1786 the open attempt) sooner, of course. 1788 3.8.4. TCP Keep-Alives 1790 Implementors MAY include "keep-alives" in their TCP implementations, 1791 although this practice is not universally accepted. If keep-alives 1792 are included, the application MUST be able to turn them on or off for 1793 each TCP connection, and they MUST default to off. 1795 Keep-alive packets MUST only be sent when no data or acknowledgement 1796 packets have been received for the connection within an interval. 1797 This interval MUST be configurable and MUST default to no less than 1798 two hours. 1800 It is extremely important to remember that ACK segments that contain 1801 no data are not reliably transmitted by TCP. Consequently, if a 1802 keep-alive mechanism is implemented it MUST NOT interpret failure to 1803 respond to any specific probe as a dead connection. 1805 An implementation SHOULD send a keep-alive segment with no data; 1806 however, it MAY be configurable to send a keep-alive segment 1807 containing one garbage octet, for compatibility with erroneous TCP 1808 implementations. 1810 3.8.5. The Communication of Urgent Information 1812 As a result of implementation differences and middlebox interactions, 1813 new applications SHOULD NOT employ the TCP urgent mechanism. 1814 However, TCP implementations MUST still include support for the 1815 urgent mechanism. Details can be found in RFC 6093 [21]. 1817 The objective of the TCP urgent mechanism is to allow the sending 1818 user to stimulate the receiving user to accept some urgent data and 1819 to permit the receiving TCP to indicate to the receiving user when 1820 all the currently known urgent data has been received by the user. 1822 This mechanism permits a point in the data stream to be designated as 1823 the end of urgent information. Whenever this point is in advance of 1824 the receive sequence number (RCV.NXT) at the receiving TCP, that TCP 1825 must tell the user to go into "urgent mode"; when the receive 1826 sequence number catches up to the urgent pointer, the TCP must tell 1827 user to go into "normal mode". If the urgent pointer is updated 1828 while the user is in "urgent mode", the update will be invisible to 1829 the user. 1831 The method employs a urgent field which is carried in all segments 1832 transmitted. The URG control flag indicates that the urgent field is 1833 meaningful and must be added to the segment sequence number to yield 1834 the urgent pointer. The absence of this flag indicates that there is 1835 no urgent data outstanding. 1837 To send an urgent indication the user must also send at least one 1838 data octet. If the sending user also indicates a push, timely 1839 delivery of the urgent information to the destination process is 1840 enhanced. 1842 A TCP MUST support a sequence of urgent data of any length. [14] 1844 A TCP MUST inform the application layer asynchronously whenever it 1845 receives an Urgent pointer and there was previously no pending urgent 1846 data, or whenvever the Urgent pointer advances in the data stream. 1847 There MUST be a way for the application to learn how much urgent data 1848 remains to be read from the connection, or at least to determine 1849 whether or not more urgent data remains to be read. [14] 1851 3.8.6. Managing the Window 1853 The window sent in each segment indicates the range of sequence 1854 numbers the sender of the window (the data receiver) is currently 1855 prepared to accept. There is an assumption that this is related to 1856 the currently available data buffer space available for this 1857 connection. 1859 The sending TCP packages the data to be transmitted into segments 1860 which fit the current window, and may repackage segments on the 1861 retransmission queue. Such repackaging is not required, but may be 1862 helpful. 1864 In a connection with a one-way data flow, the window information will 1865 be carried in acknowledgment segments that all have the same sequence 1866 number so there will be no way to reorder them if they arrive out of 1867 order. This is not a serious problem, but it will allow the window 1868 information to be on occasion temporarily based on old reports from 1869 the data receiver. A refinement to avoid this problem is to act on 1870 the window information from segments that carry the highest 1871 acknowledgment number (that is segments with acknowledgment number 1872 equal or greater than the highest previously received). 1874 Indicating a large window encourages transmissions. If more data 1875 arrives than can be accepted, it will be discarded. This will result 1876 in excessive retransmissions, adding unnecessarily to the load on the 1877 network and the TCPs. Indicating a small window may restrict the 1878 transmission of data to the point of introducing a round trip delay 1879 between each new segment transmitted. 1881 The mechanisms provided allow a TCP to advertise a large window and 1882 to subsequently advertise a much smaller window without having 1883 accepted that much data. This, so called "shrinking the window," is 1884 strongly discouraged. The robustness principle dictates that TCPs 1885 will not shrink the window themselves, but will be prepared for such 1886 behavior on the part of other TCPs. 1888 A TCP receiver SHOULD NOT shrink the window, i.e., move the right 1889 window edge to the left. However, a sending TCP MUST be robust 1890 against window shrinking, which may cause the "useable window" (see 1891 Section 3.8.6.2.1) to become negative. 1893 If this happens, the sender SHOULD NOT send new data, but SHOULD 1894 retransmit normally the old unacknowledged data between SND.UNA and 1895 SND.UNA+SND.WND. The sender MAY also retransmit old data beyond 1896 SND.UNA+SND.WND, but SHOULD NOT time out the connection if data 1897 beyond the right window edge is not acknowledged. If the window 1898 shrinks to zero, the TCP MUST probe it in the standard way (described 1899 below). 1901 3.8.6.1. Zero Window Probing 1903 The sending TCP must be prepared to accept from the user and send at 1904 least one octet of new data even if the send window is zero. The 1905 sending TCP must regularly retransmit to the receiving TCP even when 1906 the window is zero, in order to "probe" the window. Two minutes is 1907 recommended for the retransmission interval when the window is zero. 1908 This retransmission is essential to guarantee that when either TCP 1909 has a zero window the re-opening of the window will be reliably 1910 reported to the other. This is referred to as Zero-Window Probing 1911 (ZWP) in other documents. 1913 Probing of zero (offered) windows MUST be supported. 1915 A TCP MAY keep its offered receive window closed indefinitely. As 1916 long as the receiving TCP continues to send acknowledgments in 1917 response to the probe segments, the sending TCP MUST allow the 1918 connection to stay open. This enables TCP to function in scenarios 1919 such as the "printer ran out of paper" situation described in 1920 Section 4.2.2.17 of RFC1122. The behavior is subject to the 1921 implementation's resource management concerns, as noted in [22]. 1923 When the receiving TCP has a zero window and a segment arrives it 1924 must still send an acknowledgment showing its next expected sequence 1925 number and current window (zero). 1927 3.8.6.2. Silly Window Syndrome Avoidance 1929 The "Silly Window Syndrome" (SWS) is a stable pattern of small 1930 incremental window movements resulting in extremely poor TCP 1931 performance. Algorithms to avoid SWS are described below for both 1932 the sending side and the receiving side. RFC 1122 contains more 1933 detailed discussion of the SWS problem. Note that the Nagle 1934 algorithm and the sender SWS avoidance algorithm play complementary 1935 roles in improving performance. The Nagle algorithm discourages 1936 sending tiny segments when the data to be sent increases in small 1937 increments, while the SWS avoidance algorithm discourages small 1938 segments resulting from the right window edge advancing in small 1939 increments. 1941 3.8.6.2.1. Sender's Algorithm - When to Send Data 1943 A TCP MUST include a SWS avoidance algorithm in the sender. 1945 A TCP SHOULD implement the Nagle Algorithm to coalesce short 1946 segments. However, there MUST be a way for an application to disable 1947 the Nagle algorithm on an individual connection. In all cases, 1948 sending data is also subject to the limitation imposed by the Slow 1949 Start algorithm. 1951 The sender's SWS avoidance algorithm is more difficult than the 1952 receivers's, because the sender does not know (directly) the 1953 receiver's total buffer space RCV.BUFF. An approach which has been 1954 found to work well is for the sender to calculate Max(SND.WND), the 1955 maximum send window it has seen so far on the connection, and to use 1956 this value as an estimate of RCV.BUFF. Unfortunately, this can only 1957 be an estimate; the receiver may at any time reduce the size of 1958 RCV.BUFF. To avoid a resulting deadlock, it is necessary to have a 1959 timeout to force transmission of data, overriding the SWS avoidance 1960 algorithm. In practice, this timeout should seldom occur. 1962 The "useable window" is: 1964 U = SND.UNA + SND.WND - SND.NXT 1966 i.e., the offered window less the amount of data sent but not 1967 acknowledged. If D is the amount of data queued in the sending TCP 1968 but not yet sent, then the following set of rules is recommended. 1970 Send data: 1972 (1) if a maximum-sized segment can be sent, i.e, if: 1974 min(D,U) >= Eff.snd.MSS; 1976 (2) or if the data is pushed and all queued data can be sent now, 1977 i.e., if: 1979 [SND.NXT = SND.UNA and] PUSHED and D <= U 1981 (the bracketed condition is imposed by the Nagle algorithm); 1983 (3) or if at least a fraction Fs of the maximum window can be sent, 1984 i.e., if: 1986 [SND.NXT = SND.UNA and] 1988 min(D.U) >= Fs * Max(SND.WND); 1990 (4) or if data is PUSHed and the override timeout occurs. 1992 Here Fs is a fraction whose recommended value is 1/2. The override 1993 timeout should be in the range 0.1 - 1.0 seconds. It may be 1994 convenient to combine this timer with the timer used to probe zero 1995 windows (Section Section 3.8.6.1). 1997 3.8.6.2.2. Receiver's Algorithm - When to Send a Window Update 1999 A TCP MUST include a SWS avoidance algorithm in the receiver. 2001 The receiver's SWS avoidance algorithm determines when the right 2002 window edge may be advanced; this is customarily known as "updating 2003 the window". This algorithm combines with the delayed ACK algorithm 2004 (see Section 3.8.6.3) to determine when an ACK segment containing the 2005 current window will really be sent to the receiver. 2007 The solution to receiver SWS is to avoid advancing the right window 2008 edge RCV.NXT+RCV.WND in small increments, even if data is received 2009 from the network in small segments. 2011 Suppose the total receive buffer space is RCV.BUFF. At any given 2012 moment, RCV.USER octets of this total may be tied up with data that 2013 has been received and acknowledged but which the user process has not 2014 yet consumed. When the connection is quiescent, RCV.WND = RCV.BUFF 2015 and RCV.USER = 0. 2017 Keeping the right window edge fixed as data arrives and is 2018 acknowledged requires that the receiver offer less than its full 2019 buffer space, i.e., the receiver must specify a RCV.WND that keeps 2020 RCV.NXT+RCV.WND constant as RCV.NXT increases. Thus, the total 2021 buffer space RCV.BUFF is generally divided into three parts: 2023 |<------- RCV.BUFF ---------------->| 2024 1 2 3 2025 ----|---------|------------------|------|---- 2026 RCV.NXT ^ 2027 (Fixed) 2029 1 - RCV.USER = data received but not yet consumed; 2030 2 - RCV.WND = space advertised to sender; 2031 3 - Reduction = space available but not yet 2032 advertised. 2034 The suggested SWS avoidance algorithm for the receiver is to keep 2035 RCV.NXT+RCV.WND fixed until the reduction satisfies: 2037 RCV.BUFF - RCV.USER - RCV.WND >= 2039 min( Fr * RCV.BUFF, Eff.snd.MSS ) 2041 where Fr is a fraction whose recommended value is 1/2, and 2042 Eff.snd.MSS is the effective send MSS for the connection (see 2043 Section 3.7.1). When the inequality is satisfied, RCV.WND is set to 2044 RCV.BUFF-RCV.USER. 2046 Note that the general effect of this algorithm is to advance RCV.WND 2047 in increments of Eff.snd.MSS (for realistic receive buffers: 2048 Eff.snd.MSS < RCV.BUFF/2). Note also that the receiver must use its 2049 own Eff.snd.MSS, assuming it is the same as the sender's. 2051 3.8.6.3. Delayed Acknowledgements - When to Send an ACK Segment 2053 A host that is receiving a stream of TCP data segments can increase 2054 efficiency in both the Internet and the hosts by sending fewer than 2055 one ACK (acknowledgment) segment per data segment received; this is 2056 known as a "delayed ACK". 2058 A TCP SHOULD implement a delayed ACK, but an ACK should not be 2059 excessively delayed; in particular, the delay MUST be less than 0.5 2060 seconds, and in a stream of full-sized segments there SHOULD be an 2061 ACK for at least every second segment. Excessive delays on ACK's can 2062 disturb the round-trip timing and packet "clocking" algorithms. 2064 3.9. Interfaces 2066 There are of course two interfaces of concern: the user/TCP interface 2067 and the TCP/lower-level interface. We have a fairly elaborate model 2068 of the user/TCP interface, but the interface to the lower level 2069 protocol module is left unspecified here, since it will be specified 2070 in detail by the specification of the lower level protocol. For the 2071 case that the lower level is IP we note some of the parameter values 2072 that TCPs might use. 2074 3.9.1. User/TCP Interface 2076 The following functional description of user commands to the TCP is, 2077 at best, fictional, since every operating system will have different 2078 facilities. Consequently, we must warn readers that different TCP 2079 implementations may have different user interfaces. However, all 2080 TCPs must provide a certain minimum set of services to guarantee that 2081 all TCP implementations can support the same protocol hierarchy. 2082 This section specifies the functional interfaces required of all TCP 2083 implementations. 2085 TCP User Commands 2087 The following sections functionally characterize a USER/TCP 2088 interface. The notation used is similar to most procedure or 2089 function calls in high level languages, but this usage is not 2090 meant to rule out trap type service calls (e.g., SVCs, UUOs, 2091 EMTs). 2093 The user commands described below specify the basic functions the 2094 TCP must perform to support interprocess communication. 2095 Individual implementations must define their own exact format, and 2096 may provide combinations or subsets of the basic functions in 2097 single calls. In particular, some implementations may wish to 2098 automatically OPEN a connection on the first SEND or RECEIVE 2099 issued by the user for a given connection. 2101 In providing interprocess communication facilities, the TCP must 2102 not only accept commands, but must also return information to the 2103 processes it serves. The latter consists of: 2105 (a) general information about a connection (e.g., interrupts, 2106 remote close, binding of unspecified foreign socket). 2108 (b) replies to specific user commands indicating success or 2109 various types of failure. 2111 Open 2113 Format: OPEN (local port, foreign socket, active/passive [, 2114 timeout] [, precedence] [, security/compartment] [local IP 2115 address,] [, options]) -> local connection name 2116 We assume that the local TCP is aware of the identity of the 2117 processes it serves and will check the authority of the process 2118 to use the connection specified. Depending upon the 2119 implementation of the TCP, the local network and TCP 2120 identifiers for the source address will either be supplied by 2121 the TCP or the lower level protocol (e.g., IP). These 2122 considerations are the result of concern about security, to the 2123 extent that no TCP be able to masquerade as another one, and so 2124 on. Similarly, no process can masquerade as another without 2125 the collusion of the TCP. 2127 If the active/passive flag is set to passive, then this is a 2128 call to LISTEN for an incoming connection. A passive open may 2129 have either a fully specified foreign socket to wait for a 2130 particular connection or an unspecified foreign socket to wait 2131 for any call. A fully specified passive call can be made 2132 active by the subsequent execution of a SEND. 2134 A transmission control block (TCB) is created and partially 2135 filled in with data from the OPEN command parameters. 2137 Every passive OPEN call either creates a new connection record 2138 in LISTEN state, or it returns an error; it MUST NOT affect any 2139 previously created connection record. 2141 A TCP that supports multiple concurrent users MUST provide an 2142 OPEN call that will functionally allow an application to LISTEN 2143 on a port while a connection block with the same local port is 2144 in SYN-SENT or SYN-RECEIVED state. 2146 On an active OPEN command, the TCP will begin the procedure to 2147 synchronize (i.e., establish) the connection at once. 2149 The timeout, if present, permits the caller to set up a timeout 2150 for all data submitted to TCP. If data is not successfully 2151 delivered to the destination within the timeout period, the TCP 2152 will abort the connection. The present global default is five 2153 minutes. 2155 The TCP or some component of the operating system will verify 2156 the users authority to open a connection with the specified 2157 precedence or security/compartment. The absence of precedence 2158 or security/compartment specification in the OPEN call 2159 indicates the default values must be used. 2161 TCP will accept incoming requests as matching only if the 2162 security/compartment information is exactly the same and only 2163 if the precedence is equal to or higher than the precedence 2164 requested in the OPEN call. 2166 The precedence for the connection is the higher of the values 2167 requested in the OPEN call and received from the incoming 2168 request, and fixed at that value for the life of the 2169 connection.Implementers may want to give the user control of 2170 this precedence negotiation. For example, the user might be 2171 allowed to specify that the precedence must be exactly matched, 2172 or that any attempt to raise the precedence be confirmed by the 2173 user. 2175 A local connection name will be returned to the user by the 2176 TCP. The local connection name can then be used as a short 2177 hand term for the connection defined by the pair. 2180 The optional "local IP address" parameter MUST be supported to 2181 allow the specification of the local IP address. This enables 2182 applications that need to select the local IP address used when 2183 multihoming is present. 2185 A passive OPEN call with a specified "local IP address" 2186 parameter will await an incoming connection request to that 2187 address. If the parameter is unspecified, a passive OPEN will 2188 await an incoming connection request to any local IP address, 2189 and then bind the local IP address of the connection to the 2190 particular address that is used. 2192 For an active OPEN call, a specified "local IP address" 2193 parameter MUST be used for opening the connection. If the 2194 parameter is unspecified, the TCP will choose an appropriate 2195 local IP address (see RFC 1122 section 3.3.4.2). 2197 TODO - the previous and next paragraphs are mildly in conflict. 2198 Previous paragraph says that the TCP chooses an address, but 2199 next paragraph says that it asks IP to choose ... need to make 2200 this consistent 2202 If an application on a multihomed host does not specify the 2203 local IP address when actively opening a TCP connection, then 2204 the TCP MUST ask the IP layer to select a local IP address 2205 before sending the (first) SYN. See the function GET_SRCADDR() 2206 in Section 3.4 of RFC 1122. 2208 At all other times, a previous segment has either been sent or 2209 received on this connection, and TCP MUST use the same local 2210 address is used that was used in those previous segments. 2212 Send 2214 Format: SEND (local connection name, buffer address, byte 2215 count, PUSH flag, URGENT flag [,timeout]) 2217 This call causes the data contained in the indicated user 2218 buffer to be sent on the indicated connection. If the 2219 connection has not been opened, the SEND is considered an 2220 error. Some implementations may allow users to SEND first; in 2221 which case, an automatic OPEN would be done. If the calling 2222 process is not authorized to use this connection, an error is 2223 returned. 2225 If the PUSH flag is set, the data must be transmitted promptly 2226 to the receiver, and the PUSH bit will be set in the last TCP 2227 segment created from the buffer. If the PUSH flag is not set, 2228 the data may be combined with data from subsequent SENDs for 2229 transmission efficiency. 2231 New applications SHOULD NOT set the URGENT flag [21] due to 2232 implementation differences and middlebox issues. 2234 If the URGENT flag is set, segments sent to the destination TCP 2235 will have the urgent pointer set. The receiving TCP will 2236 signal the urgent condition to the receiving process if the 2237 urgent pointer indicates that data preceding the urgent pointer 2238 has not been consumed by the receiving process. The purpose of 2239 urgent is to stimulate the receiver to process the urgent data 2240 and to indicate to the receiver when all the currently known 2241 urgent data has been received. The number of times the sending 2242 user's TCP signals urgent will not necessarily be equal to the 2243 number of times the receiving user will be notified of the 2244 presence of urgent data. 2246 If no foreign socket was specified in the OPEN, but the 2247 connection is established (e.g., because a LISTENing connection 2248 has become specific due to a foreign segment arriving for the 2249 local socket), then the designated buffer is sent to the 2250 implied foreign socket. Users who make use of OPEN with an 2251 unspecified foreign socket can make use of SEND without ever 2252 explicitly knowing the foreign socket address. 2254 However, if a SEND is attempted before the foreign socket 2255 becomes specified, an error will be returned. Users can use 2256 the STATUS call to determine the status of the connection. In 2257 some implementations the TCP may notify the user when an 2258 unspecified socket is bound. 2260 If a timeout is specified, the current user timeout for this 2261 connection is changed to the new one. 2263 In the simplest implementation, SEND would not return control 2264 to the sending process until either the transmission was 2265 complete or the timeout had been exceeded. However, this 2266 simple method is both subject to deadlocks (for example, both 2267 sides of the connection might try to do SENDs before doing any 2268 RECEIVEs) and offers poor performance, so it is not 2269 recommended. A more sophisticated implementation would return 2270 immediately to allow the process to run concurrently with 2271 network I/O, and, furthermore, to allow multiple SENDs to be in 2272 progress. Multiple SENDs are served in first come, first 2273 served order, so the TCP will queue those it cannot service 2274 immediately. 2276 We have implicitly assumed an asynchronous user interface in 2277 which a SEND later elicits some kind of SIGNAL or pseudo- 2278 interrupt from the serving TCP. An alternative is to return a 2279 response immediately. For instance, SENDs might return 2280 immediate local acknowledgment, even if the segment sent had 2281 not been acknowledged by the distant TCP. We could 2282 optimistically assume eventual success. If we are wrong, the 2283 connection will close anyway due to the timeout. In 2284 implementations of this kind (synchronous), there will still be 2285 some asynchronous signals, but these will deal with the 2286 connection itself, and not with specific segments or buffers. 2288 In order for the process to distinguish among error or success 2289 indications for different SENDs, it might be appropriate for 2290 the buffer address to be returned along with the coded response 2291 to the SEND request. TCP-to-user signals are discussed below, 2292 indicating the information which should be returned to the 2293 calling process. 2295 Receive 2297 Format: RECEIVE (local connection name, buffer address, byte 2298 count) -> byte count, urgent flag, push flag 2300 This command allocates a receiving buffer associated with the 2301 specified connection. If no OPEN precedes this command or the 2302 calling process is not authorized to use this connection, an 2303 error is returned. 2305 In the simplest implementation, control would not return to the 2306 calling program until either the buffer was filled, or some 2307 error occurred, but this scheme is highly subject to deadlocks. 2309 A more sophisticated implementation would permit several 2310 RECEIVEs to be outstanding at once. These would be filled as 2311 segments arrive. This strategy permits increased throughput at 2312 the cost of a more elaborate scheme (possibly asynchronous) to 2313 notify the calling program that a PUSH has been seen or a 2314 buffer filled. 2316 If enough data arrive to fill the buffer before a PUSH is seen, 2317 the PUSH flag will not be set in the response to the RECEIVE. 2318 The buffer will be filled with as much data as it can hold. If 2319 a PUSH is seen before the buffer is filled the buffer will be 2320 returned partially filled and PUSH indicated. 2322 If there is urgent data the user will have been informed as 2323 soon as it arrived via a TCP-to-user signal. The receiving 2324 user should thus be in "urgent mode". If the URGENT flag is 2325 on, additional urgent data remains. If the URGENT flag is off, 2326 this call to RECEIVE has returned all the urgent data, and the 2327 user may now leave "urgent mode". Note that data following the 2328 urgent pointer (non-urgent data) cannot be delivered to the 2329 user in the same buffer with preceding urgent data unless the 2330 boundary is clearly marked for the user. 2332 To distinguish among several outstanding RECEIVEs and to take 2333 care of the case that a buffer is not completely filled, the 2334 return code is accompanied by both a buffer pointer and a byte 2335 count indicating the actual length of the data received. 2337 Alternative implementations of RECEIVE might have the TCP 2338 allocate buffer storage, or the TCP might share a ring buffer 2339 with the user. 2341 Close 2343 Format: CLOSE (local connection name) 2345 This command causes the connection specified to be closed. If 2346 the connection is not open or the calling process is not 2347 authorized to use this connection, an error is returned. 2348 Closing connections is intended to be a graceful operation in 2349 the sense that outstanding SENDs will be transmitted (and 2350 retransmitted), as flow control permits, until all have been 2351 serviced. Thus, it should be acceptable to make several SEND 2352 calls, followed by a CLOSE, and expect all the data to be sent 2353 to the destination. It should also be clear that users should 2354 continue to RECEIVE on CLOSING connections, since the other 2355 side may be trying to transmit the last of its data. Thus, 2356 CLOSE means "I have no more to send" but does not mean "I will 2357 not receive any more." It may happen (if the user level 2358 protocol is not well thought out) that the closing side is 2359 unable to get rid of all its data before timing out. In this 2360 event, CLOSE turns into ABORT, and the closing TCP gives up. 2362 The user may CLOSE the connection at any time on his own 2363 initiative, or in response to various prompts from the TCP 2364 (e.g., remote close executed, transmission timeout exceeded, 2365 destination inaccessible). 2367 Because closing a connection requires communication with the 2368 foreign TCP, connections may remain in the closing state for a 2369 short time. Attempts to reopen the connection before the TCP 2370 replies to the CLOSE command will result in error responses. 2372 Close also implies push function. 2374 Status 2376 Format: STATUS (local connection name) -> status data 2378 This is an implementation dependent user command and could be 2379 excluded without adverse effect. Information returned would 2380 typically come from the TCB associated with the connection. 2382 This command returns a data block containing the following 2383 information: 2385 local socket, 2386 foreign socket, 2387 local connection name, 2388 receive window, 2389 send window, 2390 connection state, 2391 number of buffers awaiting acknowledgment, 2392 number of buffers pending receipt, 2393 urgent state, 2394 precedence, 2395 security/compartment, 2396 and transmission timeout. 2398 Depending on the state of the connection, or on the 2399 implementation itself, some of this information may not be 2400 available or meaningful. If the calling process is not 2401 authorized to use this connection, an error is returned. This 2402 prevents unauthorized processes from gaining information about 2403 a connection. 2405 Abort 2407 Format: ABORT (local connection name) 2409 This command causes all pending SENDs and RECEIVES to be 2410 aborted, the TCB to be removed, and a special RESET message to 2411 be sent to the TCP on the other side of the connection. 2412 Depending on the implementation, users may receive abort 2413 indications for each outstanding SEND or RECEIVE, or may simply 2414 receive an ABORT-acknowledgment. 2416 Flush 2418 Some TCP implementations have included a FLUSH call, which will 2419 empty the TCP send queue of any data for which the user has 2420 issued SEND calls but which is still to the right of the 2421 current send window. That is, it flushes as much queued send 2422 data as possible without losing sequence number 2423 synchronization. 2425 Set Differentiated Services Field (IPv4 TOS or IPv6 Traffic Class) 2427 The application layer MUST be able to specify the 2428 Differentiated Services field for segments that are sent on a 2429 connection. The Differentiated Services field includes the 2430 6-bit Differentiated Services Code Point (DSCP) value. It is 2431 not required, but the application SHOULD be able to change the 2432 Differentiated Services field during the connection lifetime. 2433 TCP SHOULD pass the current Differentiated Services field value 2434 without change to the IP layer, when it sends segments on the 2435 connection. 2437 The Differentiated Services field will be specified 2438 independently in each direction on the connection, so that the 2439 receiver application will specify the Differentiated Services 2440 field used for ACK segments. 2442 TCP MAY pass the most recently received Differentiated Services 2443 field up to the application. 2445 TCP-to-User Messages 2447 It is assumed that the operating system environment provides a 2448 means for the TCP to asynchronously signal the user program. 2449 When the TCP does signal a user program, certain information is 2450 passed to the user. Often in the specification the information 2451 will be an error message. In other cases there will be 2452 information relating to the completion of processing a SEND or 2453 RECEIVE or other user call. 2455 The following information is provided: 2457 Local Connection Name Always 2458 Response String Always 2459 Buffer Address Send & Receive 2460 Byte count (counts bytes received) Receive 2461 Push flag Receive 2462 Urgent flag Receive 2464 3.9.2. TCP/Lower-Level Interface 2466 The TCP calls on a lower level protocol module to actually send and 2467 receive information over a network. The two current standard 2468 Internet Protocol (IP) versions layered below TCP are IPv4 [1] and 2469 IPv6 [5]. 2471 If the lower level protocol is IPv4 it provides arguments for a type 2472 of service (used within the Differentiated Services field) and for a 2473 time to live. TCP uses the following settings for these parameters: 2475 Type of Service = Precedence: given by user, Delay: normal, 2476 Throughput: normal, Reliability: normal; or binary XXX00000, where 2477 XXX are the three bits determining precedence, e.g. 000 means 2478 routine precedence. TODO - this is pretty much wrong with regard 2479 to DiffServ, I think we should just say that the user can specify 2480 diffserv field (superset of DSCP) and leave it at that, but will 2481 check with TCPM 2483 Time to Live (TTL): The TTL value used to send TCP segments MUST 2484 be configurable. 2486 Note that RFC 793 specified one minute (60 seconds) as a 2487 constant for the TTL, because the assumed maximum segment 2488 lifetime was two minutes. This was intended to explicitly ask 2489 that a segment be destroyed if it cannot be delivered by the 2490 internet system within one minute. RFC 1122 changed this 2491 specification to require that the TTL be configurable. 2493 Any lower level protocol will have to provide the source address, 2494 destination address, and protocol fields, and some way to determine 2495 the "TCP length", both to provide the functional equivalent service 2496 of IP and to be used in the TCP checksum. 2498 When received options are passed up to TCP from the IP layer, TCP 2499 MUST ignore options that it does not understand. 2501 A TCP MAY support the Time Stamp and Record Route options. 2503 3.9.2.1. Source Routing 2505 If the lower level is IP (or other protocol that provides this 2506 feature) and source routing is used, the interface must allow the 2507 route information to be communicated. This is especially important 2508 so that the source and destination addresses used in the TCP checksum 2509 be the originating source and ultimate destination. It is also 2510 important to preserve the return route to answer connection requests. 2512 An application MUST be able to specify a source route when it 2513 actively opens a TCP connection, and this MUST take precedence over a 2514 source route received in a datagram. 2516 When a TCP connection is OPENed passively and a packet arrives with a 2517 completed IP Source Route option (containing a return route), TCP 2518 MUST save the return route and use it for all segments sent on this 2519 connection. If a different source route arrives in a later segment, 2520 the later definition SHOULD override the earlier one. 2522 3.9.2.2. ICMP Messages 2524 TCP MUST act on an ICMP error message passed up from the IP layer, 2525 directing it to the connection that created the error. The necessary 2526 demultiplexing information can be found in the IP header contained 2527 within the ICMP message. 2529 This applies to ICMPv6 in addition to IPv4 ICMP. 2531 [17] contains discussion of specific ICMP and ICMPv6 messages 2532 classified as either "soft" or "hard" errors that may bear different 2533 responses. Treatment for classes of ICMP messages is described 2534 below: 2536 Source Quench 2537 TCP MUST silently discard any received ICMP Source Quench messages. 2538 See [11] for discussion. 2540 Soft Errors 2541 For ICMP these include: Destination Unreachable -- codes 0, 1, 5, 2542 Time Exceeded -- codes 0, 1, and Parameter Problem. 2543 For ICMPv6 these include: Destination Unreachable -- codes 0 and 3, 2544 Time Exceeded -- codes 0, 1, and Parameter Problem -- codes 0, 1, 2 2545 Since these Unreachable messages indicate soft error conditions, 2546 TCP MUST NOT abort the connection, and it SHOULD make the 2547 information available to the application. 2549 Hard Errors 2550 For ICMP these include Destination Unreachable -- codes 2-4"> 2551 These are hard error conditions, so TCP SHOULD abort the 2552 connection. [17] notes that some implementations do not abort 2553 connections when an ICMP hard error is received for a connection 2554 that is in any of the synchronized states. 2556 Note that [17] section 4 describes widespread implementation behavior 2557 that treats soft errors as hard errors during connection 2558 establishment. 2560 3.10. Event Processing 2562 The processing depicted in this section is an example of one possible 2563 implementation. Other implementations may have slightly different 2564 processing sequences, but they should differ from those in this 2565 section only in detail, not in substance. 2567 The activity of the TCP can be characterized as responding to events. 2568 The events that occur can be cast into three categories: user calls, 2569 arriving segments, and timeouts. This section describes the 2570 processing the TCP does in response to each of the events. In many 2571 cases the processing required depends on the state of the connection. 2573 Events that occur: 2575 User Calls 2577 OPEN 2578 SEND 2579 RECEIVE 2580 CLOSE 2581 ABORT 2582 STATUS 2584 Arriving Segments 2586 SEGMENT ARRIVES 2588 Timeouts 2590 USER TIMEOUT 2591 RETRANSMISSION TIMEOUT 2592 TIME-WAIT TIMEOUT 2594 The model of the TCP/user interface is that user commands receive an 2595 immediate return and possibly a delayed response via an event or 2596 pseudo interrupt. In the following descriptions, the term "signal" 2597 means cause a delayed response. 2599 Error responses are given as character strings. For example, user 2600 commands referencing connections that do not exist receive "error: 2601 connection not open". 2603 Please note in the following that all arithmetic on sequence numbers, 2604 acknowledgment numbers, windows, et cetera, is modulo 2**32 the size 2605 of the sequence number space. Also note that "=<" means less than or 2606 equal to (modulo 2**32). 2608 A natural way to think about processing incoming segments is to 2609 imagine that they are first tested for proper sequence number (i.e., 2610 that their contents lie in the range of the expected "receive window" 2611 in the sequence number space) and then that they are generally queued 2612 and processed in sequence number order. 2614 When a segment overlaps other already received segments we 2615 reconstruct the segment to contain just the new data, and adjust the 2616 header fields to be consistent. 2618 Note that if no state change is mentioned the TCP stays in the same 2619 state. 2621 OPEN Call 2623 CLOSED STATE (i.e., TCB does not exist) 2625 Create a new transmission control block (TCB) to hold 2626 connection state information. Fill in local socket identifier, 2627 foreign socket, precedence, security/compartment, and user 2628 timeout information. Note that some parts of the foreign 2629 socket may be unspecified in a passive OPEN and are to be 2630 filled in by the parameters of the incoming SYN segment. 2631 Verify the security and precedence requested are allowed for 2632 this user, if not return "error: precedence not allowed" or 2633 "error: security/compartment not allowed." If passive enter 2634 the LISTEN state and return. If active and the foreign socket 2635 is unspecified, return "error: foreign socket unspecified"; if 2636 active and the foreign socket is specified, issue a SYN 2637 segment. An initial send sequence number (ISS) is selected. A 2638 SYN segment of the form is sent. Set 2639 SND.UNA to ISS, SND.NXT to ISS+1, enter SYN-SENT state, and 2640 return. 2642 If the caller does not have access to the local socket 2643 specified, return "error: connection illegal for this process". 2644 If there is no room to create a new connection, return "error: 2645 insufficient resources". 2647 LISTEN STATE 2649 If active and the foreign socket is specified, then change the 2650 connection from passive to active, select an ISS. Send a SYN 2651 segment, set SND.UNA to ISS, SND.NXT to ISS+1. Enter SYN-SENT 2652 state. Data associated with SEND may be sent with SYN segment 2653 or queued for transmission after entering ESTABLISHED state. 2654 The urgent bit if requested in the command must be sent with 2655 the data segments sent as a result of this command. If there 2656 is no room to queue the request, respond with "error: 2657 insufficient resources". If Foreign socket was not specified, 2658 then return "error: foreign socket unspecified". 2660 SYN-SENT STATE 2661 SYN-RECEIVED STATE 2662 ESTABLISHED STATE 2663 FIN-WAIT-1 STATE 2664 FIN-WAIT-2 STATE 2665 CLOSE-WAIT STATE 2666 CLOSING STATE 2667 LAST-ACK STATE 2668 TIME-WAIT STATE 2670 Return "error: connection already exists". 2672 SEND Call 2674 CLOSED STATE (i.e., TCB does not exist) 2676 If the user does not have access to such a connection, then 2677 return "error: connection illegal for this process". 2679 Otherwise, return "error: connection does not exist". 2681 LISTEN STATE 2683 If the foreign socket is specified, then change the connection 2684 from passive to active, select an ISS. Send a SYN segment, set 2685 SND.UNA to ISS, SND.NXT to ISS+1. Enter SYN-SENT state. Data 2686 associated with SEND may be sent with SYN segment or queued for 2687 transmission after entering ESTABLISHED state. The urgent bit 2688 if requested in the command must be sent with the data segments 2689 sent as a result of this command. If there is no room to queue 2690 the request, respond with "error: insufficient resources". If 2691 Foreign socket was not specified, then return "error: foreign 2692 socket unspecified". 2694 SYN-SENT STATE 2695 SYN-RECEIVED STATE 2697 Queue the data for transmission after entering ESTABLISHED 2698 state. If no space to queue, respond with "error: insufficient 2699 resources". 2701 ESTABLISHED STATE 2702 CLOSE-WAIT STATE 2704 Segmentize the buffer and send it with a piggybacked 2705 acknowledgment (acknowledgment value = RCV.NXT). If there is 2706 insufficient space to remember this buffer, simply return 2707 "error: insufficient resources". 2709 If the urgent flag is set, then SND.UP <- SND.NXT and set the 2710 urgent pointer in the outgoing segments. 2712 FIN-WAIT-1 STATE 2713 FIN-WAIT-2 STATE 2714 CLOSING STATE 2715 LAST-ACK STATE 2716 TIME-WAIT STATE 2718 Return "error: connection closing" and do not service request. 2720 RECEIVE Call 2722 CLOSED STATE (i.e., TCB does not exist) 2724 If the user does not have access to such a connection, return 2725 "error: connection illegal for this process". 2727 Otherwise return "error: connection does not exist". 2729 LISTEN STATE 2730 SYN-SENT STATE 2731 SYN-RECEIVED STATE 2733 Queue for processing after entering ESTABLISHED state. If 2734 there is no room to queue this request, respond with "error: 2735 insufficient resources". 2737 ESTABLISHED STATE 2738 FIN-WAIT-1 STATE 2739 FIN-WAIT-2 STATE 2741 If insufficient incoming segments are queued to satisfy the 2742 request, queue the request. If there is no queue space to 2743 remember the RECEIVE, respond with "error: insufficient 2744 resources". 2746 Reassemble queued incoming segments into receive buffer and 2747 return to user. Mark "push seen" (PUSH) if this is the case. 2749 If RCV.UP is in advance of the data currently being passed to 2750 the user notify the user of the presence of urgent data. 2752 When the TCP takes responsibility for delivering data to the 2753 user that fact must be communicated to the sender via an 2754 acknowledgment. The formation of such an acknowledgment is 2755 described below in the discussion of processing an incoming 2756 segment. 2758 CLOSE-WAIT STATE 2760 Since the remote side has already sent FIN, RECEIVEs must be 2761 satisfied by text already on hand, but not yet delivered to the 2762 user. If no text is awaiting delivery, the RECEIVE will get a 2763 "error: connection closing" response. Otherwise, any remaining 2764 text can be used to satisfy the RECEIVE. 2766 CLOSING STATE 2767 LAST-ACK STATE 2768 TIME-WAIT STATE 2770 Return "error: connection closing". 2772 CLOSE Call 2774 CLOSED STATE (i.e., TCB does not exist) 2776 If the user does not have access to such a connection, return 2777 "error: connection illegal for this process". 2779 Otherwise, return "error: connection does not exist". 2781 LISTEN STATE 2783 Any outstanding RECEIVEs are returned with "error: closing" 2784 responses. Delete TCB, enter CLOSED state, and return. 2786 SYN-SENT STATE 2788 Delete the TCB and return "error: closing" responses to any 2789 queued SENDs, or RECEIVEs. 2791 SYN-RECEIVED STATE 2793 If no SENDs have been issued and there is no pending data to 2794 send, then form a FIN segment and send it, and enter FIN-WAIT-1 2795 state; otherwise queue for processing after entering 2796 ESTABLISHED state. 2798 ESTABLISHED STATE 2800 Queue this until all preceding SENDs have been segmentized, 2801 then form a FIN segment and send it. In any case, enter FIN- 2802 WAIT-1 state. 2804 FIN-WAIT-1 STATE 2805 FIN-WAIT-2 STATE 2807 Strictly speaking, this is an error and should receive a 2808 "error: connection closing" response. An "ok" response would 2809 be acceptable, too, as long as a second FIN is not emitted (the 2810 first FIN may be retransmitted though). 2812 CLOSE-WAIT STATE 2814 Queue this request until all preceding SENDs have been 2815 segmentized; then send a FIN segment, enter LAST-ACK state. 2817 CLOSING STATE 2818 LAST-ACK STATE 2819 TIME-WAIT STATE 2820 Respond with "error: connection closing". 2822 ABORT Call 2824 CLOSED STATE (i.e., TCB does not exist) 2826 If the user should not have access to such a connection, return 2827 "error: connection illegal for this process". 2829 Otherwise return "error: connection does not exist". 2831 LISTEN STATE 2833 Any outstanding RECEIVEs should be returned with "error: 2834 connection reset" responses. Delete TCB, enter CLOSED state, 2835 and return. 2837 SYN-SENT STATE 2839 All queued SENDs and RECEIVEs should be given "connection 2840 reset" notification, delete the TCB, enter CLOSED state, and 2841 return. 2843 SYN-RECEIVED STATE 2844 ESTABLISHED STATE 2845 FIN-WAIT-1 STATE 2846 FIN-WAIT-2 STATE 2847 CLOSE-WAIT STATE 2849 Send a reset segment: 2851 2853 All queued SENDs and RECEIVEs should be given "connection 2854 reset" notification; all segments queued for transmission 2855 (except for the RST formed above) or retransmission should be 2856 flushed, delete the TCB, enter CLOSED state, and return. 2858 CLOSING STATE LAST-ACK STATE TIME-WAIT STATE 2860 Respond with "ok" and delete the TCB, enter CLOSED state, and 2861 return. 2863 STATUS Call 2865 CLOSED STATE (i.e., TCB does not exist) 2867 If the user should not have access to such a connection, return 2868 "error: connection illegal for this process". 2870 Otherwise return "error: connection does not exist". 2872 LISTEN STATE 2874 Return "state = LISTEN", and the TCB pointer. 2876 SYN-SENT STATE 2878 Return "state = SYN-SENT", and the TCB pointer. 2880 SYN-RECEIVED STATE 2882 Return "state = SYN-RECEIVED", and the TCB pointer. 2884 ESTABLISHED STATE 2886 Return "state = ESTABLISHED", and the TCB pointer. 2888 FIN-WAIT-1 STATE 2890 Return "state = FIN-WAIT-1", and the TCB pointer. 2892 FIN-WAIT-2 STATE 2894 Return "state = FIN-WAIT-2", and the TCB pointer. 2896 CLOSE-WAIT STATE 2898 Return "state = CLOSE-WAIT", and the TCB pointer. 2900 CLOSING STATE 2902 Return "state = CLOSING", and the TCB pointer. 2904 LAST-ACK STATE 2906 Return "state = LAST-ACK", and the TCB pointer. 2908 TIME-WAIT STATE 2910 Return "state = TIME-WAIT", and the TCB pointer. 2912 SEGMENT ARRIVES 2914 If the state is CLOSED (i.e., TCB does not exist) then 2916 all data in the incoming segment is discarded. An incoming 2917 segment containing a RST is discarded. An incoming segment not 2918 containing a RST causes a RST to be sent in response. The 2919 acknowledgment and sequence field values are selected to make 2920 the reset sequence acceptable to the TCP that sent the 2921 offending segment. 2923 If the ACK bit is off, sequence number zero is used, 2925 2927 If the ACK bit is on, 2929 2931 Return. 2933 If the state is LISTEN then 2935 first check for an RST 2937 An incoming RST should be ignored. Return. 2939 second check for an ACK 2941 Any acknowledgment is bad if it arrives on a connection 2942 still in the LISTEN state. An acceptable reset segment 2943 should be formed for any arriving ACK-bearing segment. The 2944 RST should be formatted as follows: 2946 2948 Return. 2950 third check for a SYN 2952 If the SYN bit is set, check the security. If the security/ 2953 compartment on the incoming segment does not exactly match 2954 the security/compartment in the TCB then send a reset and 2955 return. 2957 2959 If the SEG.PRC is greater than the TCB.PRC then if allowed 2960 by the user and the system set TCB.PRC<-SEG.PRC, if not 2961 allowed send a reset and return. 2963 2965 If the SEG.PRC is less than the TCB.PRC then continue. 2967 Set RCV.NXT to SEG.SEQ+1, IRS is set to SEG.SEQ and any 2968 other control or text should be queued for processing later. 2969 ISS should be selected and a SYN segment sent of the form: 2971 2973 SND.NXT is set to ISS+1 and SND.UNA to ISS. The connection 2974 state should be changed to SYN-RECEIVED. Note that any 2975 other incoming control or data (combined with SYN) will be 2976 processed in the SYN-RECEIVED state, but processing of SYN 2977 and ACK should not be repeated. If the listen was not fully 2978 specified (i.e., the foreign socket was not fully 2979 specified), then the unspecified fields should be filled in 2980 now. 2982 fourth other text or control 2984 Any other control or text-bearing segment (not containing 2985 SYN) must have an ACK and thus would be discarded by the ACK 2986 processing. An incoming RST segment could not be valid, 2987 since it could not have been sent in response to anything 2988 sent by this incarnation of the connection. So you are 2989 unlikely to get here, but if you do, drop the segment, and 2990 return. 2992 If the state is SYN-SENT then 2994 first check the ACK bit 2996 If the ACK bit is set 2998 If SEG.ACK =< ISS, or SEG.ACK > SND.NXT, send a reset 2999 (unless the RST bit is set, if so drop the segment and 3000 return) 3002 3004 and discard the segment. Return. 3006 If SND.UNA < SEG.ACK =< SND.NXT then the ACK is 3007 acceptable. (TODO: in processing Errata ID 3300, it was 3008 noted that some stacks in the wild that do not send data 3009 on the SYN are just checking that SEG.ACK == SND.NXT ... 3010 think about whether anything should be said about that 3011 here) 3013 second check the RST bit 3015 If the RST bit is set 3017 A potential blind reset attack is described in RFC 5961 3018 [20], with the mitigation that a TCP implementation 3019 SHOULD first check that the sequence number exactly 3020 matches RCV.NXT prior to executing the action in the next 3021 paragraph. 3023 If the ACK was acceptable then signal the user "error: 3024 connection reset", drop the segment, enter CLOSED state, 3025 delete TCB, and return. Otherwise (no ACK) drop the 3026 segment and return. 3028 third check the security and precedence 3030 If the security/compartment in the segment does not exactly 3031 match the security/compartment in the TCB, send a reset 3033 If there is an ACK 3035 3037 Otherwise 3039 3041 If there is an ACK 3043 The precedence in the segment must match the precedence 3044 in the TCB, if not, send a reset 3046 3048 If there is no ACK 3050 If the precedence in the segment is higher than the 3051 precedence in the TCB then if allowed by the user and the 3052 system raise the precedence in the TCB to that in the 3053 segment, if not allowed to raise the prec then send a 3054 reset. 3056 3058 If the precedence in the segment is lower than the 3059 precedence in the TCB continue. 3061 If a reset was sent, discard the segment and return. 3063 fourth check the SYN bit 3065 This step should be reached only if the ACK is ok, or there 3066 is no ACK, and it the segment did not contain a RST. 3068 If the SYN bit is on and the security/compartment and 3069 precedence are acceptable then, RCV.NXT is set to SEG.SEQ+1, 3070 IRS is set to SEG.SEQ. SND.UNA should be advanced to equal 3071 SEG.ACK (if there is an ACK), and any segments on the 3072 retransmission queue which are thereby acknowledged should 3073 be removed. 3075 If SND.UNA > ISS (our SYN has been ACKed), change the 3076 connection state to ESTABLISHED, form an ACK segment 3078 3080 and send it. Data or controls which were queued for 3081 transmission may be included. If there are other controls 3082 or text in the segment then continue processing at the sixth 3083 step below where the URG bit is checked, otherwise return. 3085 Otherwise enter SYN-RECEIVED, form a SYN,ACK segment 3087 3089 and send it. Set the variables: 3091 SND.WND <- SEG.WND 3092 SND.WL1 <- SEG.SEQ 3093 SND.WL2 <- SEG.ACK 3095 If there are other controls or text in the segment, queue 3096 them for processing after the ESTABLISHED state has been 3097 reached, return. 3099 fifth, if neither of the SYN or RST bits is set then drop the 3100 segment and return. 3102 Otherwise, 3104 first check sequence number 3106 SYN-RECEIVED STATE 3107 ESTABLISHED STATE 3108 FIN-WAIT-1 STATE 3109 FIN-WAIT-2 STATE 3110 CLOSE-WAIT STATE 3111 CLOSING STATE 3112 LAST-ACK STATE 3113 TIME-WAIT STATE 3115 Segments are processed in sequence. Initial tests on 3116 arrival are used to discard old duplicates, but further 3117 processing is done in SEG.SEQ order. If a segment's 3118 contents straddle the boundary between old and new, only the 3119 new parts should be processed. 3121 There are four cases for the acceptability test for an 3122 incoming segment: 3124 Segment Receive Test 3125 Length Window 3126 ------- ------- ------------------------------------------- 3128 0 0 SEG.SEQ = RCV.NXT 3130 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 3132 >0 0 not acceptable 3134 >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND 3135 or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND 3137 If the RCV.WND is zero, no segments will be acceptable, but 3138 special allowance should be made to accept valid ACKs, URGs 3139 and RSTs. 3141 If an incoming segment is not acceptable, an acknowledgment 3142 should be sent in reply (unless the RST bit is set, if so 3143 drop the segment and return): 3145 3147 After sending the acknowledgment, drop the unacceptable 3148 segment and return. 3150 In the following it is assumed that the segment is the 3151 idealized segment that begins at RCV.NXT and does not exceed 3152 the window. One could tailor actual segments to fit this 3153 assumption by trimming off any portions that lie outside the 3154 window (including SYN and FIN), and only processing further 3155 if the segment then begins at RCV.NXT. Segments with higher 3156 beginning sequence numbers should be held for later 3157 processing. 3159 In general, the processing of received segments MUST be 3160 implemented to aggregate ACK segments whenever possible. 3161 For example, if the TCP is processing a series of queued 3162 segments, it MUST process them all before sending any ACK 3163 segments. (TODO - see if there's a better place for this 3164 paragraph - taken from RFC1122) 3166 second check the RST bit, 3168 RFC 5961 section 3 describes a potential blind reset attack 3169 and optional mitigation approach that SHOULD be implemented. 3170 For stacks implementing RFC 5961, the three checks below 3171 apply, otherwise processesing for these states is indicated 3172 further below. 3174 1) If the RST bit is set and the sequence number is 3175 outside the current receive window, silently drop the 3176 segment. 3178 2) If the RST bit is set and the sequence number exactly 3179 matches the next expected sequence number (RCV.NXT), then 3180 TCP MUST reset the connection in the manner prescribed 3181 below according to the connection state. 3183 3) If the RST bit is set and the sequence number does not 3184 exactly match the next expected sequence value, yet is 3185 within the current receive window, TCP MUST send an 3186 acknowledgement (challenge ACK): 3188 3190 After sending the challenge ACK, TCP MUST drop the 3191 unacceptable segment and stop processing the incoming 3192 packet further. Note that RFC 5961 and Errata ID 4772 3193 contain additional considerations for ACK throttling in 3194 an implementation. 3196 SYN-RECEIVED STATE 3198 If the RST bit is set 3200 If this connection was initiated with a passive OPEN 3201 (i.e., came from the LISTEN state), then return this 3202 connection to LISTEN state and return. The user need 3203 not be informed. If this connection was initiated 3204 with an active OPEN (i.e., came from SYN-SENT state) 3205 then the connection was refused, signal the user 3206 "connection refused". In either case, all segments on 3207 the retransmission queue should be removed. And in 3208 the active OPEN case, enter the CLOSED state and 3209 delete the TCB, and return. 3211 ESTABLISHED 3212 FIN-WAIT-1 3213 FIN-WAIT-2 3214 CLOSE-WAIT 3216 If the RST bit is set then, any outstanding RECEIVEs and 3217 SEND should receive "reset" responses. All segment 3218 queues should be flushed. Users should also receive an 3219 unsolicited general "connection reset" signal. Enter the 3220 CLOSED state, delete the TCB, and return. 3222 CLOSING STATE 3223 LAST-ACK STATE 3224 TIME-WAIT 3226 If the RST bit is set then, enter the CLOSED state, 3227 delete the TCB, and return. 3229 third check security and precedence 3231 SYN-RECEIVED 3233 If the security/compartment and precedence in the segment 3234 do not exactly match the security/compartment and 3235 precedence in the TCB then send a reset, and return. 3237 ESTABLISHED 3238 FIN-WAIT-1 3239 FIN-WAIT-2 3240 CLOSE-WAIT 3241 CLOSING 3242 LAST-ACK 3243 TIME-WAIT 3245 If the security/compartment and precedence in the segment 3246 do not exactly match the security/compartment and 3247 precedence in the TCB then send a reset, any outstanding 3248 RECEIVEs and SEND should receive "reset" responses. All 3249 segment queues should be flushed. Users should also 3250 receive an unsolicited general "connection reset" signal. 3251 Enter the CLOSED state, delete the TCB, and return. 3253 Note this check is placed following the sequence check to 3254 prevent a segment from an old connection between these ports 3255 with a different security or precedence from causing an 3256 abort of the current connection. 3258 fourth, check the SYN bit, 3260 SYN-RECEIVED 3262 If the connection was initiated with a passive OPEN, then 3263 return this connection to the LISTEN state and return. 3264 Otherwise, handle per the directions for synchronized 3265 states below. 3267 ESTABLISHED STATE 3268 FIN-WAIT STATE-1 3269 FIN-WAIT STATE-2 3270 CLOSE-WAIT STATE 3271 CLOSING STATE 3272 LAST-ACK STATE 3273 TIME-WAIT STATE 3275 If the SYN bit is set in these synchronized states, it 3276 may be either an error where the connection should be 3277 reset, or the result of an attack attempt, as described 3278 in RFC 5961 [20]. RFC 5961 provides a mitigation that 3279 SHOULD be implemented, though there are alternatives (see 3280 Section 6). RFC 5961 recommends that in these 3281 synchronized states, if the SYN bit is set, irrespective 3282 of the sequence number, TCP MUST send a "challenge ACK" 3283 to the remote peer: 3285 3287 After sending the acknowledgement, TCP MUST drop the 3288 unacceptable segment and stop processing further. Note 3289 that RFC 5961 and Errata ID 4772 contain additional ACK 3290 throttling notes for an implementation. 3292 For implementations that do not follow RFC 5961, the 3293 original RFC 793 behavior follows in this paragraph. If 3294 the SYN is in the window it is an error, send a reset, 3295 any outstanding RECEIVEs and SEND should receive "reset" 3296 responses, all segment queues should be flushed, the user 3297 should also receive an unsolicited general "connection 3298 reset" signal, enter the CLOSED state, delete the TCB, 3299 and return. 3301 If the SYN is not in the window this step would not be 3302 reached and an ack would have been sent in the first step 3303 (sequence number check). 3305 fifth check the ACK field, 3307 if the ACK bit is off drop the segment and return 3309 if the ACK bit is on 3311 RFC 5961 section 5 describes a potential blind data 3312 injection attack, and mitigation that implementations MAY 3313 choose to include. TCP stacks that implement RFC 5961 3314 MUST add an input check that the ACK value is acceptable 3315 only if it is in the range of ((SND.UNA - MAX.SND.WND) =< 3316 SEG.ACK =< SND.NXT). All incoming segments whose ACK 3317 value doesn't satisfy the above condition MUST be 3318 discarded and an ACK sent back. The new state variable 3319 MAX.SND.WND is defined as the largest window that the 3320 local sender has ever received from its peer (subject to 3321 window scaling) or may be hard-coded to a maximum 3322 permissible window value. When the ACK value is 3323 acceptable, the processing per-state below applies: 3325 SYN-RECEIVED STATE 3327 If SND.UNA < SEG.ACK =< SND.NXT then enter ESTABLISHED 3328 state and continue processing with variables below set 3329 to: 3331 SND.WND <- SEG.WND 3332 SND.WL1 <- SEG.SEQ 3333 SND.WL2 <- SEG.ACK 3335 If the segment acknowledgment is not acceptable, 3336 form a reset segment, 3337 3339 and send it. 3341 ESTABLISHED STATE 3343 If SND.UNA < SEG.ACK =< SND.NXT then, set SND.UNA <- 3344 SEG.ACK. Any segments on the retransmission queue 3345 which are thereby entirely acknowledged are removed. 3346 Users should receive positive acknowledgments for 3347 buffers which have been SENT and fully acknowledged 3348 (i.e., SEND buffer should be returned with "ok" 3349 response). If the ACK is a duplicate (SEG.ACK =< 3350 SND.UNA), it can be ignored. If the ACK acks 3351 something not yet sent (SEG.ACK > SND.NXT) then send 3352 an ACK, drop the segment, and return. 3354 If SND.UNA =< SEG.ACK =< SND.NXT, the send window 3355 should be updated. If (SND.WL1 < SEG.SEQ or (SND.WL1 3356 = SEG.SEQ and SND.WL2 =< SEG.ACK)), set SND.WND <- 3357 SEG.WND, set SND.WL1 <- SEG.SEQ, and set SND.WL2 <- 3358 SEG.ACK. 3360 Note that SND.WND is an offset from SND.UNA, that 3361 SND.WL1 records the sequence number of the last 3362 segment used to update SND.WND, and that SND.WL2 3363 records the acknowledgment number of the last segment 3364 used to update SND.WND. The check here prevents using 3365 old segments to update the window. 3367 FIN-WAIT-1 STATE 3369 In addition to the processing for the ESTABLISHED 3370 state, if our FIN is now acknowledged then enter FIN- 3371 WAIT-2 and continue processing in that state. 3373 FIN-WAIT-2 STATE 3375 In addition to the processing for the ESTABLISHED 3376 state, if the retransmission queue is empty, the 3377 user's CLOSE can be acknowledged ("ok") but do not 3378 delete the TCB. 3380 CLOSE-WAIT STATE 3382 Do the same processing as for the ESTABLISHED state. 3384 CLOSING STATE 3385 In addition to the processing for the ESTABLISHED 3386 state, if the ACK acknowledges our FIN then enter the 3387 TIME-WAIT state, otherwise ignore the segment. 3389 LAST-ACK STATE 3391 The only thing that can arrive in this state is an 3392 acknowledgment of our FIN. If our FIN is now 3393 acknowledged, delete the TCB, enter the CLOSED state, 3394 and return. 3396 TIME-WAIT STATE 3398 The only thing that can arrive in this state is a 3399 retransmission of the remote FIN. Acknowledge it, and 3400 restart the 2 MSL timeout. 3402 sixth, check the URG bit, 3404 ESTABLISHED STATE 3405 FIN-WAIT-1 STATE 3406 FIN-WAIT-2 STATE 3408 If the URG bit is set, RCV.UP <- max(RCV.UP,SEG.UP), and 3409 signal the user that the remote side has urgent data if 3410 the urgent pointer (RCV.UP) is in advance of the data 3411 consumed. If the user has already been signaled (or is 3412 still in the "urgent mode") for this continuous sequence 3413 of urgent data, do not signal the user again. 3415 CLOSE-WAIT STATE 3416 CLOSING STATE 3417 LAST-ACK STATE 3418 TIME-WAIT 3420 This should not occur, since a FIN has been received from 3421 the remote side. Ignore the URG. 3423 seventh, process the segment text, 3425 ESTABLISHED STATE 3426 FIN-WAIT-1 STATE 3427 FIN-WAIT-2 STATE 3429 Once in the ESTABLISHED state, it is possible to deliver 3430 segment text to user RECEIVE buffers. Text from segments 3431 can be moved into buffers until either the buffer is full 3432 or the segment is empty. If the segment empties and 3433 carries an PUSH flag, then the user is informed, when the 3434 buffer is returned, that a PUSH has been received. 3436 When the TCP takes responsibility for delivering the data 3437 to the user it must also acknowledge the receipt of the 3438 data. 3440 Once the TCP takes responsibility for the data it 3441 advances RCV.NXT over the data accepted, and adjusts 3442 RCV.WND as appropriate to the current buffer 3443 availability. The total of RCV.NXT and RCV.WND should 3444 not be reduced. 3446 A TCP MAY send an ACK segment acknowledging RCV.NXT when 3447 a valid segment arrives that is in the window but not at 3448 the left window edge. 3450 Please note the window management suggestions in section 3451 3.7. 3453 Send an acknowledgment of the form: 3455 3457 This acknowledgment should be piggybacked on a segment 3458 being transmitted if possible without incurring undue 3459 delay. 3461 CLOSE-WAIT STATE 3462 CLOSING STATE 3463 LAST-ACK STATE 3464 TIME-WAIT STATE 3466 This should not occur, since a FIN has been received from 3467 the remote side. Ignore the segment text. 3469 eighth, check the FIN bit, 3471 Do not process the FIN if the state is CLOSED, LISTEN or 3472 SYN-SENT since the SEG.SEQ cannot be validated; drop the 3473 segment and return. 3475 If the FIN bit is set, signal the user "connection closing" 3476 and return any pending RECEIVEs with same message, advance 3477 RCV.NXT over the FIN, and send an acknowledgment for the 3478 FIN. Note that FIN implies PUSH for any segment text not 3479 yet delivered to the user. 3481 SYN-RECEIVED STATE 3482 ESTABLISHED STATE 3484 Enter the CLOSE-WAIT state. 3486 FIN-WAIT-1 STATE 3488 If our FIN has been ACKed (perhaps in this segment), 3489 then enter TIME-WAIT, start the time-wait timer, turn 3490 off the other timers; otherwise enter the CLOSING 3491 state. 3493 FIN-WAIT-2 STATE 3495 Enter the TIME-WAIT state. Start the time-wait timer, 3496 turn off the other timers. 3498 CLOSE-WAIT STATE 3500 Remain in the CLOSE-WAIT state. 3502 CLOSING STATE 3504 Remain in the CLOSING state. 3506 LAST-ACK STATE 3508 Remain in the LAST-ACK state. 3510 TIME-WAIT STATE 3512 Remain in the TIME-WAIT state. Restart the 2 MSL 3513 time-wait timeout. 3515 and return. 3517 USER TIMEOUT 3519 USER TIMEOUT 3521 For any state if the user timeout expires, flush all queues, 3522 signal the user "error: connection aborted due to user timeout" 3523 in general and for any outstanding calls, delete the TCB, enter 3524 the CLOSED state and return. 3526 RETRANSMISSION TIMEOUT 3528 For any state if the retransmission timeout expires on a 3529 segment in the retransmission queue, send the segment at the 3530 front of the retransmission queue again, reinitialize the 3531 retransmission timer, and return. 3533 TIME-WAIT TIMEOUT 3535 If the time-wait timeout expires on a connection delete the 3536 TCB, enter the CLOSED state and return. 3538 3.11. Glossary 3540 1822 BBN Report 1822, "The Specification of the Interconnection of 3541 a Host and an IMP". The specification of interface between a 3542 host and the ARPANET. 3544 ACK 3545 A control bit (acknowledge) occupying no sequence space, 3546 which indicates that the acknowledgment field of this segment 3547 specifies the next sequence number the sender of this segment 3548 is expecting to receive, hence acknowledging receipt of all 3549 previous sequence numbers. 3551 ARPANET message 3552 The unit of transmission between a host and an IMP in the 3553 ARPANET. The maximum size is about 1012 octets (8096 bits). 3555 ARPANET packet 3556 A unit of transmission used internally in the ARPANET between 3557 IMPs. The maximum size is about 126 octets (1008 bits). 3559 connection 3560 A logical communication path identified by a pair of sockets. 3562 datagram 3563 A message sent in a packet switched computer communications 3564 network. 3566 Destination Address 3567 The destination address, usually the network and host 3568 identifiers. 3570 FIN 3571 A control bit (finis) occupying one sequence number, which 3572 indicates that the sender will send no more data or control 3573 occupying sequence space. 3575 fragment 3576 A portion of a logical unit of data, in particular an 3577 internet fragment is a portion of an internet datagram. 3579 FTP 3580 A file transfer protocol. 3582 header 3583 Control information at the beginning of a message, segment, 3584 fragment, packet or block of data. 3586 host 3587 A computer. In particular a source or destination of 3588 messages from the point of view of the communication network. 3590 Identification 3591 An Internet Protocol field. This identifying value assigned 3592 by the sender aids in assembling the fragments of a datagram. 3594 IMP 3595 The Interface Message Processor, the packet switch of the 3596 ARPANET. 3598 internet address 3599 A source or destination address specific to the host level. 3601 internet datagram 3602 The unit of data exchanged between an internet module and the 3603 higher level protocol together with the internet header. 3605 internet fragment 3606 A portion of the data of an internet datagram with an 3607 internet header. 3609 IP 3610 Internet Protocol. 3612 IRS 3613 The Initial Receive Sequence number. The first sequence 3614 number used by the sender on a connection. 3616 ISN 3617 The Initial Sequence Number. The first sequence number used 3618 on a connection, (either ISS or IRS). Selected in a way that 3619 is unique within a given period of time and is unpredictable 3620 to attackers. 3622 ISS 3623 The Initial Send Sequence number. The first sequence number 3624 used by the sender on a connection. 3626 leader 3627 Control information at the beginning of a message or block of 3628 data. In particular, in the ARPANET, the control information 3629 on an ARPANET message at the host-IMP interface. 3631 left sequence 3632 This is the next sequence number to be acknowledged by the 3633 data receiving TCP (or the lowest currently unacknowledged 3634 sequence number) and is sometimes referred to as the left 3635 edge of the send window. 3637 local packet 3638 The unit of transmission within a local network. 3640 module 3641 An implementation, usually in software, of a protocol or 3642 other procedure. 3644 MSL 3645 Maximum Segment Lifetime, the time a TCP segment can exist in 3646 the internetwork system. Arbitrarily defined to be 2 3647 minutes. 3649 octet 3650 An eight bit byte. 3652 Options 3653 An Option field may contain several options, and each option 3654 may be several octets in length. The options are used 3655 primarily in testing situations; for example, to carry 3656 timestamps. Both the Internet Protocol and TCP provide for 3657 options fields. 3659 packet 3660 A package of data with a header which may or may not be 3661 logically complete. More often a physical packaging than a 3662 logical packaging of data. 3664 port 3665 The portion of a socket that specifies which logical input or 3666 output channel of a process is associated with the data. 3668 process 3669 A program in execution. A source or destination of data from 3670 the point of view of the TCP or other host-to-host protocol. 3672 PUSH 3673 A control bit occupying no sequence space, indicating that 3674 this segment contains data that must be pushed through to the 3675 receiving user. 3677 RCV.NXT 3678 receive next sequence number 3680 RCV.UP 3681 receive urgent pointer 3683 RCV.WND 3684 receive window 3686 receive next sequence number 3687 This is the next sequence number the local TCP is expecting 3688 to receive. 3690 receive window 3691 This represents the sequence numbers the local (receiving) 3692 TCP is willing to receive. Thus, the local TCP considers 3693 that segments overlapping the range RCV.NXT to RCV.NXT + 3694 RCV.WND - 1 carry acceptable data or control. Segments 3695 containing sequence numbers entirely outside of this range 3696 are considered duplicates and discarded. 3698 RST 3699 A control bit (reset), occupying no sequence space, 3700 indicating that the receiver should delete the connection 3701 without further interaction. The receiver can determine, 3702 based on the sequence number and acknowledgment fields of the 3703 incoming segment, whether it should honor the reset command 3704 or ignore it. In no case does receipt of a segment 3705 containing RST give rise to a RST in response. 3707 RTP 3708 Real Time Protocol: A host-to-host protocol for communication 3709 of time critical information. 3711 SEG.ACK 3712 segment acknowledgment 3714 SEG.LEN 3715 segment length 3717 SEG.PRC 3718 segment precedence value 3720 SEG.SEQ 3721 segment sequence 3723 SEG.UP 3724 segment urgent pointer field 3726 SEG.WND 3727 segment window field 3729 segment 3730 A logical unit of data, in particular a TCP segment is the 3731 unit of data transfered between a pair of TCP modules. 3733 segment acknowledgment 3734 The sequence number in the acknowledgment field of the 3735 arriving segment. 3737 segment length 3738 The amount of sequence number space occupied by a segment, 3739 including any controls which occupy sequence space. 3741 segment sequence 3742 The number in the sequence field of the arriving segment. 3744 send sequence 3745 This is the next sequence number the local (sending) TCP will 3746 use on the connection. It is initially selected from an 3747 initial sequence number curve (ISN) and is incremented for 3748 each octet of data or sequenced control transmitted. 3750 send window 3751 This represents the sequence numbers which the remote 3752 (receiving) TCP is willing to receive. It is the value of 3753 the window field specified in segments from the remote (data 3754 receiving) TCP. The range of new sequence numbers which may 3755 be emitted by a TCP lies between SND.NXT and SND.UNA + 3756 SND.WND - 1. (Retransmissions of sequence numbers between 3757 SND.UNA and SND.NXT are expected, of course.) 3759 SND.NXT 3760 send sequence 3762 SND.UNA 3763 left sequence 3765 SND.UP 3766 send urgent pointer 3768 SND.WL1 3769 segment sequence number at last window update 3771 SND.WL2 3772 segment acknowledgment number at last window update 3774 SND.WND 3775 send window 3777 socket 3778 An address which specifically includes a port identifier, 3779 that is, the concatenation of an Internet Address with a TCP 3780 port. 3782 Source Address 3783 The source address, usually the network and host identifiers. 3785 SYN 3786 A control bit in the incoming segment, occupying one sequence 3787 number, used at the initiation of a connection, to indicate 3788 where the sequence numbering will start. 3790 TCB 3791 Transmission control block, the data structure that records 3792 the state of a connection. 3794 TCB.PRC 3795 The precedence of the connection. 3797 TCP 3798 Transmission Control Protocol: A host-to-host protocol for 3799 reliable communication in internetwork environments. 3801 TOS 3802 Type of Service, an IPv4 field, that currently carries the 3803 Differentiated Services field [6] containing the 3804 Differentiated Services Code Point (DSCP) value and two 3805 unused bits. 3807 Type of Service 3808 An Internet Protocol field which indicates the type of 3809 service for this internet fragment. 3811 URG 3812 A control bit (urgent), occupying no sequence space, used to 3813 indicate that the receiving user should be notified to do 3814 urgent processing as long as there is data to be consumed 3815 with sequence numbers less than the value indicated in the 3816 urgent pointer. 3818 urgent pointer 3819 A control field meaningful only when the URG bit is on. This 3820 field communicates the value of the urgent pointer which 3821 indicates the data octet associated with the sending user's 3822 urgent call. 3824 4. Changes from RFC 793 3826 This document obsoletes RFC 793 as well as RFC 6093 and 6528, which 3827 updated 793. In all cases, only the normative protocol specification 3828 and requirements have been incorporated into this document, and the 3829 informational text with background and rationale has not been carried 3830 in. The informational content of those documents is still valuable 3831 in learning about and understanding TCP, and they are valid 3832 Informational references, even though their normative content has 3833 been incorporated into this document. 3835 The main body of this document was adapted from RFC 793's Section 3, 3836 titled "FUNCTIONAL SPECIFICATION", with an attempt to keep formatting 3837 and layout as close as possible. 3839 The collection of applicable RFC Errata that have been reported and 3840 either accepted or held for an update to RFC 793 were incorporated 3841 (Errata IDs: 573, 574, 700, 701, 1283, 1561, 1562, 1564, 1565, 1571, 3842 1572, 2296, 2297, 2298, 2748, 2749, 2934, 3213, 3300, 3301). Some 3843 errata were not applicable due to other changes (Errata IDs: 572, 3844 575, 1569, 3602). TODO: 3305 3846 Changes to the specification of the Urgent Pointer described in RFC 3847 1122 and 6093 were incorporated. See RFC 6093 for detailed 3848 discussion of why these changes were necessary. 3850 The discussion of the RTO from RFC 793 was updated to refer to RFC 3851 6298. The RFC 1122 text on the RTO originally replaced the 793 text, 3852 however, RFC 2988 should have updated 1122, and has subsequently been 3853 obsoleted by 6298. 3855 RFC 1122 contains a collection of other changes and clarifications to 3856 RFC 793. The normative items impacting the protocol have been 3857 incorporated here, though some historically useful implementation 3858 advice and informative discussion from RFC 1122 is not included here. 3860 RFC 1122 contains more than just TCP requirements, so this document 3861 can't obsolete RFC 1122 entirely. It is only marked as "updating" 3862 1122, however, it should be understood to effectively obsolete all of 3863 the RFC 1122 material on TCP. 3865 The more secure Initial Sequence Number generation algorithm from RFC 3866 6528 was incorporated. See RFC 6528 for discussion of the attacks 3867 that this mitigates, as well as advice on selecting PRF algorithms 3868 and managing secret key data. 3870 A note based on RFC 6429 was added to explicitly clarify that system 3871 resource mangement concerns allow connection resources to be 3872 reclaimed. RFC 6429 is obsoleted in the sense that this 3873 clarification has been reflected in this update to the base TCP 3874 specification now. 3876 RFC EDITOR'S NOTE: the content below is for detailed change tracking 3877 and planning, and not to be included with the final revision of the 3878 document. 3880 This document started as draft-eddy-rfc793bis-00, that was merely a 3881 proposal and rough plan for updating RFC 793. 3883 The -01 revision of this draft-eddy-rfc793bis incorporates the 3884 content of RFC 793 Section 3 titled "FUNCTIONAL SPECIFICATION". 3885 Other content from RFC 793 has not been incorporated. The -01 3886 revision of this document makes some minor formatting changes to the 3887 RFC 793 content in order to convert the content into XML2RFC format 3888 and account for left-out parts of RFC 793. For instance, figure 3889 numbering differs and some indentation is not exactly the same. 3891 The -02 revision of draft-eddy-rfc793bis incorporates errata that 3892 have been verified: 3894 Errata ID 573: Reported by Bob Braden (note: This errata basically 3895 is just a reminder that RFC 1122 updates 793. Some of the 3896 associated changes are left pending to a separate revision that 3897 incorporates 1122. Bob's mention of PUSH in 793 section 2.8 was 3898 not applicable here because that section was not part of the 3899 "functional specification". Also the 1122 text on the 3900 retransmission timeout also has been updated by subsequent RFCs, 3901 so the change here deviates from Bob's suggestion to apply the 3902 1122 text.) 3903 Errata ID 574: Reported by Yin Shuming 3904 Errata ID 700: Reported by Yin Shuming 3905 Errata ID 701: Reported by Yin Shuming 3906 Errata ID 1283: Reported by Pei-chun Cheng 3907 Errata ID 1561: Reported by Constantin Hagemeier 3908 Errata ID 1562: Reported by Constantin Hagemeier 3909 Errata ID 1564: Reported by Constantin Hagemeier 3910 Errata ID 1565: Reported by Constantin Hagemeier 3911 Errata ID 1571: Reported by Constantin Hagemeier 3912 Errata ID 1572: Reported by Constantin Hagemeier 3913 Errata ID 2296: Reported by Vishwas Manral 3914 Errata ID 2297: Reported by Vishwas Manral 3915 Errata ID 2298: Reported by Vishwas Manral 3916 Errata ID 2748: Reported by Mykyta Yevstifeyev 3917 Errata ID 2749: Reported by Mykyta Yevstifeyev 3918 Errata ID 2934: Reported by Constantin Hagemeier 3919 Errata ID 3213: Reported by EugnJun Yi 3920 Errata ID 3300: Reported by Botong Huang 3921 Errata ID 3301: Reported by Botong Huang 3922 Note: Some verified errata were not used in this update, as they 3923 relate to sections of RFC 793 elided from this document. These 3924 include Errata ID 572, 575, and 1569. 3925 Note: Errata ID 3602 was not applied in this revision as it is 3926 duplicative of the 1122 corrections. 3927 There is an errata 3305 currently reported that need to be 3928 verified, held, or rejected by the ADs; it is addressing the same 3929 issue as draft-gont-tcpm-tcp-seq-validation and was not attempted 3930 to be applied to this document. 3932 Not related to RFC 793 content, this revision also makes small tweaks 3933 to the introductory text, fixes indentation of the pseudoheader 3934 diagram, and notes that the Security Considerations should also 3935 include privacy, when this section is written. 3937 The -03 revision of draft-eddy-rfc793bis revises all discussion of 3938 the urgent pointer in order to comply with RFC 6093, 1122, and 1011. 3939 Since 1122 held requirements on the urgent pointer, the full list of 3940 requirements was brought into an appendix of this document, so that 3941 it can be updated as-needed. 3943 The -04 revision of draft-eddy-rfc793bis includes the ISN generation 3944 changes from RFC 6528. 3946 The -05 revision of draft-eddy-rfc793bis incorporates MSS 3947 requirements and definitions from RFC 879, 1122, and 6691, as well as 3948 option-handling requirements from RFC 1122. 3950 The -00 revision of draft-ietf-tcpm-rfc793bis incorporates several 3951 additional clarifications and updates to the section on segmentation, 3952 many of which are based on feedback from Joe Touch improving from the 3953 initial text on this in the previous revision. 3955 The -01 revision incorporates the change to Reserved bits due to ECN, 3956 as well as many other changes that come from RFC 1122. 3958 The -02 revision has small formating modifications in order to 3959 address xml2rfc warnings about long lines. It was a quick update to 3960 avoid document expiration. TCPM working group discussion in 2015 3961 also indicated that that we should not try to add sections on 3962 implementation advice or similar non-normative information. 3964 The -03 revision incorporates more content from RFC 1122: Passive 3965 OPEN Calls, Time-To-Live, Multihoming, IP Options, ICMP messages, 3966 Data Communications, When to Send Data, When to Send a Window Update, 3967 Managing the Window, Probing Zero Windows, When to Send an ACK 3968 Segment. The section on data communications was re-organized into 3969 clearer subsections (previously headings were embedded in the 793 3970 text), and windows management advice from 793 was removed (as 3971 reviewed by TCPM working group) in favor of the 1122 additions on 3972 SWS, ZWP, and related topics. 3974 The -04 revision includes reference to RFC 6429 on the ZWP condition, 3975 RFC1122 material on TCP Connection Failures, TCP Keep-Alives, 3976 Acknowledging Queued Segments, and Remote Address Validation. RTO 3977 computation is referenced from RFC 6298 rather than RFC 1122. 3979 The -05 revision includes the requirement to implement TCP congestion 3980 control with recommendation to implemente ECN, the RFC 6633 update to 3981 1122, which changed the requirement on responding to source quench 3982 ICMP messages, and discussion of ICMP (and ICMPv6) soft and hard 3983 errors per RFC 5461 (ICMPv6 handling for TCP doesn't seem to be 3984 mentioned elsewhere in standards track). 3986 The -06 revision includes an appendix on "Other Implementation Notes" 3987 to capture widely-deployed fundamental features that are not 3988 contained in the RFC series yet. It also added mention of RFC 6994 3989 and the IANA TCP parameters registry as a reference. It includes 3990 references to RFC 5961 in appropriate places. The references to TOS 3991 were changed to DiffServ field, based on reflecting RFC 2474 as well 3992 as the IPv6 presence of traffic class (carrying DiffServ field) 3993 rather than TOS. 3995 TODO list of other planned changes (these can be added to or made 3996 more specific, as the document proceeds): 3998 1. mention 6161 (reducing TIME-WAIT) 3999 2. clarify data on SYN from Michael Welzl 4001 Some other suggested changes that will not be incorporated in this 4002 793 update unless TCPM consensus changes with regard to scope are: 4004 1. look at Tony Sabatini suggestion for describing DO field 4005 2. clearly specify treatment of reserved bits (see TCPM thread on 4006 EDO draft April 25, 2014) -- TODO - an attempt at this is 4007 actually in -06, but needs to be confirmed by TCPM explicitly 4008 since there is no RFC reference 4009 3. per discussion with Joe Touch (TAPS list, 6/20/2015), the 4010 description of the API could be revisited 4012 5. IANA Considerations 4014 This memo includes no request to IANA. Existing IANA registries for 4015 TCP parameters are sufficient. 4017 TODO: check whether entries pointing to 793 and other documents 4018 obsoleted by this one should be updated to point to this one instead. 4020 6. Security and Privacy Considerations 4022 TODO 4024 See RFC 6093 [21] for discussion of security considerations related 4025 to the urgent pointer field. 4027 Editor's Note: Scott Brim mentioned that this should include a 4028 PERPASS/privacy review. 4030 7. Acknowledgements 4032 This document is largely a revision of RFC 793, which Jon Postel was 4033 the editor of. Due to his excellent work, it was able to last for 4034 three decades before we felt the need to revise it. 4036 Andre Oppermann was a contributor and helped to edit the first 4037 revision of this document. 4039 We are thankful for the assistance of the IETF TCPM working group 4040 chairs: 4042 Michael Scharf 4043 Yoshifumi Nishida 4044 Pasi Sarolahti 4046 During early discussion of this work on the TCPM mailing list, and at 4047 the IETF 88 meeting in Vancouver, helpful comments, critiques, and 4048 reviews were received from (listed alphebetically): David Borman, 4049 Yuchung Cheng, Martin Duke, Kevin Lahey, Kevin Mason, Matt Mathis, 4050 Hagen Paul Pfeifer, Anthony Sabatini, Joe Touch, Reji Varghese, Lloyd 4051 Wood, and Alex Zimmermann. Joe Touch provided help in clarifying the 4052 description of segment size parameters and PMTUD/PLPMTUD 4053 recommendations. 4055 This document includes content from errata that were reported by 4056 (listed chronologically): Yin Shuming, Bob Braden, Morris M. Keesan, 4057 Pei-chun Cheng, Constantin Hagemeier, Vishwas Manral, Mykyta 4058 Yevstifeyev, EungJun Yi, Botong Huang. 4060 8. References 4062 8.1. Normative References 4064 [1] Postel, J., "Internet Protocol", STD 5, RFC 791, 4065 DOI 10.17487/RFC0791, September 1981, 4066 . 4068 [2] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, 4069 DOI 10.17487/RFC1191, November 1990, 4070 . 4072 [3] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery 4073 for IP version 6", RFC 1981, DOI 10.17487/RFC1981, August 4074 1996, . 4076 [4] Bradner, S., "Key words for use in RFCs to Indicate 4077 Requirement Levels", BCP 14, RFC 2119, 4078 DOI 10.17487/RFC2119, March 1997, 4079 . 4081 [5] Deering, S. and R. Hinden, "Internet Protocol, Version 6 4082 (IPv6) Specification", RFC 2460, DOI 10.17487/RFC2460, 4083 December 1998, . 4085 [6] Nichols, K., Blake, S., Baker, F., and D. Black, 4086 "Definition of the Differentiated Services Field (DS 4087 Field) in the IPv4 and IPv6 Headers", RFC 2474, 4088 DOI 10.17487/RFC2474, December 1998, 4089 . 4091 [7] Borman, D., Deering, S., and R. Hinden, "IPv6 Jumbograms", 4092 RFC 2675, DOI 10.17487/RFC2675, August 1999, 4093 . 4095 [8] Lahey, K., "TCP Problems with Path MTU Discovery", 4096 RFC 2923, DOI 10.17487/RFC2923, September 2000, 4097 . 4099 [9] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition 4100 of Explicit Congestion Notification (ECN) to IP", 4101 RFC 3168, DOI 10.17487/RFC3168, September 2001, 4102 . 4104 [10] Paxson, V., Allman, M., Chu, J., and M. Sargent, 4105 "Computing TCP's Retransmission Timer", RFC 6298, 4106 DOI 10.17487/RFC6298, June 2011, 4107 . 4109 [11] Gont, F., "Deprecation of ICMP Source Quench Messages", 4110 RFC 6633, DOI 10.17487/RFC6633, May 2012, 4111 . 4113 8.2. Informative References 4115 [12] Postel, J., "Transmission Control Protocol", STD 7, 4116 RFC 793, DOI 10.17487/RFC0793, September 1981, 4117 . 4119 [13] Nagle, J., "Congestion Control in IP/TCP Internetworks", 4120 RFC 896, DOI 10.17487/RFC0896, January 1984, 4121 . 4123 [14] Braden, R., Ed., "Requirements for Internet Hosts - 4124 Communication Layers", STD 3, RFC 1122, 4125 DOI 10.17487/RFC1122, October 1989, 4126 . 4128 [15] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 4129 Discovery", RFC 4821, DOI 10.17487/RFC4821, March 2007, 4130 . 4132 [16] Culley, P., Elzur, U., Recio, R., Bailey, S., and J. 4133 Carrier, "Marker PDU Aligned Framing for TCP 4134 Specification", RFC 5044, DOI 10.17487/RFC5044, October 4135 2007, . 4137 [17] Gont, F., "TCP's Reaction to Soft Errors", RFC 5461, 4138 DOI 10.17487/RFC5461, February 2009, 4139 . 4141 [18] Allman, M., Paxson, V., and E. Blanton, "TCP Congestion 4142 Control", RFC 5681, DOI 10.17487/RFC5681, September 2009, 4143 . 4145 [19] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust 4146 Header Compression (ROHC) Framework", RFC 5795, 4147 DOI 10.17487/RFC5795, March 2010, 4148 . 4150 [20] Ramaiah, A., Stewart, R., and M. Dalal, "Improving TCP's 4151 Robustness to Blind In-Window Attacks", RFC 5961, 4152 DOI 10.17487/RFC5961, August 2010, 4153 . 4155 [21] Gont, F. and A. Yourtchenko, "On the Implementation of the 4156 TCP Urgent Mechanism", RFC 6093, DOI 10.17487/RFC6093, 4157 January 2011, . 4159 [22] Bashyam, M., Jethanandani, M., and A. Ramaiah, "TCP Sender 4160 Clarification for Persist Condition", RFC 6429, 4161 DOI 10.17487/RFC6429, December 2011, 4162 . 4164 [23] Gont, F. and S. Bellovin, "Defending against Sequence 4165 Number Attacks", RFC 6528, DOI 10.17487/RFC6528, February 4166 2012, . 4168 [24] Borman, D., "TCP Options and Maximum Segment Size (MSS)", 4169 RFC 6691, DOI 10.17487/RFC6691, July 2012, 4170 . 4172 [25] Touch, J., "Shared Use of Experimental TCP Options", 4173 RFC 6994, DOI 10.17487/RFC6994, August 2013, 4174 . 4176 [26] Borman, D., Braden, B., Jacobson, V., and R. 4177 Scheffenegger, Ed., "TCP Extensions for High Performance", 4178 RFC 7323, DOI 10.17487/RFC7323, September 2014, 4179 . 4181 [27] Duke, M., Braden, R., Eddy, W., Blanton, E., and A. 4182 Zimmermann, "A Roadmap for Transmission Control Protocol 4183 (TCP) Specification Documents", RFC 7414, 4184 DOI 10.17487/RFC7414, February 2015, 4185 . 4187 [28] Fairhurst, G. and M. Welzl, "The Benefits of Using 4188 Explicit Congestion Notification (ECN)", RFC 8087, 4189 DOI 10.17487/RFC8087, March 2017, 4190 . 4192 [29] IANA, "Transmission Control Protocol (TCP) Parameters, 4193 https://www.iana.org/assignments/tcp-parameters/tcp- 4194 parameters.xhtml", 2017. 4196 Appendix A. Other Implementation Notes 4198 TODO - mention draft-gont-tcpm-tcp-seccomp-prec - per IETF 99 TCPM 4199 discussion 4201 TODO - mention draft-gont-tcpm-tcp-seq-validation - per IETF 99 TCPM 4202 discussion 4203 TODO - mention the draft-minshall Nagle variation that is in Linux - 4204 suggested by Yuchung Cheng 4206 TODO - mention the low watermark function that is in Linux - 4207 suggested by Michael Welzl 4209 Appendix B. TCP Requirement Summary 4211 This section is adapted from RFC 1122. 4213 TODO: this needs to be seriously redone, to use 793bis section 4214 numbers instead of 1122 ones, the RFC1122 heading should be removed, 4215 and all 1122 requirements need to be reflected in 793bis text. 4217 TODO: NOTE that PMTUD+PLPMTUD is not included in this table of 4218 recommendations. 4220 | | | | |S| | 4221 | | | | |H| |F 4222 | | | | |O|M|o 4223 | | |S| |U|U|o 4224 | | |H| |L|S|t 4225 | |M|O| |D|T|n 4226 | |U|U|M| | |o 4227 | |S|L|A|N|N|t 4228 |RFC1122 |T|D|Y|O|O|t 4229 FEATURE |SECTION | | | |T|T|e 4230 -------------------------------------------------|--------|-|-|-|-|-|-- 4231 | | | | | | | 4232 Push flag | | | | | | | 4233 Aggregate or queue un-pushed data |4.2.2.2 | | |x| | | 4234 Sender collapse successive PSH flags |4.2.2.2 | |x| | | | 4235 SEND call can specify PUSH |4.2.2.2 | | |x| | | 4236 If cannot: sender buffer indefinitely |4.2.2.2 | | | | |x| 4237 If cannot: PSH last segment |4.2.2.2 |x| | | | | 4238 Notify receiving ALP of PSH |4.2.2.2 | | |x| | |1 4239 Send max size segment when possible |4.2.2.2 | |x| | | | 4240 | | | | | | | 4241 Window | | | | | | | 4242 Treat as unsigned number |4.2.2.3 |x| | | | | 4243 Handle as 32-bit number |4.2.2.3 | |x| | | | 4244 Shrink window from right |4.2.2.16| | | |x| | 4245 Robust against shrinking window |4.2.2.16|x| | | | | 4246 Receiver's window closed indefinitely |4.2.2.17| | |x| | | 4247 Sender probe zero window |4.2.2.17|x| | | | | 4248 First probe after RTO |4.2.2.17| |x| | | | 4249 Exponential backoff |4.2.2.17| |x| | | | 4251 Allow window stay zero indefinitely |4.2.2.17|x| | | | | 4252 Sender timeout OK conn with zero wind |4.2.2.17| | | | |x| 4253 | | | | | | | 4254 Urgent Data | | | | | | | 4255 Pointer indicates first non-urgent octet |4.2.2.4 |x| | | | | 4256 Arbitrary length urgent data sequence |4.2.2.4 |x| | | | | 4257 Inform ALP asynchronously of urgent data |4.2.2.4 |x| | | | |1 4258 ALP can learn if/how much urgent data Q'd |4.2.2.4 |x| | | | |1 4259 | | | | | | | 4260 TCP Options | | | | | | | 4261 Receive TCP option in any segment |4.2.2.5 |x| | | | | 4262 Ignore unsupported options |4.2.2.5 |x| | | | | 4263 Cope with illegal option length |4.2.2.5 |x| | | | | 4264 Implement sending & receiving MSS option |4.2.2.6 |x| | | | | 4265 IPv4 Send MSS option unless 536 |4.2.2.6 | |x| | | | 4266 IPv6 Send MSS option unless 1220 | N/A | |x| | | | 4267 Send MSS option always |4.2.2.6 | | |x| | | 4268 IPv4 Send-MSS default is 536 |4.2.2.6 |x| | | | | 4269 IPv6 Send-MSS default is 1220 | N/A |x| | | | | 4270 Calculate effective send seg size |4.2.2.6 |x| | | | | 4271 MSS accounts for varying MTU | N/A | |x| | | | 4272 | | | | | | | 4273 TCP Checksums | | | | | | | 4274 Sender compute checksum |4.2.2.7 |x| | | | | 4275 Receiver check checksum |4.2.2.7 |x| | | | | 4276 | | | | | | | 4277 ISN Selection | | | | | | | 4278 Include a clock-driven ISN generator component |4.2.2.9 |x| | | | | 4279 Secure ISN generator with a PRF component | N/A | |x| | | | 4280 | | | | | | | 4281 Opening Connections | | | | | | | 4282 Support simultaneous open attempts |4.2.2.10|x| | | | | 4283 SYN-RECEIVED remembers last state |4.2.2.11|x| | | | | 4284 Passive Open call interfere with others |4.2.2.18| | | | |x| 4285 Function: simultan. LISTENs for same port |4.2.2.18|x| | | | | 4286 Ask IP for src address for SYN if necc. |4.2.3.7 |x| | | | | 4287 Otherwise, use local addr of conn. |4.2.3.7 |x| | | | | 4288 OPEN to broadcast/multicast IP Address |4.2.3.14| | | | |x| 4289 Silently discard seg to bcast/mcast addr |4.2.3.14|x| | | | | 4290 | | | | | | | 4291 Closing Connections | | | | | | | 4292 RST can contain data |4.2.2.12| |x| | | | 4293 Inform application of aborted conn |4.2.2.13|x| | | | | 4294 Half-duplex close connections |4.2.2.13| | |x| | | 4295 Send RST to indicate data lost |4.2.2.13| |x| | | | 4296 In TIME-WAIT state for 2MSL seconds |4.2.2.13|x| | | | | 4297 Accept SYN from TIME-WAIT state |4.2.2.13| | |x| | | 4298 | | | | | | | 4300 Retransmissions | | | | | | | 4301 Jacobson Slow Start algorithm |4.2.2.15|x| | | | | 4302 Jacobson Congestion-Avoidance algorithm |4.2.2.15|x| | | | | 4303 Retransmit with same IP ident |4.2.2.15| | |x| | | 4304 Karn's algorithm |4.2.3.1 |x| | | | | 4305 Jacobson's RTO estimation alg. |4.2.3.1 |x| | | | | 4306 Exponential backoff |4.2.3.1 |x| | | | | 4307 SYN RTO calc same as data |4.2.3.1 | |x| | | | 4308 Recommended initial values and bounds |4.2.3.1 | |x| | | | 4309 | | | | | | | 4310 Generating ACK's: | | | | | | | 4311 Queue out-of-order segments |4.2.2.20| |x| | | | 4312 Process all Q'd before send ACK |4.2.2.20|x| | | | | 4313 Send ACK for out-of-order segment |4.2.2.21| | |x| | | 4314 Delayed ACK's |4.2.3.2 | |x| | | | 4315 Delay < 0.5 seconds |4.2.3.2 |x| | | | | 4316 Every 2nd full-sized segment ACK'd |4.2.3.2 |x| | | | | 4317 Receiver SWS-Avoidance Algorithm |4.2.3.3 |x| | | | | 4318 | | | | | | | 4319 Sending data | | | | | | | 4320 Configurable TTL |4.2.2.19|x| | | | | 4321 Sender SWS-Avoidance Algorithm |4.2.3.4 |x| | | | | 4322 Nagle algorithm |4.2.3.4 | |x| | | | 4323 Application can disable Nagle algorithm |4.2.3.4 |x| | | | | 4324 | | | | | | | 4325 Connection Failures: | | | | | | | 4326 Negative advice to IP on R1 retxs |4.2.3.5 |x| | | | | 4327 Close connection on R2 retxs |4.2.3.5 |x| | | | | 4328 ALP can set R2 |4.2.3.5 |x| | | | |1 4329 Inform ALP of R1<=retxs inform ALP |4.2.3.9 | |x| | | | 4354 Dest. Unreach (0,1,5) => abort conn |4.2.3.9 | | | | |x| 4355 Dest. Unreach (2-4) => abort conn |4.2.3.9 | |x| | | | 4356 Source Quench => silent discard |4.2.3.9 | |x| | | | 4357 Time Exceeded => tell ALP, don't abort |4.2.3.9 | |x| | | | 4358 Param Problem => tell ALP, don't abort |4.2.3.9 | |x| | | | 4359 | | | | | | | 4360 Address Validation | | | | | | | 4361 Reject OPEN call to invalid IP address |4.2.3.10|x| | | | | 4362 Reject SYN from invalid IP address |4.2.3.10|x| | | | | 4363 Silently discard SYN to bcast/mcast addr |4.2.3.10|x| | | | | 4364 | | | | | | | 4365 TCP/ALP Interface Services | | | | | | | 4366 Error Report mechanism |4.2.4.1 |x| | | | | 4367 ALP can disable Error Report Routine |4.2.4.1 | |x| | | | 4368 ALP can specify DiffServ field for sending |4.2.4.2 |x| | | | | 4369 Passed unchanged to IP |4.2.4.2 | |x| | | | 4370 ALP can change DiffServ field during connection|4.2.4.2 | |x| | | | 4371 Pass received DiffServ field up to ALP |4.2.4.2 | | |x| | | 4372 FLUSH call |4.2.4.3 | | |x| | | 4373 Optional local IP addr parm. in OPEN |4.2.4.4 |x| | | | | 4374 -------------------------------------------------|--------|-|-|-|-|-|-- 4376 FOOTNOTES: (1) "ALP" means Application-Layer program. 4378 Author's Address 4380 Wesley M. Eddy (editor) 4381 MTI Systems 4382 US 4384 Email: wes@mti-systems.com