idnits 2.17.1 draft-ietf-tcpm-1323bis-21.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (April 11, 2014) is 3639 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 793 (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 1072 (Obsoleted by RFC 1323, RFC 2018, RFC 6247) -- Obsolete informational reference (is this intentional?): RFC 1185 (Obsoleted by RFC 1323) -- Obsolete informational reference (is this intentional?): RFC 1323 (Obsoleted by RFC 7323) -- Obsolete informational reference (is this intentional?): RFC 1981 (Obsoleted by RFC 8201) -- Obsolete informational reference (is this intentional?): RFC 6528 (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 6691 (Obsoleted by RFC 9293) Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 TCP Maintenance (TCPM) D. Borman 3 Internet-Draft Quantum Corporation 4 Obsoletes: 1323 (if approved) B. Braden 5 Intended status: Standards Track University of Southern 6 Expires: October 13, 2014 California 7 V. Jacobson 8 Google, Inc. 9 R. Scheffenegger, Ed. 10 NetApp, Inc. 11 April 11, 2014 13 TCP Extensions for High Performance 14 draft-ietf-tcpm-1323bis-21 16 Abstract 18 This document specifies a set of TCP extensions to improve 19 performance over paths with a large bandwidth * delay product and to 20 provide reliable operation over very high-speed paths. It defines 21 the TCP Window Scale (WS) option and the TCP Timestamps (TS) option 22 and their semantics. The Window Scale option is used to support 23 larger receive windows, while the Timestamps option can be used for 24 at least two distinct mechanisms, PAWS (Protection Against Wrapped 25 Sequences) and RTTM (Round Trip Time Measurement), that are also 26 described herein. 28 This document obsoletes RFC1323 and describes changes from it. 30 Status of this Memo 32 This Internet-Draft is submitted in full conformance with the 33 provisions of BCP 78 and BCP 79. 35 Internet-Drafts are working documents of the Internet Engineering 36 Task Force (IETF). Note that other groups may also distribute 37 working documents as Internet-Drafts. The list of current Internet- 38 Drafts is at http://datatracker.ietf.org/drafts/current/. 40 Internet-Drafts are draft documents valid for a maximum of six months 41 and may be updated, replaced, or obsoleted by other documents at any 42 time. It is inappropriate to use Internet-Drafts as reference 43 material or to cite them other than as "work in progress." 45 This Internet-Draft will expire on October 13, 2014. 47 Copyright Notice 48 Copyright (c) 2014 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (http://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 64 1.1. TCP Performance . . . . . . . . . . . . . . . . . . . . . 4 65 1.2. TCP Reliability . . . . . . . . . . . . . . . . . . . . . 5 66 1.3. Using TCP options . . . . . . . . . . . . . . . . . . . . 6 67 1.4. Terminology . . . . . . . . . . . . . . . . . . . . . . . 7 68 2. TCP Window Scale option . . . . . . . . . . . . . . . . . . . 8 69 2.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 8 70 2.2. Window Scale option . . . . . . . . . . . . . . . . . . . 8 71 2.3. Using the Window Scale option . . . . . . . . . . . . . . 9 72 2.4. Addressing Window Retraction . . . . . . . . . . . . . . . 10 73 3. TCP Timestamps option . . . . . . . . . . . . . . . . . . . . 12 74 3.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 12 75 3.2. Timestamps option . . . . . . . . . . . . . . . . . . . . 12 76 4. The RTTM Mechanism . . . . . . . . . . . . . . . . . . . . . . 15 77 4.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 15 78 4.2. Updating the RTO value . . . . . . . . . . . . . . . . . . 16 79 4.3. Which Timestamp to Echo . . . . . . . . . . . . . . . . . 16 80 5. PAWS - Protection Against Wrapped Sequence Numbers . . . . . . 20 81 5.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 20 82 5.2. The PAWS Mechanism . . . . . . . . . . . . . . . . . . . . 20 83 5.3. Basic PAWS Algorithm . . . . . . . . . . . . . . . . . . . 21 84 5.4. Timestamp Clock . . . . . . . . . . . . . . . . . . . . . 23 85 5.5. Outdated Timestamps . . . . . . . . . . . . . . . . . . . 25 86 5.6. Header Prediction . . . . . . . . . . . . . . . . . . . . 25 87 5.7. IP Fragmentation . . . . . . . . . . . . . . . . . . . . . 27 88 5.8. Duplicates from Earlier Incarnations of Connection . . . . 27 89 6. Conclusions and Acknowledgments . . . . . . . . . . . . . . . 28 90 7. Security Considerations . . . . . . . . . . . . . . . . . . . 28 91 7.1. Privacy Considerations . . . . . . . . . . . . . . . . . . 30 92 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 30 93 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 30 94 9.1. Normative References . . . . . . . . . . . . . . . . . . . 30 95 9.2. Informative References . . . . . . . . . . . . . . . . . . 31 96 Appendix A. Implementation Suggestions . . . . . . . . . . . . . 34 97 Appendix B. Duplicates from Earlier Connection Incarnations . . . 35 98 B.1. System Crash with Loss of State . . . . . . . . . . . . . 35 99 B.2. Closing and Reopening a Connection . . . . . . . . . . . . 36 100 Appendix C. Summary of Notation . . . . . . . . . . . . . . . . . 37 101 Appendix D. Event Processing Summary . . . . . . . . . . . . . . 38 102 Appendix E. Timestamps Edge Cases . . . . . . . . . . . . . . . . 43 103 Appendix F. Window Retraction Example . . . . . . . . . . . . . . 44 104 Appendix G. RTO calculation modification . . . . . . . . . . . . 45 105 Appendix H. Changes from RFC 1323 . . . . . . . . . . . . . . . . 45 106 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 48 108 1. Introduction 110 The TCP protocol [RFC0793] was designed to operate reliably over 111 almost any transmission medium regardless of transmission rate, 112 delay, corruption, duplication, or reordering of segments. Over the 113 years, advances in networking technology have resulted in ever-higher 114 transmission speeds, and the fastest paths are well beyond the domain 115 for which TCP was originally engineered. 117 This document defines a set of modest extensions to TCP to extend the 118 domain of its application to match the increasing network capability. 119 It is an update to and obsoletes [RFC1323], which in turn is based 120 upon and obsoletes [RFC1072] and [RFC1185]. 122 Changes between [RFC1323] and this document are detailed in 123 Appendix H. These changes are partly due to errata in [RFC1323], and 124 partly due to the improved understanding of how the involved 125 components interact. 127 For brevity, the full discussions of the merits and history behind 128 the TCP options defined within this document have been omitted. 129 [RFC1323] should be consulted for reference. It is recommended that 130 a modern TCP stack implements and make use of the extensions 131 described in this document. 133 1.1. TCP Performance 135 TCP performance problems arise when the bandwidth * delay product is 136 large. A network having such paths is referred to as "long, fat 137 network" (LFN). 139 There are two fundamental performance problems with basic TCP over 140 LFN paths: 142 (1) Window Size Limit 144 The TCP header uses a 16 bit field to report the receive window 145 size to the sender. Therefore, the largest window that can be 146 used is 2^16 = 64 KiB. For LFN paths where the bandwidth * 147 delay product exceeds 64 KiB, the receive window limits the 148 maximum throughput of the TCP connection over the path, i.e., 149 the amount of unacknowledged data that TCP can send in order to 150 keep the pipeline full. 152 To circumvent this problem, Section 2 of this memo defines a TCP 153 option, "Window Scale", to allow windows larger than 2^16. This 154 option defines an implicit scale factor, which is used to 155 multiply the window size value found in a TCP header to obtain 156 the true window size. 158 It must be noted, that the use of large receive windows 159 increases the chance of too quickly wrapping sequence numbers, 160 as described below in Section 1.2, (1). 162 (2) Recovery from Losses 164 Packet losses in an LFN can have a catastrophic effect on 165 throughput. 167 To generalize the Fast Retransmit / Fast Recovery mechanism to 168 handle multiple packets dropped per window, Selective 169 Acknowledgments are required. Unlike the normal cumulative 170 acknowledgments of TCP, Selective Acknowledgments give the 171 sender a complete picture of which segments are queued at the 172 receiver and which have not yet arrived. 174 Selective acknowledgments and their use are specified in 175 separate documents, "TCP Selective Acknowledgment options" 176 [RFC2018], "An Extension to the Selective Acknowledgement (SACK) 177 option for TCP" [RFC2883], and "A Conservative Selective 178 Acknowledgment (SACK)-based Loss Recovery Algorithm for TCP" 179 [RFC6675], and not further discussed in this document. 181 1.2. TCP Reliability 183 An especially serious kind of error may result from an accidental 184 reuse of TCP sequence numbers in data segments. TCP reliability 185 depends upon the existence of a bound on the lifetime of a segment: 186 the "Maximum Segment Lifetime" or MSL. 188 Duplication of sequence numbers might happen in either of two ways: 190 (1) Sequence number wrap-around on the current connection 192 A TCP sequence number contains 32 bits. At a high enough 193 transfer rate of large volumes of data (at least 4 GiB in the 194 same session), the 32-bit sequence space may be "wrapped" 195 (cycled) within the time that a segment is delayed in queues. 197 (2) Earlier incarnation of the connection 199 Suppose that a connection terminates, either by a proper close 200 sequence or due to a host crash, and the same connection (i.e., 201 using the same pair of port numbers) is immediately reopened. A 202 delayed segment from the terminated connection could fall within 203 the current window for the new incarnation and be accepted as 204 valid. 206 Duplicates from earlier incarnations, case (2), are avoided by 207 enforcing the current fixed MSL of the TCP specification, as 208 explained in Section 5.8 and Appendix B. In addition, the 209 randomizing of ephemeral ports can also help to probabilistically 210 reduce the chances of duplicates from earlier connections. However, 211 case (1), avoiding the reuse of sequence numbers within the same 212 connection, requires an upper bound on MSL that depends upon the 213 transfer rate, and at high enough rates, a dedicated mechanism is 214 required. 216 A possible fix for the problem of cycling the sequence space would be 217 to increase the size of the TCP sequence number field. For example, 218 the sequence number field (and also the acknowledgment field) could 219 be expanded to 64 bits. This could be done either by changing the 220 TCP header or by means of an additional option. 222 Section 5 presents a different mechanism, which we call PAWS 223 (Protection Against Wrapped Sequence numbers), to extend TCP 224 reliability to transfer rates well beyond the foreseeable upper limit 225 of network bandwidths. PAWS uses the TCP Timestamps option defined 226 in Section 3.2 to protect against old duplicates from the same 227 connection. 229 1.3. Using TCP options 231 The extensions defined in this document all use TCP options. 233 When [RFC1323] was published, there was concern that some buggy TCP 234 implementation might crash on the first appearance of an option on a 235 non- segment. However, bugs like that can lead to DOS attacks 236 against a TCP. Research has shown that most TCP implementations will 237 properly handle unknown options on non- segments ([Medina04], 238 [Medina05]). But it is still prudent to be conservative in what you 239 send, and avoiding buggy TCP implementation is not the only reason 240 for negotiating TCP options on segments. 242 The window scale option negotiates fundamental parameters of the TCP 243 session. Therefore, it is only sent during the initial handshake. 244 Furthermore, the window scale option will be sent in a 245 segment only if the corresponding option was received in the initial 246 segment. 248 The Timestamps option may appear in any data or segment, adding 249 10 bytes (up to 12 bytes including padding) to the 20-byte TCP 250 header. It is required that this TCP option will be sent on all non- 251 segments after an exchange of options on the segments has 252 indicated that both sides understand this extension. 254 Research has shown that the use of the Timestamps option to take 255 additional RTT samples within each RTT has little effect on the 256 ultimate retransmission timeout value [Allman99]. However, there are 257 other uses of the Timestamps option, such as the Eifel mechanism 258 [RFC3522], [RFC4015], and PAWS (see Section 5) which improve overall 259 TCP security and performance. The extra header bandwidth used by 260 this option should be evaluated for the gains in performance and 261 security in an actual deployment. 263 Appendix A contains a recommended layout of the options in TCP 264 headers to achieve reasonable data field alignment. 266 Finally, we observe that most of the mechanisms defined in this 267 document are important for LFNs and/or very high-speed networks. For 268 low-speed networks, it might be a performance optimization to NOT use 269 these mechanisms. A TCP vendor concerned about optimal performance 270 over low-speed paths might consider turning these extensions off for 271 low- speed paths, or allow a user or installation manager to disable 272 them. 274 1.4. Terminology 276 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 277 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 278 document are to be interpreted as described in [RFC2119]. 280 In this document, these words will appear with that interpretation 281 only when in UPPER CASE. Lower case uses of these words are not to 282 be interpreted as carrying [RFC2119] significance. 284 2. TCP Window Scale option 286 2.1. Introduction 288 The window scale extension expands the definition of the TCP window 289 to 30 bits and then uses an implicit scale factor to carry this 30- 290 bit value in the 16-bit Window field of the TCP header (SEG.WND in 291 [RFC0793]). The exponent of the scale factor is carried in a TCP 292 option, Window Scale. This option is sent only in a segment (a 293 segment with the SYN bit on), hence the window scale is fixed in each 294 direction when a connection is opened. 296 The maximum receive window, and therefore the scale factor, is 297 determined by the maximum receive buffer space. In a typical modern 298 implementation, this maximum buffer space is set by default but can 299 be overridden by a user program before a TCP connection is opened. 300 This determines the scale factor, and therefore no new user interface 301 is needed for window scaling. 303 2.2. Window Scale option 305 The three-byte Window Scale option MAY be sent in a segment by 306 a TCP. It has two purposes: (1) indicate that the TCP is prepared to 307 both send and receive window scaling, and (2) communicate the 308 exponent of a scale factor to be applied to its receive window. 309 Thus, a TCP that is prepared to scale windows SHOULD send the option, 310 even if its own scale factor is 1 and the exponent 0. The scale 311 factor is limited to a power of two and encoded logarithmically, so 312 it may be implemented by binary shift operations. The maximum scale 313 exponent is limited to 14 for a maximum permissible receive window 314 size of 1 GiB (2^(14+16)). 316 TCP Window Scale option (WSopt): 318 Kind: 3 320 Length: 3 bytes 322 +---------+---------+---------+ 323 | Kind=3 |Length=3 |shift.cnt| 324 +---------+---------+---------+ 325 1 1 1 327 This option is an offer, not a promise; both sides MUST send Window 328 Scale options in their segments to enable window scaling in 329 either direction. If window scaling is enabled, then the TCP that 330 sent this option will right-shift its true receive-window values by 331 'shift.cnt' bits for transmission in SEG.WND. The value 'shift.cnt' 332 MAY be zero (offering to scale, while applying a scale factor of 1 to 333 the receive window). 335 This option MAY be sent in an initial segment (i.e., a segment 336 with the SYN bit on and the ACK bit off). If a Window Scale option 337 was received in the initial segment, then this option MAY be 338 sent in the segment. A Window Scale option in a segment 339 without a SYN bit MUST be ignored. 341 The window field in a segment where the SYN bit is set (i.e., a 342 or ) MUST NOT be scaled. 344 2.3. Using the Window Scale option 346 A model implementation of window scaling is as follows, using the 347 notation of [RFC0793]: 349 o The connection state is augmented by two window shift counters, 350 Snd.Wind.Shift and Rcv.Wind.Shift, to be applied to the incoming 351 and outgoing window fields, respectively. 353 o If a TCP receives a segment containing a Window Scale 354 option, it SHOULD send its own Window Scale option in the 355 segment. 357 o The Window Scale option MUST be sent with shift.cnt = R, where R 358 is the value that the TCP would like to use for its receive 359 window. 361 o Upon receiving a segment with a Window Scale option 362 containing shift.cnt = S, a TCP MUST set Snd.Wind.Shift to S and 363 MUST set Rcv.Wind.Shift to R; otherwise, it MUST set both 364 Snd.Wind.Shift and Rcv.Wind.Shift to zero. 366 o The window field (SEG.WND) in the header of every incoming 367 segment, with the exception of segments, MUST be left- 368 shifted by Snd.Wind.Shift bits before updating SND.WND: 370 SND.WND = SEG.WND << Snd.Wind.Shift 372 (assuming the other conditions of [RFC0793] are met, and using the 373 "C" notation "<<" for left-shift). 375 o The window field (SEG.WND) of every outgoing segment, with the 376 exception of segments, MUST be right-shifted by 377 Rcv.Wind.Shift bits: 379 SEG.WND = RCV.WND >> Rcv.Wind.Shift 381 TCP determines if a data segment is "old" or "new" by testing whether 382 its sequence number is within 2^31 bytes of the left edge of the 383 window, and if it is not, discarding the data as "old". To insure 384 that new data is never mistakenly considered old and vice versa, the 385 left edge of the sender's window has to be at most 2^31 away from the 386 right edge of the receiver's window. Similarly with the sender's 387 right edge and receiver's left edge. Since the right and left edges 388 of either the sender's or receiver's window differ by the window 389 size, and since the sender and receiver windows can be out of phase 390 by at most the window size, the above constraints imply that two 391 times the maximum window size must be less than 2^31, or 393 max window < 2^30 395 Since the max window is 2^S (where S is the scaling shift count) 396 times at most 2^16 - 1 (the maximum unscaled window), the maximum 397 window is guaranteed to be < 2^30 if S <= 14. Thus, the shift count 398 MUST be limited to 14 (which allows windows of 2^30 = 1 GiB). If a 399 Window Scale option is received with a shift.cnt value larger than 400 14, the TCP SHOULD log the error but MUST use 14 instead of the 401 specified value. This is safe as a sender can always choose to only 402 partially use any signaled receive window. If the receiver is 403 scaling by a factor larger than 14 and the sender is only scaling by 404 14 then the receive window used by the sender will appear smaller 405 than it is in reality. 407 The scale factor applies only to the Window field as transmitted in 408 the TCP header; each TCP using extended windows will maintain the 409 window values locally as 32-bit numbers. For example, the 410 "congestion window" computed by Slow Start and Congestion Avoidance 411 (see [RFC5681]) is not affected by the scale factor, so window 412 scaling will not introduce quantization into the congestion window. 414 2.4. Addressing Window Retraction 416 When a non-zero scale factor is in use, there are instances when a 417 retracted window can be offered - see Appendix F for a detailed 418 example. The end of the window will be on a boundary based on the 419 granularity of the scale factor being used. If the sequence number 420 is then updated by a number of bytes smaller than that granularity, 421 the TCP will have to either advertise a new window that is beyond 422 what it previously advertised (and perhaps beyond the buffer), or 423 will have to advertise a smaller window, which will cause the TCP 424 window to shrink. Implementations MUST ensure that they handle a 425 shrinking window, as specified in section 4.2.2.16 of [RFC1122]. 427 For the receiver, this implies that: 429 1) The receiver MUST honor, as in-window, any segment that would 430 have been in-window for any sent by the receiver. 432 2) When window scaling is in effect, the receiver SHOULD track the 433 actual maximum window sequence number (which is likely to be 434 greater than the window announced by the most recent , if 435 more than one segment has arrived since the application consumed 436 any data in the receive buffer). 438 On the sender side: 440 3) The initial transmission MUST be within the window announced by 441 the most recent . 443 4) On first retransmission, or if the sequence number is out-of- 444 window by less than 2^Rcv.Wind.Shift then do normal 445 retransmission(s) without regard to receiver window as long as 446 the original segment was in window when it was sent. 448 5) Subsequent retransmissions MAY only be sent, if they are within 449 the window announced by the most recent . 451 3. TCP Timestamps option 453 3.1. Introduction 455 The Timestamps option is introduced to address some of the issues 456 mentioned in Section 1.1 and Section 1.2. The Timestamps option is 457 specified in a symmetrical manner, so that TSval timestamps are 458 carried in both data and segments and are echoed in TSecr 459 fields carried in returning or data segments. Originally used 460 primarily for timestamping individual segments, the properties of the 461 Timestamps option allow not only the use for taking time measurements 462 (Section 4), but additional uses as well (Section 5). 464 It is necessary to remember that there is a distinction between the 465 Timestamps option conveying timestamp information, and the use of 466 that information. In particular, the Round Trip Time Measurement 467 (RTTM) mechanism must be viewed independently from updating the 468 Retransmission Timeout (RTO) (see Section 4.2). In this case, the 469 sample granularity also needs to be taken into account. Other 470 mechanisms, such as PAWS, or Eifel, are not built upon the timestamp 471 information itself, but are based on the intrinsic property of 472 monotonically non-decreasing values. 474 The Timestamps option is important when large receive windows are 475 used, to allow the use of the PAWS mechanism (see Section 5). 476 Furthermore, the option may be useful for all TCPs, since it 477 simplifies the sender and allows the use of additional optimizations 478 such as Eifel ([RFC3522], [RFC4015]) and others ([RFC6817], 479 [Kuzmanovic03], [Kuehlewind10]. 481 3.2. Timestamps option 483 TCP is a symmetric protocol, allowing data to be sent at any time in 484 either direction, and therefore timestamp echoing may occur in either 485 direction. For simplicity and symmetry, we specify that timestamps 486 always be sent and echoed in both directions. For efficiency, we 487 combine the timestamp and timestamp reply fields into a single TCP 488 Timestamps option. 490 TCP Timestamps option (TSopt): 492 Kind: 8 494 Length: 10 bytes 496 +-------+-------+---------------------+---------------------+ 497 |Kind=8 | 10 | TS Value (TSval) |TS Echo Reply (TSecr)| 498 +-------+-------+---------------------+---------------------+ 499 1 1 4 4 501 The Timestamps option carries two four-byte timestamp fields. The 502 Timestamp Value field (TSval) contains the current value of the 503 timestamp clock of the TCP sending the option. 505 The Timestamp Echo Reply (TSecr) field is valid if the ACK bit is set 506 in the TCP header. If the ACK bit is not set in the outgoing TCP 507 header, the sender of that segment SHOULD set the TSecr field to 508 zero. When the ACK bit is set in an outgoing segment, the sender 509 MUST echo a recently received Timestamp Value (TSval) sent by the 510 remote TCP in the TSval field of a Timestamps option. The exact 511 rules on which TSval MUST be echoed are given in Section 4.3. When 512 the ACK bit is not set, the receiver MUST ignore the value of the 513 TSecr field. 515 A TCP MAY send the Timestamps option (TSopt) in an initial 516 segment (i.e., segment containing a SYN bit and no ACK bit), and MAY 517 send a TSopt in only if it received a TSopt in the initial 518 segment for the connection. 520 Once TSopt has been successfully negotiated, that is both , and 521 contain TSopt, the TSopt MUST be sent in every non- 522 segment for the duration of the connection, and SHOULD be sent in an 523 segment (see Section 5.2 for details). The TCP SHOULD remember 524 this state by setting a flag, referred to as Snd.TS.OK, to one. If a 525 non- segment is received without a TSopt, a TCP SHOULD silently 526 drop the segment. A TCP MUST NOT abort a TCP connection because any 527 segment lacks an expected TSopt. 529 Implementations are strongly encouraged to follow the above rules for 530 handling a missing Timestamps option, and the order of precedence 531 mentioned in Section 5.3 when deciding on the acceptance of a 532 segment. 534 If a receiver chooses to accept a segment without an expected 535 Timestamps option, it must be clear that undetectable data corruption 536 may occur. 538 Such a TCP receiver may experience undetectable wrapped- sequence 539 effects, such as data (payload) corruption or session stalls. In 540 order to maintain the integrity of the payload data, in particular on 541 high speed networks, it is paramount to follow the described 542 processing rules. 544 However, it has been mentioned that under some circumstances, the 545 above guidelines are too strict, and some paths sporadically suppress 546 the Timestamps option, while maintaining payload integrity. A path 547 behaving in this manner should be deemed unacceptable, but it has 548 been noted that some implementations relax the acceptance rules as a 549 workaround, and allow TCP to run across such paths [Oppermann13] 551 If a TSopt is received on a connection where TSopt was not negotiated 552 in the initial three-way handshake, the TSopt MUST be ignored and the 553 packet processed normally. 555 In the case of crossing segments where one contains a 556 TSopt and the other doesn't, both sides MAY send a TSopt in the 557 segment. 559 TSopt is required for the two mechanisms described in sections 4 and 560 5. There are also other mechanisms that rely on the presence of the 561 TSopt, e.g. [RFC3522]. If a TCP stopped sending TSopt at any time 562 during an established session, it interferes with these mechanisms. 563 This update to [RFC1323] describes explicitly the previous assumption 564 (see Section 5.2), that each TCP segment must have TSopt, once 565 negotiated. 567 4. The RTTM Mechanism 569 4.1. Introduction 571 One use of the Timestamps option is to measure the round trip time of 572 virtually every packet acknowledged. The Round Trip Time Measurement 573 (RTTM) mechanism requires a Timestamps option in every measured 574 segment, with a TSval that is obtained from a (virtual) "timestamp 575 clock". Values of this clock MUST be at least approximately 576 proportional to real time, in order to measure actual RTT. 578 TCP measures the round trip time (RTT), primarily for the purpose of 579 arriving at a reasonable value for the Retransmission Timeout (RTO) 580 timer interval. Accurate and current RTT estimates are necessary to 581 adapt to changing traffic conditions, while a conservative estimate 582 of the RTO interval is necessary to minimize spurious RTOs. 584 These TSval values are echoed in TSecr values in the reverse 585 direction. The difference between a received TSecr value and the 586 current timestamp clock value provides an RTT measurement. 588 When timestamps are used, every segment that is received will contain 589 a TSecr value. However, these values cannot all be used to update 590 the measured RTT. The following example illustrates why. It shows a 591 one-way data flow with segments arriving in sequence without loss. 592 Here A, B, C... represent data blocks occupying successive blocks of 593 sequence numbers, and ACK(A),... represent the corresponding 594 cumulative acknowledgments. The two timestamp fields of the 595 Timestamps option are shown symbolically as . Each 596 TSecr field contains the value most recently received in a TSval 597 field. 599 TCP A TCP B 601 -----> 603 <---- 605 -----> 607 <---- 609 . . . . . . . . . . . . . . . . . . . . . . 611 ----> 613 <---- 614 (etc.) 616 The dotted line marks a pause (60 time units long) in which A had 617 nothing to send. Note that this pause inflates the RTT which B could 618 infer from receiving TSecr=131 in data segment C. Thus, in one-way 619 data flows, RTTM in the reverse direction measures a value that is 620 inflated by gaps in sending data. However, the following rule 621 prevents a resulting inflation of the measured RTT: 623 RTTM Rule: A TSecr value received in a segment MAY be used to update 624 the averaged RTT measurement only if the segment advances 625 the left edge of the send window, i.e. SND.UNA is 626 increased. 628 Since TCP B is not sending data, the data segment C does not 629 acknowledge any new data when it arrives at B. Thus, the inflated 630 RTTM measurement is not used to update B's RTTM measurement. 632 4.2. Updating the RTO value 634 When [RFC1323] was originally written, it was perceived that taking 635 RTT measurements for each segment, and also during retransmissions, 636 would contribute to reduce spurious RTOs, while maintaining the 637 timeliness of necessary RTOs. At the time, RTO was also the only 638 mechanism to make use of the measured RTT. It has been shown, that 639 taking more RTT samples has only a very limited effect to optimize 640 RTOs [Allman99]. 642 Implementers should note that with timestamps multiple RTTMs can be 643 taken per RTT. The [RFC6298] RTO estimator has weighting factors, 644 alpha and beta, based on an implicit assumption that at most one RTTM 645 will be sampled per RTT. When multiple RTTMs per RTT are available 646 to update the RTO estimator, an implementation SHOULD try to adhere 647 to the spirit of the history specified in [RFC6298]. An 648 implementation suggestion is detailed in Appendix G. 650 [Ludwig00] and [Floyd05] have highlighted the problem that an 651 unmodified RTO calculation, which is updated with per-packet RTT 652 samples, will truncate the path history too soon. This can lead to 653 an increase in spurious retransmissions, when the path properties 654 vary in the order of a few RTTs, but a high number of RTT samples are 655 taken on a much shorter timescale. 657 4.3. Which Timestamp to Echo 659 If more than one Timestamps option is received before a reply segment 660 is sent, the TCP must choose only one of the TSvals to echo, ignoring 661 the others. To minimize the state kept in the receiver (i.e., the 662 number of unprocessed TSvals), the receiver should be required to 663 retain at most one timestamp in the connection control block. 665 There are three situations to consider: 667 (A) Delayed ACKs. 669 Many TCPs acknowledge only every second segment out of a group 670 of segments arriving within a short time interval; this policy 671 is known generally as "delayed ACKs". The data-sender TCP must 672 measure the effective RTT, including the additional time due to 673 delayed ACKs, or else it will retransmit unnecessarily. Thus, 674 when delayed ACKs are in use, the receiver SHOULD reply with the 675 TSval field from the earliest unacknowledged segment. 677 (B) A hole in the sequence space (segment(s) have been lost). 679 The sender will continue sending until the window is filled, and 680 the receiver may be generating s as these out-of-order 681 segments arrive (e.g., to aid "fast retransmit"). 683 The lost segment is probably a sign of congestion, and in that 684 situation the sender should be conservative about 685 retransmission. Furthermore, it is better to overestimate than 686 underestimate the RTT. An for an out-of-order segment 687 SHOULD therefore contain the timestamp from the most recent 688 segment that advanced RCV.NXT. 690 The same situation occurs if segments are re-ordered by the 691 network. 693 (C) A filled hole in the sequence space. 695 The segment that fills the hole and advances the window 696 represents the most recent measurement of the network 697 characteristics. An RTT computed from an earlier segment would 698 probably include the sender's retransmit time-out, badly biasing 699 the sender's average RTT estimate. Thus, the timestamp from the 700 latest segment (which filled the hole) MUST be echoed. 702 An algorithm that covers all three cases is described in the 703 following rules for Timestamps option processing on a synchronized 704 connection: 706 (1) The connection state is augmented with two 32-bit slots: 708 TS.Recent holds a timestamp to be echoed in TSecr whenever a 709 segment is sent, and Last.ACK.sent holds the ACK field from the 710 last segment sent. Last.ACK.sent will equal RCV.NXT except when 711 s have been delayed. 713 (2) If: 715 SEG.TSval >= TS.recent and SEG.SEQ <= Last.ACK.sent 717 then SEG.TSval is copied to TS.Recent; otherwise, it is ignored. 719 (3) When a TSopt is sent, its TSecr field is set to the current 720 TS.Recent value. 722 The following examples illustrate these rules. Here A, B, C... 723 represent data segments occupying successive blocks of sequence 724 numbers, and ACK(A),... represent the corresponding acknowledgment 725 segments. Note that ACK(A) has the same sequence number as B. We 726 show only one direction of timestamp echoing, for clarity. 728 o Segments arrive in sequence, and some of the s are delayed. 730 By case (A), the timestamp from the oldest unacknowledged segment 731 is echoed. 733 TS.Recent 734 -------------------> 735 1 736 -------------------> 737 1 738 -------------------> 739 1 740 <---- 741 (etc) 743 o Segments arrive out of order, and every segment is acknowledged. 745 By case (B), the timestamp from the last segment that advanced the 746 left window edge is echoed, until the missing segment arrives; it 747 is echoed according to Case (C). The same sequence would occur if 748 segments B and D were lost and retransmitted. 750 TS.Recent 751 -------------------> 752 1 753 <---- 754 1 755 -------------------> 756 1 757 <---- 758 1 759 -------------------> 760 2 761 <---- 762 2 763 -------------------> 764 2 765 <---- 766 2 767 -------------------> 768 4 769 <---- 770 (etc) 772 5. PAWS - Protection Against Wrapped Sequence Numbers 774 5.1. Introduction 776 Another use for the Timestamps options is the mechanism to Protect 777 Against Wrapped Sequence numbers (PAWS). Section 5.2 describes a 778 simple mechanism to reject old duplicate segments that might corrupt 779 an open TCP connection. PAWS operates within a single TCP 780 connection, using state that is saved in the connection control 781 block. Section 5.8 and Appendix H discuss the implications of the 782 PAWS mechanism for avoiding old duplicates from previous incarnations 783 of the same connection. 785 5.2. The PAWS Mechanism 787 PAWS uses the TCP Timestamps option described earlier, and assumes 788 that every received TCP segment (including data and segments) 789 contains a timestamp SEG.TSval whose values are monotonically non- 790 decreasing in time. The basic idea is that a segment can be 791 discarded as an old duplicate if it is received with a timestamp 792 SEG.TSval less than some timestamp recently received on this 793 connection. 795 In the PAWS mechanism, the "timestamps" are 32-bit unsigned integers 796 in a modular 32-bit space. Thus, "less than" is defined the same way 797 it is for TCP sequence numbers, and the same implementation 798 techniques apply. If s and t are timestamp values, 800 s < t if 0 < (t - s) < 2^31, 802 computed in unsigned 32-bit arithmetic. 804 The choice of incoming timestamps to be saved for this comparison 805 MUST guarantee a value that is monotonically non-decreasing. For 806 example, an implementation might save the timestamp from the segment 807 that last advanced the left edge of the receive window, i.e., the 808 most recent in-sequence segment. For simplicity, the value TS.Recent 809 introduced in Section 4.3 is used instead, as using a common value 810 for both PAWS and RTTM simplifies the implementation. As Section 4.3 811 explained, TS.Recent differs from the timestamp from the last in- 812 sequence segment only in the case of delayed s, and therefore by 813 less than one window. Either choice will therefore protect against 814 sequence number wrap-around. 816 PAWS submits all incoming segments to the same test, and therefore 817 protects against duplicate segments as well as data segments. 818 (An alternative non-symmetric algorithm would protect against old 819 duplicate s: the sender of data would reject incoming 820 segments whose TSecr values were less than the TSecr saved from the 821 last segment whose ACK field advanced the left edge of the send 822 window. This algorithm was deemed to lack economy of mechanism and 823 symmetry.) 825 TSval timestamps sent on and segments are used to 826 initialize PAWS. PAWS protects against old duplicate non- 827 segments, and duplicate segments received while there is a 828 synchronized connection. Duplicate and segments 829 received when there is no connection will be discarded by the normal 830 3-way handshake and sequence number checks of TCP. 832 [RFC1323] recommended that segments NOT carry timestamps, and 833 that they be acceptable regardless of their timestamp. At that time, 834 the thinking was that old duplicate segments should be 835 exceedingly unlikely, and their cleanup function should take 836 precedence over timestamps. More recently, discussions about various 837 blind attacks on TCP connections have raised the suggestion that if 838 the Timestamps option is present, SEG.TSecr could be used to provide 839 stricter acceptance tests for segments. 841 While still under discussion, to enable research into this area it is 842 now RECOMMENDED that when generating an , that if the segment 843 causing the to be generated contained a Timestamps option, that 844 the also contain a Timestamps option. In the segment, 845 SEG.TSecr SHOULD be set to SEG.TSval from the incoming segment and 846 SEG.TSval SHOULD be set to zero. If an is being generated 847 because of a user abort, and Snd.TS.OK is set, then a Timestamps 848 option SHOULD be included in the . When an segment is 849 received, it MUST NOT be subjected to the PAWS check by verifying an 850 acceptable value in SEG.TSval, and information from the Timestamps 851 option MUST NOT be used to update connection state information. 852 SEG.TSecr MAY be used to provide stricter acceptance checks. 854 5.3. Basic PAWS Algorithm 856 If the PAWS algorithm is used, the following processing MUST be 857 performed on all incoming segments for a synchronized connection. 858 Also, PAWS processing MUST take precedence over the regular TCP 859 acceptabiltiy check (Section 3.3 in [RFC0793]), which is performed 860 after verification of the received Timestamps option: 862 R1) If there is a Timestamps option in the arriving segment, 863 SEG.TSval < TS.Recent, TS.Recent is valid (see later discussion) 864 and the RST bit is not set, then treat the arriving segment as 865 not acceptable: 867 Send an acknowledgment in reply as specified in [RFC0793] 868 page 69 and drop the segment. 870 Note: it is necessary to send an segment in order to 871 retain TCP's mechanisms for detecting and recovering from 872 half- open connections. For example, see Figure 10 of 873 [RFC0793]. 875 R2) If the segment is outside the window, reject it (normal TCP 876 processing) 878 R3) If an arriving segment satisfies: SEG.SEQ <= Last.ACK.sent (see 879 Section 4.3), then record its timestamp in TS.Recent. 881 R4) If an arriving segment is in-sequence (i.e., at the left window 882 edge), then accept it normally. 884 R5) Otherwise, treat the segment as a normal in-window, out-of- 885 sequence TCP segment (e.g., queue it for later delivery to the 886 user). 888 Steps R2, R4, and R5 are the normal TCP processing steps specified by 889 [RFC0793]. 891 It is important to note that the timestamp MUST be checked only when 892 a segment first arrives at the receiver, regardless of whether it is 893 in- sequence or it must be queued for later delivery. 895 Consider the following example. 897 Suppose the segment sequence: A.1, B.1, C.1, ..., Z.1 has been 898 sent, where the letter indicates the sequence number and the digit 899 represents the timestamp. Suppose also that segment B.1 has been 900 lost. The timestamp in TS.Recent is 1 (from A.1), so C.1, ..., 901 Z.1 are considered acceptable and are queued. When B is 902 retransmitted as segment B.2 (using the latest timestamp), it 903 fills the hole and causes all the segments through Z to be 904 acknowledged and passed to the user. The timestamps of the queued 905 segments are *not* inspected again at this time, since they have 906 already been accepted. When B.2 is accepted, TS.Recent is set to 907 2. 909 This rule allows reasonable performance under loss. A full window of 910 data is in transit at all times, and after a loss a full window less 911 one segment will show up out-of-sequence to be queued at the receiver 912 (e.g., up to ~2^30 bytes of data); the Timestamps option must not 913 result in discarding this data. 915 In certain unlikely circumstances, the algorithm of rules R1-R5 could 916 lead to discarding some segments unnecessarily, as shown in the 917 following example: 919 Suppose again that segments: A.1, B.1, C.1, ..., Z.1 have been 920 sent in sequence and that segment B.1 has been lost. Furthermore, 921 suppose delivery of some of C.1, ... Z.1 is delayed until *after* 922 the retransmission B.2 arrives at the receiver. These delayed 923 segments will be discarded unnecessarily when they do arrive, 924 since their timestamps are now out of date. 926 This case is very unlikely to occur. If the retransmission was 927 triggered by a timeout, some of the segments C.1, ... Z.1 must have 928 been delayed longer than the RTO time. This is presumably an 929 unlikely event, or there would be many spurious timeouts and 930 retransmissions. If B's retransmission was triggered by the "fast 931 retransmit" algorithm, i.e., by duplicate s, then the queued 932 segments that caused these s must have been received already. 934 Even if a segment were delayed past the RTO, the Fast Retransmit 935 mechanism [Jacobson90c] will cause the delayed segments to be 936 retransmitted at the same time as B.2, avoiding an extra RTT and 937 therefore causing a very small performance penalty. 939 We know of no case with a significant probability of occurrence in 940 which timestamps will cause performance degradation by unnecessarily 941 discarding segments. 943 5.4. Timestamp Clock 945 It is important to understand that the PAWS algorithm does not 946 require clock synchronization between sender and receiver. The 947 sender's timestamp clock is used as a source of monotonic non- 948 decreasing values to stamp the segments. The receiver treats the 949 timestamp value as simply a monotonically non-decreasing serial 950 number, without any connection to time. From the receiver's 951 viewpoint, the timestamp is acting as a logical extension of the 952 high-order bits of the sequence number. 954 The receiver algorithm does place some requirements on the frequency 955 of the timestamp clock. 957 (a) The timestamp clock must not be "too slow". 959 It MUST tick at least once for each 2^31 bytes sent. In fact, 960 in order to be useful to the sender for round trip timing, the 961 clock SHOULD tick at least once per window's worth of data, and 962 even with the window extension defined in Section 2.2, 2^31 963 bytes must be at least two windows. 965 To make this more quantitative, any clock faster than 1 tick/sec 966 will reject old duplicate segments for link speeds of ~8 Gbps. 967 A 1 ms timestamp clock will work at link speeds up to 8 Tbps 968 (8*10^12) bps! 970 (b) The timestamp clock must not be "too fast". 972 The recycling time of the timestamp clock MUST be greater than 973 MSL seconds. Since the clock (timestamp) is 32 bits and the 974 worst-case MSL is 255 seconds, the maximum acceptable clock 975 frequency is one tick every 59 ns. 977 However, it is desirable to establish a much longer recycle 978 period, in order to handle outdated timestamps on idle 979 connections (see Section 5.5), and to relax the MSL requirement 980 for preventing sequence number wrap-around. With a 1 ms 981 timestamp clock, the 32-bit timestamp will wrap its sign bit in 982 24.8 days. Thus, it will reject old duplicates on the same 983 connection if MSL is 24.8 days or less. This appears to be a 984 very safe figure; an MSL of 24.8 days or longer can probably be 985 assumed in the Internet without requiring precise MSL 986 enforcement. 988 Based upon these considerations, we choose a timestamp clock 989 frequency in the range 1 ms to 1 sec per tick. This range also 990 matches the requirements of the RTTM mechanism, which does not need 991 much more resolution than the granularity of the retransmit timer, 992 e.g., tens or hundreds of milliseconds. 994 The PAWS mechanism also puts a strong monotonicity requirement on the 995 sender's timestamp clock. The method of implementation of the 996 timestamp clock to meet this requirement depends upon the system 997 hardware and software. 999 o Some hosts have a hardware clock that is guaranteed to be 1000 monotonic between hardware resets. 1002 o A clock interrupt may be used to simply increment a binary integer 1003 by 1 periodically. 1005 o The timestamp clock may be derived from a system clock that is 1006 subject to being abruptly changed, by adding a variable offset 1007 value. This offset is initialized to zero. When a new timestamp 1008 clock value is needed, the offset can be adjusted as necessary to 1009 make the new value equal to or larger than the previous value 1010 (which was saved for this purpose). 1012 o A random offset may be added to the timestamp clock on a per 1013 connection basis. See [RFC6528], section 3, on randomizing the 1014 initial sequence number (ISN). The same function with a different 1015 secret key can be used to generate the per connection timestamp 1016 offset. 1018 5.5. Outdated Timestamps 1020 If a connection remains idle long enough for the timestamp clock of 1021 the other TCP to wrap its sign bit, then the value saved in TS.Recent 1022 will become too old; as a result, the PAWS mechanism will cause all 1023 subsequent segments to be rejected, freezing the connection (until 1024 the timestamp clock wraps its sign bit again). 1026 With the chosen range of timestamp clock frequencies (1 sec to 1 ms), 1027 the time to wrap the sign bit will be between 24.8 days and 24800 1028 days. A TCP connection that is idle for more than 24 days and then 1029 comes to life is exceedingly unusual. However, it is undesirable in 1030 principle to place any limitation on TCP connection lifetimes. 1032 We therefore require that an implementation of PAWS include a 1033 mechanism to "invalidate" the TS.Recent value when a connection is 1034 idle for more than 24 days. (An alternative solution to the problem 1035 of outdated timestamps would be to send keep-alive segments at a very 1036 low rate, but still more often than the wrap-around time for 1037 timestamps, e.g., once a day. This would impose negligible overhead. 1038 However, the TCP specification has never included keep-alives, so the 1039 solution based upon invalidation was chosen.) 1041 Note that a TCP does not know the frequency, and therefore, the 1042 wraparound time, of the other TCP, so it must assume the worst. The 1043 validity of TS.Recent needs to be checked only if the basic PAWS 1044 timestamp check fails, i.e., only if SEG.TSval < TS.Recent. If 1045 TS.Recent is found to be invalid, then the segment is accepted, 1046 regardless of the failure of the timestamp check, and rule R3 updates 1047 TS.Recent with the TSval from the new segment. 1049 To detect how long the connection has been idle, the TCP MAY update a 1050 clock or timestamp value associated with the connection whenever 1051 TS.Recent is updated, for example. The details will be 1052 implementation-dependent. 1054 5.6. Header Prediction 1056 "Header prediction" [Jacobson90a] is a high-performance transport 1057 protocol implementation technique that is most important for high- 1058 speed links. This technique optimizes the code for the most common 1059 case, receiving a segment correctly and in order. Using header 1060 prediction, the receiver asks the question, "Is this segment the next 1061 in sequence?" This question can be answered in fewer machine 1062 instructions than the question, "Is this segment within the window?" 1064 Adding header prediction to our timestamp procedure leads to the 1065 following recommended sequence for processing an arriving TCP 1066 segment: 1068 H1) Check timestamp (same as step R1 above) 1070 H2) Do header prediction: if segment is next in sequence and if 1071 there are no special conditions requiring additional processing, 1072 accept the segment, record its timestamp, and skip H3. 1074 H3) Process the segment normally, as specified in RFC 793. This 1075 includes dropping segments that are outside the window and 1076 possibly sending acknowledgments, and queuing in-window, out-of- 1077 sequence segments. 1079 Another possibility would be to interchange steps H1 and H2, i.e., to 1080 perform the header prediction step H2 *first*, and perform H1 and H3 1081 only when header prediction fails. This could be a performance 1082 improvement, since the timestamp check in step H1 is very unlikely to 1083 fail, and it requires unsigned modulo arithmetic. To perform this 1084 check on every single segment is contrary to the philosophy of header 1085 prediction. We believe that this change might produce a measurable 1086 reduction in CPU time for TCP protocol processing on high-speed 1087 networks. 1089 However, putting H2 first would create a hazard: a segment from 2^32 1090 bytes in the past might arrive at exactly the wrong time and be 1091 accepted mistakenly by the header-prediction step. The following 1092 reasoning has been introduced in [RFC1185] to show that the 1093 probability of this failure is negligible. 1095 If all segments are equally likely to show up as old duplicates, 1096 then the probability of an old duplicate exactly matching the left 1097 window edge is the maximum segment size (MSS) divided by the size 1098 of the sequence space. This ratio must be less than 2^-16, since 1099 MSS must be < 2^16; for example, it will be (2^12)/(2^32) = 2^-20 1100 for a 100 Mbit/s link. However, the older a segment is, the less 1101 likely it is to be retained in the Internet, and under any 1102 reasonable model of segment lifetime the probability of an old 1103 duplicate exactly at the left window edge must be much smaller 1104 than 2^-16. 1106 The 16 bit TCP checksum also allows a basic unreliability of one 1107 part in 2^16. A protocol mechanism whose reliability exceeds the 1108 reliability of the TCP checksum should be considered "good 1109 enough", i.e., it won't contribute significantly to the overall 1110 error rate. We therefore believe we can ignore the problem of an 1111 old duplicate being accepted by doing header prediction before 1112 checking the timestamp. 1114 However, this probabilistic argument is not universally accepted, and 1115 the consensus at present is that the performance gain does not 1116 justify the hazard in the general case. It is therefore recommended 1117 that H2 follow H1. 1119 5.7. IP Fragmentation 1121 At high data rates, the protection against old segments provided by 1122 PAWS can be circumvented by errors in IP fragment reassembly (see 1123 [RFC4963]). The only way to protect against incorrect IP fragment 1124 reassembly is to not allow the segments to be fragmented. This is 1125 done by setting the Don't Fragment (DF) bit in the IP header. 1126 Setting the DF bit implies the use of Path MTU Discovery as described 1127 in [RFC1191], [RFC1981], and [RFC4821], thus any TCP implementation 1128 that implements PAWS MUST also implement Path MTU Discovery. 1130 5.8. Duplicates from Earlier Incarnations of Connection 1132 The PAWS mechanism protects against errors due to sequence number 1133 wrap-around on high-speed connections. Segments from an earlier 1134 incarnation of the same connection are also a potential cause of old 1135 duplicate errors. In both cases, the TCP mechanisms to prevent such 1136 errors depend upon the enforcement of a maximum segment lifetime 1137 (MSL) by the Internet (IP) layer (see Appendix of RFC 1185 for a 1138 detailed discussion). Unlike the case of sequence space wrap-around, 1139 the MSL required to prevent old duplicate errors from earlier 1140 incarnations does not depend upon the transfer rate. If the IP layer 1141 enforces the recommended 2 minute MSL of TCP, and if the TCP rules 1142 are followed, TCP connections will be safe from earlier incarnations, 1143 no matter how high the network speed. Thus, the PAWS mechanism is 1144 not required for this case. 1146 We may still ask whether the PAWS mechanism can provide additional 1147 security against old duplicates from earlier connections, allowing us 1148 to relax the enforcement of MSL by the IP layer. Appendix B explores 1149 this question, showing that further assumptions and/or mechanisms are 1150 required, beyond those of PAWS. This is not part of the current 1151 extension. 1153 6. Conclusions and Acknowledgments 1155 This memo presented a set of extensions to TCP to provide efficient 1156 operation over large bandwidth * delay product paths and reliable 1157 operation over very high-speed paths. These extensions are designed 1158 to provide compatible interworking with TCP stacks that do not 1159 implement the extensions. 1161 These mechanisms are implemented using TCP options for scaled windows 1162 and timestamps. The timestamps are used for two distinct mechanisms: 1163 RTTM (Round Trip Time Measurement) and PAWS (Protection Against 1164 Wrapped Sequences). 1166 The Window Scale option was originally suggested by Mike St. Johns of 1167 USAF/DCA. The present form of the option was suggested by Mike 1168 Karels of UC Berkeley in response to a more cumbersome scheme defined 1169 by Van Jacobson. Lixia Zhang helped formulate the PAWS mechanism 1170 description in [RFC1185]. 1172 Finally, much of this work originated as the result of discussions 1173 within the End-to-End Task Force on the theoretical limitations of 1174 transport protocols in general and TCP in particular. Task force 1175 members and other on the end2end-interest list have made valuable 1176 contributions by pointing out flaws in the algorithms and the 1177 documentation. Continued discussion and development since the 1178 publication of [RFC1323] originally occurred in the IETF TCP Large 1179 Windows Working Group, later on in the End-to-End Task Force, and 1180 most recently in the IETF TCP Maintenance Working Group. The authors 1181 are grateful for all these contributions. 1183 7. Security Considerations 1185 The TCP sequence space is a fixed size, and as the window becomes 1186 larger it becomes easier for an attacker to generate forged packets 1187 that can fall within the TCP window, and be accepted as valid 1188 segments. While use of timestamps and PAWS can help to mitigate 1189 this, when using PAWS, if an attacker is able to forge a packet that 1190 is acceptable to the TCP connection, a timestamp that is in the 1191 future would cause valid segments to be dropped due to PAWS checks. 1192 Hence, implementers should take care to not open the TCP window 1193 drastically beyond the requirements of the connection. 1195 See [RFC5961] for mitigation strategies to blind in-window attacks. 1197 A naive implementation that derives the timestamp clock value 1198 directly from a system uptime clock may unintentionally leak this 1199 information to an attacker. This does not directly compromise any of 1200 the mechanisms described in this document. However, this may be 1201 valuable information to a potential attacker. It is therefore 1202 RECOMMENDED to generate a random, per-connection offset to be used 1203 with the clock source when generating the Timestamps option value 1204 (see Section 5.4). By carefully choosing this random offset, further 1205 improvements as described in [RFC6191] are possible. 1207 Expanding the TCP window beyond 64 KiB for IPv6 allows Jumbograms 1208 [RFC2675] to be used when the local network supports packets larger 1209 than 64 KiB. When larger TCP segments are used, the TCP checksum 1210 becomes weaker. 1212 Mechanisms to protect the TCP header from modification should also 1213 protect the TCP options. 1215 Middleboxes and TCP options: 1217 Some middleboxes have been known to remove the TCP options 1218 described in this document from TCP segments [Honda11]. 1219 Middleboxes that remove TCP options described in this document 1220 from the segment interfere with the selection of parameters 1221 appropriate for the session. Removing any of these options in a 1222 segment will leave the end hosts in a state that 1223 destroys the proper operation of the protocol. 1225 * If a Window Scale option is removed from a segment, 1226 the end hosts will not negotiate the window scaling factor 1227 correctly. Middleboxes must not remove or modify the Window 1228 Scale option from segments. 1230 * If a stateful firewall uses the window field to detect whether 1231 a received segment is inside the current window, and does not 1232 support the Window Scale option, it will not be able to 1233 correctly determine whether or not a packet is in the window. 1234 These middle boxes must also support the Window Scale option 1235 and apply the scale factor when processing segments. If the 1236 window scale factor cannot be determined, it must not do window 1237 based processing. 1239 * If the Timestamps option is removed from the or 1240 segment, high speed connections that need PAWS would not have 1241 that protection. Successful negotiation of Timestamps option 1242 enforces a stricter verification of incoming segments at the 1243 receiver. If the Timestamps option was removed from a 1244 subsequent data segment after a successful negotiation (e.g. as 1245 part of re-segmentation), the segment is discarded by the 1246 receiver without further processing. Middleboxes should not 1247 remove the Timestamps option. 1249 * It must be noted that [RFC1323] doesn't address the case of the 1250 Timestamps option being dropped or selectively omitted after 1251 being negotiated, and that the update in this document may 1252 cause some broken middlebox behavior to be detected 1253 (potentially unresponsive TCP sessions). 1255 Implementations that depend on PAWS could provide a mechanism for the 1256 application to determine whether or not PAWS is in use on the 1257 connection, and chose to terminate the connection if that protection 1258 doesn't exist. This is not just to protect the connection against 1259 middleboxes that might remove the Timestamps option, but also against 1260 remote hosts that do not have Timestamp support. 1262 7.1. Privacy Considerations 1264 The TCP options described in this document do not expose individual 1265 users data. However, a naive implementation simply using the system 1266 clock as source for the Timestamps option will reveal characteristics 1267 of the TCP potentially allowing more targeted attacks. It is 1268 therefore RECOMMENDED to generate a random, per-connection offset to 1269 be used with the clock source when generating the Timestamps option 1270 value (see Section 5.4). 1272 Furthermore, the combination, relative ordering and padding of the 1273 TCP options described in Section 2.2 and Section 3.2 will reveal 1274 additional clues to allow the fingerprinting of the system. 1276 8. IANA Considerations 1278 The described TCP options are well known from the superceded 1279 [RFC1323]. IANA is requested to update the "TCP Option Kind Numbers" 1280 table under "TCP parameters" to list as the 1281 reference for the options "WSopt - Window Scale Option" and "TSopt - 1282 Timestamps Option". 1284 9. References 1286 9.1. Normative References 1288 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 1289 RFC 793, September 1981. 1291 [RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, 1292 November 1990. 1294 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1295 Requirement Levels", BCP 14, RFC 2119, March 1997. 1297 9.2. Informative References 1299 [Allman99] 1300 Allman, M. and V. Paxson, "On Estimating End-to-End 1301 Network Path Properties", Proc. ACM SIGCOMM Technical 1302 Symposium, Cambridge, MA, September 1999, 1303 . 1305 [Floyd05] Floyd, S., "[tcpm] How the RTO should be estimated with 1306 timestamps", Message from 26.Jan.2007 to the tcpm mailing 1307 list, August 2005, . 1310 [Garlick77] 1311 Garlick, L., Rom, R., and J. Postel, "Issues in Reliable 1312 Host-to-Host Protocols", Proc. Second Berkeley Workshop on 1313 Distributed Data Management and Computer Networks, 1314 May 1977, . 1316 [Honda11] Honda, M., Nishida, Y., Raiciu, C., Greenhalgh, A., 1317 Handley, M., and H. Tokuda, "Is it still possible to 1318 extend TCP?", Proc. of ACM Internet Measurement 1319 Conference (IMC) '11, November 2011. 1321 [Jacobson88a] 1322 Jacobson, V., "Congestion Avoidance and Control", SIGCOMM 1323 '88, Stanford, CA., August 1988, 1324 . 1326 [Jacobson90a] 1327 Jacobson, V., "4BSD Header Prediction", ACM Computer 1328 Communication Review, April 1990. 1330 [Jacobson90c] 1331 Jacobson, V., "Modified TCP congestion avoidance 1332 algorithm", Message to the end2end-interest mailing list, 1333 April 1990, 1334 . 1336 [Karn87] Karn, P. and C. Partridge, "Estimating Round-Trip Times in 1337 Reliable Transport Protocols", Proc. SIGCOMM '87, 1338 August 1987. 1340 [Kuehlewind10] 1341 Kuehlewind, M. and B. Briscoe, "Chirping for Congestion 1342 Control - Implementation Feasibility", November 2010, 1343 . 1345 [Kuzmanovic03] 1346 Kuzmanovic, A. and E. Knightly, "TCP-LP: Low-Priority 1347 Service via End-Point Congestion Control", 2003, 1348 . 1350 [Ludwig00] 1351 Ludwig, R. and K. Sklower, "The Eifel Retransmission 1352 Timer", ACM SIGCOMM Computer Communication Review Volume 1353 30 Issue 3, July 2000, . 1356 [Martin03] 1357 Martin, D., "[Tsvwg] RFC 1323.bis", Message to the tsvwg 1358 mailing list, September 2003, . 1361 [Medina04] 1362 Medina, A., Allman, M., and S. Floyd, "Measuring 1363 Interactions Between Transport Protocols and Middleboxes", 1364 Proc. ACM SIGCOMM/USENIX Internet Measurement Conference. 1365 October 2004, August 2004, 1366 . 1368 [Medina05] 1369 Medina, A., Allman, M., and S. Floyd, "Measuring the 1370 Evolution of Transport Protocols in the Internet", ACM 1371 Computer Communication Review 35(2), April 2005, 1372 . 1374 [Oppermann13] 1375 Oppermann, A., "[tcpm] Explanation to the relaxation of 1376 TSopt acceptance rules", Message to the tcpm mailing list, 1377 Jun 2013, . 1380 [RFC1072] Jacobson, V. and R. Braden, "TCP extensions for long-delay 1381 paths", RFC 1072, October 1988. 1383 [RFC1122] Braden, R., "Requirements for Internet Hosts - 1384 Communication Layers", STD 3, RFC 1122, October 1989. 1386 [RFC1185] Jacobson, V., Braden, B., and L. Zhang, "TCP Extension for 1387 High-Speed Paths", RFC 1185, October 1990. 1389 [RFC1323] Jacobson, V., Braden, B., and D. Borman, "TCP Extensions 1390 for High Performance", RFC 1323, May 1992. 1392 [RFC1981] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery 1393 for IP version 6", RFC 1981, August 1996. 1395 [RFC2018] Mathis, M., Mahdavi, J., Floyd, S., and A. Romanow, "TCP 1396 Selective Acknowledgment Options", RFC 2018, October 1996. 1398 [RFC2675] Borman, D., Deering, S., and R. Hinden, "IPv6 Jumbograms", 1399 RFC 2675, August 1999. 1401 [RFC2883] Floyd, S., Mahdavi, J., Mathis, M., and M. Podolsky, "An 1402 Extension to the Selective Acknowledgement (SACK) Option 1403 for TCP", RFC 2883, July 2000. 1405 [RFC3522] Ludwig, R. and M. Meyer, "The Eifel Detection Algorithm 1406 for TCP", RFC 3522, April 2003. 1408 [RFC4015] Ludwig, R. and A. Gurtov, "The Eifel Response Algorithm 1409 for TCP", RFC 4015, February 2005. 1411 [RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 1412 Discovery", RFC 4821, March 2007. 1414 [RFC4963] Heffner, J., Mathis, M., and B. Chandler, "IPv4 Reassembly 1415 Errors at High Data Rates", RFC 4963, July 2007. 1417 [RFC5681] Allman, M., Paxson, V., and E. Blanton, "TCP Congestion 1418 Control", RFC 5681, September 2009. 1420 [RFC5961] Ramaiah, A., Stewart, R., and M. Dalal, "Improving TCP's 1421 Robustness to Blind In-Window Attacks", RFC 5961, 1422 August 2010. 1424 [RFC6191] Gont, F., "Reducing the TIME-WAIT State Using TCP 1425 Timestamps", BCP 159, RFC 6191, April 2011. 1427 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 1428 "Computing TCP's Retransmission Timer", RFC 6298, 1429 June 2011. 1431 [RFC6528] Gont, F. and S. Bellovin, "Defending against Sequence 1432 Number Attacks", RFC 6528, February 2012. 1434 [RFC6675] Blanton, E., Allman, M., Wang, L., Jarvinen, I., Kojo, M., 1435 and Y. Nishida, "A Conservative Loss Recovery Algorithm 1436 Based on Selective Acknowledgment (SACK) for TCP", 1437 RFC 6675, August 2012. 1439 [RFC6691] Borman, D., "TCP Options and Maximum Segment Size (MSS)", 1440 RFC 6691, July 2012. 1442 [RFC6817] Shalunov, S., Hazel, G., Iyengar, J., and M. Kuehlewind, 1443 "Low Extra Delay Background Transport (LEDBAT)", RFC 6817, 1444 December 2012. 1446 Appendix A. Implementation Suggestions 1448 TCP Option Layout 1450 The following layout is recommended for sending options on non- 1451 segments, to achieve maximum feasible alignment of 32-bit 1452 and 64-bit machines. 1454 +--------+--------+--------+--------+ 1455 | NOP | NOP | TSopt | 10 | 1456 +--------+--------+--------+--------+ 1457 | TSval timestamp | 1458 +--------+--------+--------+--------+ 1459 | TSecr timestamp | 1460 +--------+--------+--------+--------+ 1462 Interaction with the TCP Urgent Pointer 1464 The TCP Urgent pointer, like the TCP window, is a 16 bit value. 1465 Some of the original discussion for the TCP Window Scale option 1466 included proposals to increase the Urgent pointer to 32 bits. As 1467 it turns out, this is unnecessary. There are two observations 1468 that should be made: 1470 (1) With IP Version 4, the largest amount of TCP data that can be 1471 sent in a single packet is 65495 bytes (64 KiB - 1 -- size of 1472 fixed IP and TCP headers). 1474 (2) Updates to the urgent pointer while the user is in "urgent 1475 mode" are invisible to the user. 1477 This means that if the Urgent Pointer points beyond the end of the 1478 TCP data in the current segment, then the user will remain in 1479 urgent mode until the next TCP segment arrives. That segment will 1480 update the urgent pointer to a new offset, and the user will never 1481 have left urgent mode. 1483 Thus, to properly implement the Urgent Pointer, the sending TCP 1484 only has to check for overflow of the 16 bit Urgent Pointer field 1485 before filling it in. If it does overflow, than a value of 65535 1486 should be inserted into the Urgent Pointer. 1488 The same technique applies to IP Version 6, except in the case of 1489 IPv6 Jumbograms. When IPv6 Jumbograms are supported, [RFC2675] 1490 requires additional steps for dealing with the Urgent Pointer, 1491 these are described in section 5.2 of [RFC2675]. 1493 Appendix B. Duplicates from Earlier Connection Incarnations 1495 There are two cases to be considered: (1) a system crashing (and 1496 losing connection state) and restarting, and (2) the same connection 1497 being closed and reopened without a loss of host state. These will 1498 be described in the following two sections. 1500 B.1. System Crash with Loss of State 1502 TCP's quiet time of one MSL upon system startup handles the loss of 1503 connection state in a system crash/restart. For an explanation, see 1504 for example "When to Keep Quiet" in the TCP protocol specification 1505 [RFC0793]. The MSL that is required here does not depend upon the 1506 transfer speed. The current TCP MSL of 2 minutes seemed acceptable 1507 as an operational compromise, when many host systems used to take 1508 this long to boot after a crash. Current host systems can boot 1509 considerably faster. 1511 The Timestamps option may be used to ease the MSL requirements (or to 1512 provide additional security against data corruption). If timestamps 1513 are being used and if the timestamp clock can be guaranteed to be 1514 monotonic over a system crash/restart, i.e., if the first value of 1515 the sender's timestamp clock after a crash/restart can be guaranteed 1516 to be greater than the last value before the restart, then a quiet 1517 time is unnecessary. 1519 To dispense totally with the quiet time would require that the host 1520 clock be synchronized to a time source that is stable over the crash/ 1521 restart period, with an accuracy of one timestamp clock tick or 1522 better. We can back off from this strict requirement to take 1523 advantage of approximate clock synchronization. Suppose that the 1524 clock is always re-synchronized to within N timestamp clock ticks and 1525 that booting (extended with a quiet time, if necessary) takes more 1526 than N ticks. This will guarantee monotonicity of the timestamps, 1527 which can then be used to reject old duplicates even without an 1528 enforced MSL. 1530 B.2. Closing and Reopening a Connection 1532 When a TCP connection is closed, a delay of 2*MSL in TIME-WAIT state 1533 ties up the socket pair for 4 minutes (see Section 3.5 of [RFC0793]. 1534 Applications built upon TCP that close one connection and open a new 1535 one (e.g., an FTP data transfer connection using Stream mode) must 1536 choose a new socket pair each time. The TIME-WAIT delay serves two 1537 different purposes: 1539 (a) Implement the full-duplex reliable close handshake of TCP. 1541 The proper time to delay the final close step is not really 1542 related to the MSL; it depends instead upon the RTO for the FIN 1543 segments and therefore upon the RTT of the path. (It could be 1544 argued that the side that is sending a FIN knows what degree of 1545 reliability it needs, and therefore it should be able to 1546 determine the length of the TIME-WAIT delay for the FIN's 1547 recipient. This could be accomplished with an appropriate TCP 1548 option in FIN segments.) 1550 Although there is no formal upper-bound on RTT, common network 1551 engineering practice makes an RTT greater than 1 minute very 1552 unlikely. Thus, the 4 minute delay in TIME-WAIT state works 1553 satisfactorily to provide a reliable full-duplex TCP close. 1554 Note again that this is independent of MSL enforcement and 1555 network speed. 1557 The TIME-WAIT state could cause an indirect performance problem 1558 if an application needed to repeatedly close one connection and 1559 open another at a very high frequency, since the number of 1560 available TCP ports on a host is less than 2^16. However, high 1561 network speeds are not the major contributor to this problem; 1562 the RTT is the limiting factor in how quickly connections can be 1563 opened and closed. Therefore, this problem will be no worse at 1564 high transfer speeds. 1566 (b) Allow old duplicate segments to expire. 1568 To replace this function of TIME-WAIT state, a mechanism would 1569 have to operate across connections. PAWS is defined strictly 1570 within a single connection; the last timestamp (TS.Recent) is 1571 kept in the connection control block, and discarded when a 1572 connection is closed. 1574 An additional mechanism could be added to the TCP, a per-host 1575 cache of the last timestamp received from any connection. This 1576 value could then be used in the PAWS mechanism to reject old 1577 duplicate segments from earlier incarnations of the connection, 1578 if the timestamp clock can be guaranteed to have ticked at least 1579 once since the old connection was open. This would require that 1580 the TIME-WAIT delay plus the RTT together must be at least one 1581 tick of the sender's timestamp clock. Such an extension is not 1582 part of the proposal of this RFC. 1584 Note that this is a variant on the mechanism proposed by 1585 Garlick, Rom, and Postel [Garlick77], which required each host 1586 to maintain connection records containing the highest sequence 1587 numbers on every connection. Using timestamps instead, it is 1588 only necessary to keep one quantity per remote host, regardless 1589 of the number of simultaneous connections to that host. 1591 Appendix C. Summary of Notation 1593 The following notation has been used in this document. 1595 Options 1597 WSopt: TCP Window Scale option 1598 TSopt: TCP Timestamps option 1600 Option Fields 1602 shift.cnt: Window scale byte in WSopt 1603 TSval: 32-bit Timestamp Value field in TSopt 1604 TSecr: 32-bit Timestamp Reply field in TSopt 1606 Option Fields in Current Segment 1608 SEG.TSval: TSval field from TSopt in current segment 1609 SEG.TSecr: TSecr field from TSopt in current segment 1610 SEG.WSopt: 8-bit value in WSopt 1612 Clock Values 1614 my.TSclock: System wide source of 32-bit timestamp values 1615 my.TSclock.rate: Period of my.TSclock (1 ms to 1 sec) 1616 Snd.TSoffset: A offset for randomizing Snd.TSclock 1617 Snd.TSclock: my.TSclock + Snd.TSoffset 1619 Per-Connection State Variables 1620 TS.Recent: Latest received Timestamp 1621 Last.ACK.sent: Last ACK field sent 1622 Snd.TS.OK: 1-bit flag 1623 Snd.WS.OK: 1-bit flag 1624 Rcv.Wind.Shift: Receive window scale exponent 1625 Snd.Wind.Shift: Send window scale exponent 1626 Start.Time: Snd.TSclock value when segment being timed was 1627 sent (used by pre-1323 code). 1629 Procedure 1631 Update_SRTT(m) Procedure to update the smoothed RTT and RTT 1632 variance estimates, using the rules of 1633 [Jacobson88a], given m, a new RTT measurement 1635 Appendix D. Event Processing Summary 1637 OPEN Call 1639 ... 1641 An initial send sequence number (ISS) is selected. Send a 1642 segment of the form: 1644 1646 ... 1648 SEND Call 1650 CLOSED STATE (i.e., TCB does not exist) 1652 ... 1654 LISTEN STATE 1656 If the foreign socket is specified, then change the connection 1657 from passive to active, select an ISS. Send a segment 1658 containing the options: and 1659 . Set SND.UNA to ISS, SND.NXT to ISS+1. 1660 Enter SYN-SENT state. ... 1662 SYN-SENT STATE 1663 SYN-RECEIVED STATE 1665 ... 1667 ESTABLISHED STATE 1668 CLOSE-WAIT STATE 1670 Segmentize the buffer and send it with a piggybacked 1671 acknowledgment (acknowledgment value = RCV.NXT). ... 1673 If the urgent flag is set ... 1675 If the Snd.TS.OK flag is set, then include the TCP Timestamps 1676 option in each data 1677 segment. 1679 Scale the receive window for transmission in the segment 1680 header: 1682 SEG.WND = (RCV.WND >> Rcv.Wind.Shift). 1684 SEGMENT ARRIVES 1686 ... 1688 If the state is LISTEN then 1690 first check for an RST 1692 ... 1694 second check for an ACK 1696 ... 1698 third check for a SYN 1700 if the SYN bit is set, check the security. If the ... 1702 ... 1704 if the SEG.PRC is less than the TCB.PRC then continue. 1706 Check for a Window Scale option (WSopt); if one is found, 1707 save SEG.WSopt in Snd.Wind.Shift and set Snd.WS.OK flag on. 1708 Otherwise, set both Snd.Wind.Shift and Rcv.Wind.Shift to 1709 zero and clear Snd.WS.OK flag. 1711 Check for a TSopt option; if one is found, save SEG.TSval in 1712 the variable TS.Recent and turn on the Snd.TS.OK bit. 1714 Set RCV.NXT to SEG.SEQ+1, IRS is set to SEG.SEQ and any 1715 other control or text should be queued for processing later. 1716 ISS should be selected and a segment sent of the form: 1718 1720 If the Snd.WS.OK bit is on, include a WSopt option 1721 in this segment. If the Snd.TS.OK 1722 bit is on, include a TSopt in this segment. Last.ACK.sent is set to 1724 RCV.NXT. 1726 SND.NXT is set to ISS+1 and SND.UNA to ISS. The connection 1727 state should be changed to SYN-RECEIVED. Note that any 1728 other incoming control or data (combined with SYN) will be 1729 processed in the SYN-RECEIVED state, but processing of SYN 1730 and ACK should not be repeated. If the listen was not fully 1731 specified (i.e., the foreign socket was not fully 1732 specified), then the unspecified fields should be filled in 1733 now. 1735 fourth other text or control 1737 ... 1739 If the state is SYN-SENT then 1741 first check the ACK bit 1743 ... 1745 ... 1747 fourth check the SYN bit 1749 ... 1751 If the SYN bit is on and the security/compartment and 1752 precedence are acceptable then, RCV.NXT is set to SEG.SEQ+1, 1753 IRS is set to SEG.SEQ, and any acknowledgments on the 1754 retransmission queue which are thereby acknowledged should 1755 be removed. 1757 Check for a Window Scale option (WSopt); if it is found, 1758 save SEG.WSopt in Snd.Wind.Shift; otherwise, set both 1759 Snd.Wind.Shift and Rcv.Wind.Shift to zero. 1761 Check for a TSopt option; if one is found, save SEG.TSval in 1762 variable TS.Recent and turn on the Snd.TS.OK bit in the 1763 connection control block. If the ACK bit is set, use 1764 Snd.TSclock - SEG.TSecr as the initial RTT estimate. 1766 If SND.UNA > ISS (our has been ACKed), change the 1767 connection state to ESTABLISHED, form an segment: 1769 1771 and send it. If the Snd.Echo.OK bit is on, include a TSopt 1772 option in this 1773 segment. Last.ACK.sent is set to RCV.NXT. 1775 Data or controls which were queued for transmission may be 1776 included. If there are other controls or text in the 1777 segment then continue processing at the sixth step below 1778 where the URG bit is checked, otherwise return. 1780 Otherwise enter SYN-RECEIVED, form a segment: 1782 1784 and send it. If the Snd.Echo.OK bit is on, include a TSopt 1785 option in this segment. 1786 If the Snd.WS.OK bit is on, include a WSopt option 1787 in this segment. Last.ACK.sent is 1788 set to RCV.NXT. 1790 If there are other controls or text in the segment, queue 1791 them for processing after the ESTABLISHED state has been 1792 reached, return. 1794 fifth, if neither of the SYN or RST bits is set then drop the 1795 segment and return. 1797 Otherwise, 1799 First, check sequence number 1801 SYN-RECEIVED STATE 1802 ESTABLISHED STATE 1803 FIN-WAIT-1 STATE 1804 FIN-WAIT-2 STATE 1805 CLOSE-WAIT STATE 1806 CLOSING STATE 1807 LAST-ACK STATE 1808 TIME-WAIT STATE 1809 Segments are processed in sequence. Initial tests on 1810 arrival are used to discard old duplicates, but further 1811 processing is done in SEG.SEQ order. If a segment's 1812 contents straddle the boundary between old and new, only the 1813 new parts should be processed. 1815 Rescale the received window field: 1817 TrueWindow = SEG.WND << Snd.Wind.Shift, 1819 and use "TrueWindow" in place of SEG.WND in the following 1820 steps. 1822 Check whether the segment contains a Timestamps option and 1823 bit Snd.TS.OK is on. If so: 1825 If SEG.TSval < TS.Recent and the RST bit is off, then 1826 test whether connection has been idle less than 24 days; 1827 if all are true, then the segment is not acceptable; 1828 follow steps below for an unacceptable segment. 1830 If SEG.SEQ is less than or equal to Last.ACK.sent, then 1831 save SEG.TSval in variable TS.Recent. 1833 There are four cases for the acceptability test for an 1834 incoming segment: 1836 ... 1838 If an incoming segment is not acceptable, an acknowledgment 1839 should be sent in reply (unless the RST bit is set, if so 1840 drop the segment and return): 1842 1844 Last.ACK.sent is set to SEG.ACK of the acknowledgment. If 1845 the Snd.Echo.OK bit is on, include the Timestamps option 1846 in this segment. 1847 Set Last.ACK.sent to SEG.ACK and send the segment. 1848 After sending the acknowledgment, drop the unacceptable 1849 segment and return. 1851 ... 1853 fifth check the ACK field. 1855 if the ACK bit is off drop the segment and return. 1857 if the ACK bit is on 1859 ... 1861 ESTABLISHED STATE 1863 If SND.UNA < SEG.ACK <= SND.NXT then, set SND.UNA <- 1864 SEG.ACK. Also compute a new estimate of round-trip time. 1865 If Snd.TS.OK bit is on, use Snd.TSclock - SEG.TSecr; 1866 otherwise use the elapsed time since the first segment in 1867 the retransmission queue was sent. Any segments on the 1868 retransmission queue which are thereby entirely 1869 acknowledged... 1871 ... 1873 Seventh, process the segment text. 1875 ESTABLISHED STATE 1876 FIN-WAIT-1 STATE 1877 FIN-WAIT-2 STATE 1879 ... 1881 Send an acknowledgment of the form: 1883 1885 If the Snd.TS.OK bit is on, include Timestamps option 1886 in this segment. 1887 Set Last.ACK.sent to SEG.ACK of the acknowledgment, and send 1888 it. This acknowledgment should be piggy-backed on a segment 1889 being transmitted if possible without incurring undue delay. 1891 ... 1893 Appendix E. Timestamps Edge Cases 1895 While the rules laid out for when to calculate RTTM produce the 1896 correct results most of the time, there are some edge cases where an 1897 incorrect RTTM can be calculated. All of these situations involve 1898 the loss of segments. It is felt that these scenarios are rare, and 1899 that if they should happen, they will cause a single RTTM measurement 1900 to be inflated, which mitigates its effects on RTO calculations. 1902 [Martin03] cites two similar cases when the returning is lost, 1903 and before the retransmission timer fires, another returning 1904 segment arrives, which aknowledges the data. In this case, the RTTM 1905 calculated will be inflated: 1907 clock 1908 tc=1 -------------------> 1910 tc=2 (lost) <---- 1911 (RTTM would have been 1) 1913 (receive window opens, window update is sent) 1914 tc=5 <---- 1915 (RTTM is calculated at 4) 1917 One thing to note about this situation is that it is somewhat bounded 1918 by RTO + RTT, limiting how far off the RTTM calculation will be. 1919 While more complex scenarios can be constructed that produce larger 1920 inflations (e.g., retransmissions are lost), those scenarios involve 1921 multiple segment losses, and the connection will have other more 1922 serious operational problems than using an inflated RTTM in the RTO 1923 calculation. 1925 Appendix F. Window Retraction Example 1927 Consider an established TCP connection using a scale factor of 128, 1928 Snd.Wind.Shift=7 and Rcv.Wind.Shift=7, that is running with a very 1929 small window because the receiver is bottlenecked and both ends are 1930 doing small reads and writes. 1932 Consider the ACKs coming back: 1934 SEG.ACK SEG.WIN computed SND.WIN receiver's actual window 1935 1000 2 1256 1300 1937 The sender writes 40 bytes and receiver ACKs: 1939 1040 2 1296 1300 1941 The sender writes 5 additional bytes and the receiver has a problem. 1942 Two choices: 1944 1045 2 1301 1300 - BEYOND BUFFER 1946 1045 1 1173 1300 - RETRACTED WINDOW 1948 This is a general problem and can happen any time the sender does a 1949 write which is smaller than the window scale factor. 1951 In most stacks it is at least partially obscured when the window size 1952 is larger than some small number of segments because the stacks 1953 prefer to announce windows that are an integral number of segments, 1954 rounded up to the next scale factor. This plus silly window 1955 suppression tends to cause less frequent, larger window updates. If 1956 the window was rounded down to a segment size there is more 1957 opportunity to advance the window, the BEYOND BUFFER case above, 1958 rather than retracting it. 1960 Appendix G. RTO calculation modification 1962 Taking multiple RTT samples per window would shorten the history 1963 calculated by the RTO mechanism in [RFC6298], and the below algorithm 1964 aims to maintain a similar history as originally intended by 1965 [RFC6298]. 1967 It is roughly known how many samples a congestion window worth of 1968 data will yield, not accounting for ACK compression, and ACK losses. 1969 Such events will result in more history of the path being reflected 1970 in the final value for RTO, and are uncritical. This modification 1971 will ensure that a similar amount of time is taken into account for 1972 the RTO estimation, regardless of how many samples are taken per 1973 window: 1975 ExpectedSamples = ceiling(FlightSize / (SMSS * 2)) 1977 alpha' = alpha / ExpectedSamples 1979 beta' = beta / ExpectedSamples 1981 Note that the factor 2 in ExpectedSamples is due to "Delayed ACKs". 1983 Instead of using alpha and beta in the algorithm of [RFC6298], use 1984 alpha' and beta' instead: 1986 RTTVAR <- (1 - beta') * RTTVAR + beta' * |SRTT - R'| 1988 SRTT <- (1 - alpha') * SRTT + alpha' * R' 1990 (for each sample R') 1992 Appendix H. Changes from RFC 1323 1994 Several important updates and clarifications to the specification in 1995 RFC 1323 are made in these document. The technical changes are 1996 summarized below: 1998 (a) A wrong reference to SND.WND was corrected to SEG.WND in 1999 Section 2.3 2001 (b) Section 2.4 was added describing the unavoidable window 2002 retraction issue, and explicitly describing the mitigation steps 2003 necessary. 2005 (c) In Section 3.2 the wording how the Timestamps option negotiation 2006 is to be performed was updated with RFC2119 wording. Further, a 2007 number of paragraphs were added to clarify the expected behavior 2008 with a compliant implementation using TSopt, as RFC1323 left 2009 room for interpretation - e.g. potential late enablement of 2010 TSopt. 2012 (d) The description of which TSecr values can be used to update the 2013 measured RTT has been clarified. Specifically, with timestamps, 2014 the Karn algorithm [Karn87] is disabled. The Karn algorithm 2015 disables all RTT measurements during retransmission, since it is 2016 ambiguous whether the is for the original segment, or the 2017 retransmitted segment. With timestamps, that ambiguity is 2018 removed since the TSecr in the will contain the TSval from 2019 whichever data segment made it to the destination. 2021 (e) RTTM update processing explicitly excludes segments not updating 2022 SND.UNA. The original text could be interpreted to allow taking 2023 RTT samples when SACK acknowledges some new, non-continuous 2024 data. 2026 (f) In RFC1323, section 3.4, step (2) of the algorithm to control 2027 which timestamp is echoed was incorrect in two regards: 2029 (1) It failed to update TS.recent for a retransmitted segment 2030 that resulted from a lost . 2032 (2) It failed if SEG.LEN = 0. 2034 In the new algorithm, the case of SEG.TSval >= TS.recent is 2035 included for consistency with the PAWS test. 2037 (g) It is now recommended that the Timestamps option is included in 2038 segments if the incoming segment contained a Timestamps 2039 option. 2041 (h) segments are explicitly excluded from PAWS processing. 2043 (i) Added text to clarify the precedence between regular TCP 2044 [RFC0793] and this document Timestamps option / PAWS processing. 2045 Discussion about combined acceptability checks are ongoing. 2047 (j) Snd.TSoffset and Snd.TSclock variables have been added. 2048 Snd.TSclock is the sum of my.TSclock and Snd.TSoffset. This 2049 allows the starting points for timestamp values to be randomized 2050 on a per-connection basis. Setting Snd.TSoffset to zero yields 2051 the same results as [RFC1323]. Text was added to guide 2052 implementers to the proper selection of these offsets, as 2053 entirely random offsets for each new connection will conflict 2054 with PAWS. 2056 (k) Appendix A has been expanded with information about the TCP 2057 Urgent Pointer. An earlier revision contained text around the 2058 TCP MSS option, which was split off into [RFC6691]. 2060 (l) One correction was made to the Event Processing Summary in 2061 Appendix D. In SEND CALL/ESTABLISHED STATE, RCV.WND is used to 2062 fill in the SEG.WND value, not SND.WND. 2064 (m) Appendix G was added to exemplify how an RTO calculation might 2065 be updated to properly take the much higher RTT sampling 2066 frequency enabled by the Timestamps option into account. 2068 Editorial changes of the document, that don't impact the 2069 implementation or function of the mechanisms described in this 2070 document include: 2072 (a) Removed much of the discussion in Section 1 to streamline the 2073 document. However, detailed examples and discussions in 2074 Section 2, Section 3 and Section 5 are kept as guideline for 2075 implementers. 2077 (b) Added short text that the use of WS increases the chances of 2078 sequence number wrap, thus the PAWS mechanism is required in 2079 certain environments. 2081 (c) Removed references to "new" options, as the options were 2082 introduced in [RFC1323] already. Changed the text in 2083 Section 1.3 to specifically address TS and WS options. 2085 (d) Section 1.4 was added for [RFC2119] wording. Normative text was 2086 updated with the appropriate phrases. 2088 (e) Added < > brackets to mark specific types of segments, and 2089 replaced most occurences of "packet" with "segment", where TCP 2090 segments are referred to. 2092 (f) Updated the text in Section 3 to take into account what has been 2093 learned since [RFC1323]. 2095 (g) Removed some unused references. 2097 (h) Removed the list of changes between [RFC1323] and prior 2098 versions. These changes are mentioned in Appendix C of 2099 [RFC1323]. 2101 (i) Moved Appendix Changes from RFC 1323 to the end of the 2102 appendices for easier lookup. In addition, the entries were 2103 split into a technical and an editorial part, and sorted to 2104 roughly correspond with the sections in the text where they 2105 apply. 2107 Authors' Addresses 2109 David Borman 2110 Quantum Corporation 2111 Mendota Heights MN 55120 2112 USA 2114 Email: david.borman@quantum.com 2116 Bob Braden 2117 University of Southern California 2118 4676 Admiralty Way 2119 Marina del Rey CA 90292 2120 USA 2122 Email: braden@isi.edu 2124 Van Jacobson 2125 Google, Inc. 2126 1600 Amphitheatre Parkway 2127 Mountain View CA 94043 2128 USA 2130 Email: vanj@google.com 2131 Richard Scheffenegger (editor) 2132 NetApp, Inc. 2133 Am Euro Platz 2 2134 Vienna, 1120 2135 Austria 2137 Email: rs@netapp.com