home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_q_t / draft-ietf-tcplw-high-performance-00.txt < prev    next >
Text File  |  1997-02-25  |  94KB  |  2,381 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. Network Working Group                              Network Working Group
  7. Internet-Draft                                               V. Jacobson
  8. Obsoletes: 1323                                                      LBL
  9.                                                                R. Braden
  10.                                                                      ISI
  11.                                                                D. Borman
  12.                                                                     BSDI
  13.                                                            February 1997
  14.  
  15.  
  16.                   TCP Extensions for High Performance
  17.                <draft-ietf-tcplw-high-performance-00.txt>
  18.  
  19. Status of This Memo
  20.  
  21.    This document is an Internet-Draft.  Internet-Drafts are working
  22.    documents of the Internet Engineering Task Force (IETF), its areas,
  23.    and its working groups.  Note that other groups may also distribute
  24.    working documents as Internet-Drafts.
  25.  
  26.    Internet-Drafts are draft documents valid for a maximum of six months
  27.    and may be updated, replaced, or obsoleted by other documents at any
  28.    time.  It is inappropriate to use Internet- Drafts as reference
  29.    material or to cite them other than as ``work in progress.''
  30.  
  31.    To learn the current status of any Internet-Draft, please check the
  32.    ``1id-abstracts.txt'' listing contained in the Internet- Drafts
  33.    Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
  34.    munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
  35.    ftp.isi.edu (US West Coast).
  36.  
  37. Abstract
  38.  
  39.    This memo presents a set of TCP extensions to improve performance
  40.    over large bandwidth*delay product paths and to provide reliable
  41.    operation over very high-speed paths.  It defines new TCP options for
  42.    scaled windows and timestamps, which are designed to provide
  43.    compatible interworking with TCP's that do not implement the
  44.    extensions.  The timestamps are used for two distinct mechanisms:
  45.    RTTM (Round Trip Time Measurement) and PAWS (Protect Against Wrapped
  46.    Sequences).  Selective acknowledgments are not included in this memo.
  47.  
  48.    This memo updates and obsoletes RFC-1323, a Proposed Standard, with
  49.    small clarifications and corrections.
  50.  
  51.  
  52. TABLE OF CONTENTS
  53.  
  54.  
  55.  
  56.  
  57. Network Working Group      Expires August 1997                  [Page 1]
  58.  
  59. Internet-Draft     TCP Extensions for High Performance     February 1997
  60.  
  61.  
  62.  
  63.    1.  Introduction                                                    2
  64.    2.  TCP Window Scale Option                                         8
  65.    3.  RTTM -- Round-Trip Time Measurement                            11
  66.    4.  PAWS -- Protect Against Wrapped Sequence Numbers               17
  67.    5.  Conclusions and Acknowledgments                                24
  68.    6.  References                                                     25
  69.    APPENDIX A: Implementation Suggestions                             27
  70.    APPENDIX B: Duplicates from Earlier Connection Incarnations        27
  71.    APPENDIX C: Changes from RFC-1072, RFC-1185, RFC-1323              30
  72.    APPENDIX D: Summary of Notation                                    32
  73.    APPENDIX E: Pseudo-code Summary                                    33
  74.    APPENDIX F: Event Processing                                       35
  75.    APPENDIX G: TCP Options and MSS                                    40
  76.    Security Considerations                                            41
  77.    Authors' Addresses                                                 41
  78.  
  79. 1. INTRODUCTION
  80.  
  81.    The TCP protocol [Postel81] was designed to operate reliably over
  82.    almost any transmission medium regardless of transmission rate,
  83.    delay, corruption, duplication, or reordering of segments.
  84.    Production TCP implementations currently adapt to transfer rates in
  85.    the range of 100 bps to 10**7 bps and round-trip delays in the range
  86.    1 ms to 100 seconds.  Recent work on TCP performance has shown that
  87.    TCP can work well over a variety of Internet paths, ranging from 800
  88.    Mbit/sec I/O channels to 300 bit/sec dial-up modems [Jacobson88a].
  89.  
  90.    The introduction of fiber optics is resulting in ever-higher
  91.    transmission speeds, and the fastest paths are moving out of the
  92.    domain for which TCP was originally engineered.  This memo defines a
  93.    set of modest extensions to TCP to extend the domain of its
  94.    application to match this increasing network capability.  It is based
  95.    upon and obsoletes RFC-1072 [Jacobson88b] and RFC-1185 [Jacobson90b].
  96.  
  97.    There is no one-line answer to the question: "How fast can TCP go?".
  98.    There are two separate kinds of issues, performance and reliability,
  99.    and each depends upon different parameters.  We discuss each in turn.
  100.  
  101.    1.1  TCP Performance
  102.  
  103.       TCP performance depends not upon the transfer rate itself, but
  104.       rather upon the product of the transfer rate and the round-trip
  105.       delay.  This "bandwidth*delay product" measures the amount of data
  106.       that would "fill the pipe"; it is the buffer space required at
  107.       sender and receiver to obtain maximum throughput on the TCP
  108.       connection over the path, i.e., the amount of unacknowledged data
  109.       that TCP must handle in order to keep the pipeline full.  TCP
  110.       performance problems arise when the bandwidth*delay product is
  111.       large.  We refer to an Internet path operating in this region as a
  112.  
  113.  
  114.  
  115. Network Working Group      Expires August 1997                  [Page 2]
  116.  
  117. Internet-Draft     TCP Extensions for High Performance     February 1997
  118.  
  119.  
  120.       "long, fat pipe", and a network containing this path as an "LFN"
  121.       (pronounced "elephan(t)").
  122.  
  123.       High-capacity packet satellite channels (e.g., DARPA's Wideband
  124.       Net) are LFN's.  For example, a DS1-speed satellite channel has a
  125.       bandwidth*delay product of 10**6 bits or more; this corresponds to
  126.       100 outstanding TCP segments of 1200 bytes each.  Terrestrial
  127.       fiber-optical paths will also fall into the LFN class; for
  128.       example, a cross-country delay of 30 ms at a DS3 bandwidth
  129.       (45Mbps) also exceeds 10**6 bits.
  130.  
  131.       There are three fundamental performance problems with the current
  132.       TCP over LFN paths:
  133.  
  134.       (1)  Window Size Limit
  135.  
  136.            The TCP header uses a 16 bit field to report the receive
  137.            window size to the sender.  Therefore, the largest window
  138.            that can be used is 2**16 = 65K bytes.
  139.  
  140.            To circumvent this problem, Section 2 of this memo defines a
  141.            new TCP option, "Window Scale", to allow windows larger than
  142.            2**16.  This option defines an implicit scale factor, which
  143.            is used to multiply the window size value found in a TCP
  144.            header to obtain the true window size.
  145.  
  146.       (2)  Recovery from Losses
  147.  
  148.            Packet losses in an LFN can have a catastrophic effect on
  149.            throughput.  Until recently, properly-operating TCP
  150.            implementations would cause the data pipeline to drain with
  151.            every packet loss, and require a slow-start action to
  152.            recover.  Recently, the Fast Retransmit and Fast Recovery
  153.            algorithms [Jacobson90c] have been introduced.  Their
  154.            combined effect is to recover from one packet loss per
  155.            window, without draining the pipeline.  However, more than
  156.            one packet loss per window typically results in a
  157.            retransmission timeout and the resulting pipeline drain and
  158.            slow start.
  159.  
  160.            Expanding the window size to match the capacity of an LFN
  161.            results in a corresponding increase of the probability of
  162.            more than one packet per window being dropped.  This could
  163.            have a devastating effect upon the throughput of TCP over an
  164.            LFN.  In addition, if a congestion control mechanism based
  165.            upon some form of random dropping were introduced into
  166.            gateways, randomly spaced packet drops would become common,
  167.            possible increasing the probability of dropping more than one
  168.            packet per window.
  169.  
  170.  
  171.  
  172.  
  173. Network Working Group      Expires August 1997                  [Page 3]
  174.  
  175. Internet-Draft     TCP Extensions for High Performance     February 1997
  176.  
  177.  
  178.            To generalize the Fast Retransmit/Fast Recovery mechanism to
  179.            handle multiple packets dropped per window, selective
  180.            acknowledgments are required.  Unlike the normal cumulative
  181.            acknowledgments of TCP, selective acknowledgments give the
  182.            sender a complete picture of which segments are queued at the
  183.            receiver and which have not yet arrived.  Some evidence in
  184.            favor of selective acknowledgments has been published
  185.            [NBS85], and selective acknowledgments have been included in
  186.            a number of experimental Internet protocols -- VMTP
  187.            [Cheriton88], NETBLT [Clark87], and RDP [Velten84], and
  188.            proposed for OSI TP4 [NBS85].  However, in the non-LFN
  189.            regime, selective acknowledgments reduce the number of
  190.            packets retransmitted but do not otherwise improve
  191.            performance, making their complexity of questionable value.
  192.            However, selective acknowledgments are expected to become
  193.            much more important in the LFN regime.
  194.  
  195.            RFC-1072 defined a new TCP "SACK" option to send a selective
  196.            acknowledgment.  However, due to important technical issues
  197.            that had to be worked out concerning both the format and
  198.            semantics of the SACK option, it was omitted from RFC-1323.
  199.            SACK has now been published as a separate document, RFC-2018
  200.            [Mathis96].
  201.  
  202.       (3)  Round-Trip Measurement
  203.  
  204.            TCP implements reliable data delivery by retransmitting
  205.            segments that are not acknowledged within some retransmission
  206.            timeout (RTO) interval.  Accurate dynamic determination of an
  207.            appropriate RTO is essential to TCP performance.  RTO is
  208.            determined by estimating the mean and variance of the
  209.            measured round-trip time (RTT), i.e., the time interval
  210.            between sending a segment and receiving an acknowledgment for
  211.            it [Jacobson88a].
  212.  
  213.            Section 4 introduces a new TCP option, "Timestamps", and then
  214.            defines a mechanism using this option that allows nearly
  215.            every segment, including retransmissions, to be timed at
  216.            negligible computational cost.  We use the mnemonic RTTM
  217.            (Round Trip Time Measurement) for this mechanism, to
  218.            distinguish it from other uses of the Timestamps option.
  219.  
  220.  
  221.    1.2 TCP Reliability
  222.  
  223.       Now we turn from performance to reliability.  High transfer rate
  224.       enters TCP performance through the bandwidth*delay product.
  225.       However, high transfer rate alone can threaten TCP reliability by
  226.       violating the assumptions behind the TCP mechanism for duplicate
  227.       detection and sequencing.
  228.  
  229.  
  230.  
  231. Network Working Group      Expires August 1997                  [Page 4]
  232.  
  233. Internet-Draft     TCP Extensions for High Performance     February 1997
  234.  
  235.  
  236.       An especially serious kind of error may result from an accidental
  237.       reuse of TCP sequence numbers in data segments.  Suppose that an
  238.       "old duplicate segment", e.g., a duplicate data segment that was
  239.       delayed in Internet queues, is delivered to the receiver at the
  240.       wrong moment, so that its sequence numbers falls somewhere within
  241.       the current window.  There would be no checksum failure to warn of
  242.       the error, and the result could be an undetected corruption of the
  243.       data.  Reception of an old duplicate ACK segment at the
  244.       transmitter could be only slightly less serious: it is likely to
  245.       lock up the connection so that no further progress can be made,
  246.       forcing an RST on the connection.
  247.  
  248.       TCP reliability depends upon the existence of a bound on the
  249.       lifetime of a segment: the "Maximum Segment Lifetime" or MSL.  An
  250.       MSL is generally required by any reliable transport protocol,
  251.       since every sequence number field must be finite, and therefore
  252.       any sequence number may eventually be reused.  In the Internet
  253.       protocol suite, the MSL bound is enforced by an IP-layer
  254.       mechanism, the "Time-to-Live" or TTL field.
  255.  
  256.       Duplication of sequence numbers might happen in either of two
  257.       ways:
  258.  
  259.       (1)  Sequence number wrap-around on the current connection
  260.  
  261.            A TCP sequence number contains 32 bits.  At a high enough
  262.            transfer rate, the 32-bit sequence space may be "wrapped"
  263.            (cycled) within the time that a segment is delayed in queues.
  264.  
  265.       (2)  Earlier incarnation of the connection
  266.  
  267.            Suppose that a connection terminates, either by a proper
  268.            close sequence or due to a host crash, and the same
  269.            connection (i.e., using the same pair of sockets) is
  270.            immediately reopened.  A delayed segment from the terminated
  271.            connection could fall within the current window for the new
  272.            incarnation and be accepted as valid.
  273.  
  274.       Duplicates from earlier incarnations, Case (2), are avoided by
  275.       enforcing the current fixed MSL of the TCP spec, as explained in
  276.       Section 5.3 and Appendix B.   However, case (1), avoiding the
  277.       reuse of sequence numbers within the same connection, requires an
  278.       MSL bound that depends upon the transfer rate, and at high enough
  279.       rates, a new mechanism is required.
  280.  
  281.       More specifically, if the maximum effective bandwidth at which TCP
  282.       is able to transmit over a particular path is B bytes per second,
  283.       then the following constraint must be satisfied for error-free
  284.       operation:
  285.  
  286.  
  287.  
  288.  
  289. Network Working Group      Expires August 1997                  [Page 5]
  290.  
  291. Internet-Draft     TCP Extensions for High Performance     February 1997
  292.  
  293.  
  294.  
  295.           2**31 / B  > MSL (secs)                     [1]
  296.  
  297.       The following table shows the value for Twrap = 2**31/B in
  298.       seconds, for some important values of the bandwidth B:
  299.  
  300.            Network       B*8          B         Twrap
  301.                       bits/sec    bytes/sec     secs
  302.            _______     _______     ______       ______
  303.  
  304.            ARPANET       56kbps       7KBps    3*10**5 (~3.6 days)
  305.  
  306.            DS1          1.5Mbps     190KBps    10**4 (~3 hours)
  307.  
  308.            Ethernet      10Mbps    1.25MBps    1700 (~30 mins)
  309.  
  310.            DS3           45Mbps     5.6MBps    380
  311.  
  312.            FDDI         100Mbps    12.5MBps    170
  313.  
  314.            Gigabit        1Gbps     125MBps    17
  315.  
  316.       It is clear that wrap-around of the sequence space is not a
  317.       problem for 56kbps packet switching or even 10Mbps Ethernets.  On
  318.       the other hand, at DS3 and FDDI speeds, Twrap is comparable to the
  319.       2 minute MSL assumed by the TCP specification [Postel81].  Moving
  320.       towards gigabit speeds, Twrap becomes too small for reliable
  321.       enforcement by the Internet TTL mechanism.
  322.  
  323.       The 16-bit window field of TCP limits the effective bandwidth B to
  324.       2**16/RTT, where RTT is the round-trip time in seconds
  325.       [McKenzie89].  If the RTT is large enough, this limits B to a
  326.       value that meets the constraint [1] for a large MSL value.  For
  327.       example, consider a transcontinental backbone with an RTT of 60ms
  328.       (set by the laws of physics).  With the bandwidth*delay product
  329.       limited to 64KB by the TCP window size, B is then limited to
  330.       1.1MBps, no matter how high the theoretical transfer rate of the
  331.       path.  This corresponds to cycling the sequence number space in
  332.       Twrap= 2000 secs, which is safe in today's Internet.
  333.  
  334.       It is important to understand that the culprit is not the larger
  335.       window but rather the high bandwidth.  For example, consider a
  336.       (very large) FDDI LAN with a diameter of 10km.  Using the speed of
  337.       light, we can compute the RTT across the ring as
  338.       (2*10**4)/(3*10**8) = 67 microseconds, and the delay*bandwidth
  339.       product is then 833 bytes.  A TCP connection across this LAN using
  340.       a window of only 833 bytes will run at the full 100mbps and can
  341.       wrap the sequence space in about 3 minutes, very close to the MSL
  342.       of TCP.  Thus, high speed alone can cause a reliability problem
  343.       with sequence number wrap-around, even without extended windows.
  344.  
  345.  
  346.  
  347. Network Working Group      Expires August 1997                  [Page 6]
  348.  
  349. Internet-Draft     TCP Extensions for High Performance     February 1997
  350.  
  351.  
  352.       Watson's Delta-T protocol [Watson81] includes network-layer
  353.       mechanisms for precise enforcement of an MSL.  In contrast, the IP
  354.       mechanism for MSL enforcement is loosely defined and even more
  355.       loosely implemented in the Internet.  Therefore, it is unwise to
  356.       depend upon active enforcement of MSL for TCP connections, and it
  357.       is unrealistic to imagine setting MSL's smaller than the current
  358.       values (e.g., 120 seconds specified for TCP).
  359.  
  360.       A possible fix for the problem of cycling the sequence space would
  361.       be to increase the size of the TCP sequence number field.  For
  362.       example, the sequence number field (and also the acknowledgment
  363.       field) could be expanded to 64 bits.  This could be done either by
  364.       changing the TCP header or by means of an additional option.
  365.  
  366.       Section 5 presents a different mechanism, which we call PAWS
  367.       (Protect Against Wrapped Sequence numbers), to extend TCP
  368.       reliability to transfer rates well beyond the foreseeable upper
  369.       limit of network bandwidths.  PAWS uses the TCP Timestamps option
  370.       defined in Section 4 to protect against old duplicates from the
  371.       same connection.
  372.  
  373.    1.3 Using TCP options
  374.  
  375.       The extensions defined in this memo all use new TCP options.  We
  376.       must address two possible issues concerning the use of TCP
  377.       options: (1) compatibility and (2) overhead.
  378.  
  379.       We must pay careful attention to compatibility, i.e., to
  380.       interoperation with existing implementations.  The only TCP option
  381.       defined previously, MSS, may appear only on a SYN segment.  Every
  382.       implementation should (and we expect that most will) ignore
  383.       unknown options on SYN segments.  However, some buggy TCP
  384.       implementation might be crashed by the first appearance of an
  385.       option on a non-SYN segment.  Therefore, for each of the
  386.       extensions defined below, TCP options will be sent on non-SYN
  387.       segments only after an exchange of options on the the SYN segments
  388.       has indicated that both sides understand the extension.
  389.       Furthermore, an extension option will be sent in a <SYN,ACK>
  390.       segment only if the corresponding option was received in the
  391.       initial <SYN> segment.
  392.  
  393.       A question may be raised about the bandwidth and processing
  394.       overhead for TCP options.  Those options that occur on SYN
  395.       segments are not likely to cause a performance concern.  Opening a
  396.       TCP connection requires execution of significant special-case
  397.       code, and the processing of options is unlikely to increase that
  398.       cost significantly.
  399.  
  400.       On the other hand, a Timestamps option may appear in any data or
  401.       ACK segment, adding 12 bytes to the 20-byte TCP header.  We
  402.  
  403.  
  404.  
  405. Network Working Group      Expires August 1997                  [Page 7]
  406.  
  407. Internet-Draft     TCP Extensions for High Performance     February 1997
  408.  
  409.  
  410.       believe that the bandwidth saved by reducing unnecessary
  411.       retransmissions will more than pay for the extra header bandwidth.
  412.  
  413.       There is also an issue about the processing overhead for parsing
  414.       the variable byte-aligned format of options, particularly with a
  415.       RISC-architecture CPU.  Appendix A contains a recommended layout
  416.       of the options in TCP headers to achieve reasonable data field
  417.       alignment.  In the spirit of Header Prediction, a TCP can quickly
  418.       test for this layout and if it is verified then use a fast path.
  419.       Hosts that use this canonical layout will effectively use the
  420.       options as a set of fixed-format fields appended to the TCP
  421.       header.  However, to retain the philosophical and protocol
  422.       framework of TCP options, a TCP must be prepared to parse an
  423.       arbitrary options field, albeit with less efficiency.
  424.  
  425.       Finally, we observe that most of the mechanisms defined in this
  426.       memo are important for LFN's and/or very high-speed networks.  For
  427.       low-speed networks, it might be a performance optimization to NOT
  428.       use these mechanisms.  A TCP vendor concerned about optimal
  429.       performance over low-speed paths might consider turning these
  430.       extensions off for low-speed paths, or allow a user or
  431.       installation manager to disable them.
  432.  
  433.  
  434. 2. TCP WINDOW SCALE OPTION
  435.  
  436.    2.1  Introduction
  437.  
  438.       The window scale extension expands the definition of the TCP
  439.       window to 32 bits and then uses a scale factor to carry this
  440.       32-bit value in the 16-bit Window field of the TCP header (SEG.WND
  441.       in RFC-793).  The scale factor is carried in a new TCP option,
  442.       Window Scale.  This option is sent only in a SYN segment (a
  443.       segment with the SYN bit on), hence the window scale is fixed in
  444.       each direction when a connection is opened.  (Another design
  445.       choice would be to specify the window scale in every TCP segment.
  446.       It would be incorrect to send a window scale option only when the
  447.       scale factor changed, since a TCP option in an acknowledgement
  448.       segment will not be delivered reliably (unless the ACK happens to
  449.       be piggy-backed on data in the other direction).  Fixing the scale
  450.       when the connection is opened has the advantage of lower overhead
  451.       but the disadvantage that the scale factor cannot be changed
  452.       during the connection.)
  453.  
  454.       The maximum receive window, and therefore the scale factor, is
  455.       determined by the maximum receive buffer space.  In a typical
  456.       modern implementation, this maximum buffer space is set by default
  457.       but can be overridden by a user program before a TCP connection is
  458.       opened.  This determines the scale factor, and therefore no new
  459.       user interface is needed for window scaling.
  460.  
  461.  
  462.  
  463. Network Working Group      Expires August 1997                  [Page 8]
  464.  
  465. Internet-Draft     TCP Extensions for High Performance     February 1997
  466.  
  467.  
  468.    2.2  Window Scale Option
  469.  
  470.       The three-byte Window Scale option may be sent in a SYN segment by
  471.       a TCP.  It has two purposes: (1) indicate that the TCP is prepared
  472.       to do both send and receive window scaling, and (2) communicate a
  473.       scale factor to be applied to its receive window.  Thus, a TCP
  474.       that is prepared to scale windows should send the option, even if
  475.       its own scale factor is 1.  The scale factor is limited to a power
  476.       of two and encoded logarithmically, so it may be implemented by
  477.       binary shift operations.
  478.  
  479.  
  480.       TCP Window Scale Option (WSopt):
  481.  
  482.          Kind: 3
  483.  
  484.          Length: 3 bytes
  485.  
  486.                 +---------+---------+---------+
  487.                 | Kind=3  |Length=3 |shift.cnt|
  488.                 +---------+---------+---------+
  489.  
  490.  
  491.          This option is an offer, not a promise; both sides must send
  492.          Window Scale options in their SYN segments to enable window
  493.          scaling in either direction.  If window scaling is enabled,
  494.          then the TCP that sent this option will right-shift its true
  495.          receive-window values by 'shift.cnt' bits for transmission in
  496.          SEG.WND.  The value 'shift.cnt' may be zero (offering to scale,
  497.          while applying a scale factor of 1 to the receive window).
  498.  
  499.          This option may be sent in an initial <SYN> segment (i.e., a
  500.          segment with the SYN bit on and the ACK bit off).  It may also
  501.          be sent in a <SYN,ACK> segment, but only if a Window Scale
  502.          option was received in the initial <SYN> segment.  A Window
  503.          Scale option in a segment without a SYN bit should be ignored.
  504.  
  505.          The Window field in a SYN (i.e., a <SYN> or <SYN,ACK>) segment
  506.          itself is never scaled.
  507.  
  508.    2.3  Using the Window Scale Option
  509.  
  510.       A model implementation of window scaling is as follows, using the
  511.       notation of RFC-793 [Postel81]:
  512.  
  513.       *    All windows are treated as 32-bit quantities for storage in
  514.            the connection control block and for local calculations.
  515.            This includes the send-window (SND.WND) and the receive-
  516.            window (RCV.WND) values, as well as the congestion window.
  517.  
  518.  
  519.  
  520.  
  521. Network Working Group      Expires August 1997                  [Page 9]
  522.  
  523. Internet-Draft     TCP Extensions for High Performance     February 1997
  524.  
  525.  
  526.       *    The connection state is augmented by two window shift counts,
  527.            Snd.Wind.Scale and Rcv.Wind.Scale, to be applied to the
  528.            incoming and outgoing window fields, respectively.
  529.  
  530.       *    If a TCP receives a <SYN> segment containing a Window Scale
  531.            option, it sends its own Window Scale option in the <SYN,ACK>
  532.            segment.
  533.  
  534.       *    The Window Scale option is sent with shift.cnt = R, where R
  535.            is the value that the TCP would like to use for its receive
  536.            window.
  537.  
  538.       *    Upon receiving a SYN segment with a Window Scale option
  539.            containing shift.cnt = S, a TCP sets Snd.Wind.Scale to S and
  540.            sets Rcv.Wind.Scale to R; otherwise, it sets both
  541.            Snd.Wind.Scale and Rcv.Wind.Scale to zero.
  542.  
  543.       *    The window field (SEG.WND) in the header of every incoming
  544.            segment, with the exception of SYN segments, is left-shifted
  545.            by Snd.Wind.Scale bits before updating SND.WND:
  546.  
  547.               SND.WND = SEG.WND << Snd.Wind.Scale
  548.  
  549.            (assuming the other conditions of RFC793 are met, and using
  550.            the "C" notation "<<" for left-shift).
  551.  
  552.       *    The window field (SEG.WND) of every outgoing segment, with
  553.            the exception of SYN segments, is right-shifted by
  554.            Rcv.Wind.Scale bits:
  555.  
  556.               SEG.WND = RCV.WND >> Rcv.Wind.Scale.
  557.  
  558.  
  559.       TCP determines if a data segment is "old" or "new" by testing
  560.       whether its sequence number is within 2**31 bytes of the left edge
  561.       of the window, and if it is not, discarding the data as "old".  To
  562.       insure that new data is never mistakenly considered old and vice-
  563.       versa, the left edge of the sender's window has to be at most
  564.       2**31 away from the right edge of the receiver's window.
  565.       Similarly with the sender's right edge and receiver's left edge.
  566.       Since the right and left edges of either the sender's or
  567.       receiver's window differ by the window size, and since the sender
  568.       and receiver windows can be out of phase by at most the window
  569.       size, the above constraints imply that 2 * the max window size
  570.       must be less than 2**31, or
  571.  
  572.            max window < 2**30
  573.  
  574.       Since the max window is 2**S (where S is the scaling shift count)
  575.       times at most 2**16 - 1 (the maximum unscaled window), the maximum
  576.  
  577.  
  578.  
  579. Network Working Group      Expires August 1997                 [Page 10]
  580.  
  581. Internet-Draft     TCP Extensions for High Performance     February 1997
  582.  
  583.  
  584.       window is guaranteed to be < 2*30 if S <= 14.  Thus, the shift
  585.       count must be limited to 14 (which allows windows of 2**30 = 1
  586.       Gbyte).  If a Window Scale option is received with a shift.cnt
  587.       value exceeding 14, the TCP should log the error but use 14
  588.       instead of the specified value.
  589.  
  590.       The scale factor applies only to the Window field as transmitted
  591.       in the TCP header; each TCP using extended windows will maintain
  592.       the window values locally as 32-bit numbers.  For example, the
  593.       "congestion window" computed by Slow Start and Congestion
  594.       Avoidance is not affected by the scale factor, so window scaling
  595.       will not introduce quantization into the congestion window.
  596.  
  597. 3.  RTTM: ROUND-TRIP TIME MEASUREMENT
  598.  
  599.    3.1  Introduction
  600.  
  601.       Accurate and current RTT estimates are necessary to adapt to
  602.       changing traffic conditions and to avoid an instability known as
  603.       "congestion collapse" [Nagle84] in a busy network.  However,
  604.       accurate measurement of RTT may be difficult both in theory and in
  605.       implementation.
  606.  
  607.       Many TCP implementations base their RTT measurements upon a sample
  608.       of one packet per window or less.  While this yields an adequate
  609.       approximation to the RTT for small windows, it results in an
  610.       unacceptably poor RTT estimate for an LFN.  If we look at RTT
  611.       estimation as a signal processing problem (which it is), a data
  612.       signal at some frequency, the packet rate, is being sampled at a
  613.       lower frequency, the window rate.  This lower sampling frequency
  614.       violates Nyquist's criteria and may therefore introduce "aliasing"
  615.       artifacts into the estimated RTT [Hamming77].
  616.  
  617.       A good RTT estimator with a conservative retransmission timeout
  618.       calculation can tolerate aliasing when the sampling frequency is
  619.       "close" to the data frequency.   For example, with a window of 8
  620.       packets, the sample rate is 1/8 the data frequency -- less than an
  621.       order of magnitude different.  However, when the window is tens or
  622.       hundreds of packets, the RTT estimator may be seriously in error,
  623.       resulting in spurious retransmissions.
  624.  
  625.       If there are dropped packets, the problem becomes worse.  Zhang
  626.       [Zhang86], Jain [Jain86] and Karn [Karn87] have shown that it is
  627.       not possible to accumulate reliable RTT estimates if retransmitted
  628.       segments are included in the estimate.  Since a full window of
  629.       data will have been transmitted prior to a retransmission, all of
  630.       the segments in that window will have to be ACKed before the next
  631.       RTT sample can be taken.  This means at least an additional
  632.       window's worth of time between RTT measurements and, as the error
  633.       rate approaches one per window of data (e.g., 10**-6 errors per
  634.  
  635.  
  636.  
  637. Network Working Group      Expires August 1997                 [Page 11]
  638.  
  639. Internet-Draft     TCP Extensions for High Performance     February 1997
  640.  
  641.  
  642.       bit for the Wideband satellite network), it becomes effectively
  643.       impossible to obtain a valid RTT measurement.
  644.  
  645.       A solution to these problems, which actually simplifies the sender
  646.       substantially, is as follows: using TCP options, the sender places
  647.       a timestamp in each data segment, and the receiver reflects these
  648.       timestamps back in ACK segments.  Then a single subtract gives the
  649.       sender an accurate RTT measurement for every ACK segment (which
  650.       will correspond to every other data segment, with a sensible
  651.       receiver).  We call this the RTTM (Round-Trip Time Measurement)
  652.       mechanism.
  653.  
  654.       It is vitally important to use the RTTM mechanism with big
  655.       windows; otherwise, the door is opened to some dangerous
  656.       instabilities due to aliasing.  Furthermore, the option is
  657.       probably useful for all TCP's, since it simplifies the sender.
  658.  
  659.    3.2  TCP Timestamps Option
  660.  
  661.       TCP is a symmetric protocol, allowing data to be sent at any time
  662.       in either direction, and therefore timestamp echoing may occur in
  663.       either direction.  For simplicity and symmetry, we specify that
  664.       timestamps always be sent and echoed in both directions.  For
  665.       efficiency, we combine the timestamp and timestamp reply fields
  666.       into a single TCP Timestamps Option.
  667.  
  668.       TCP Timestamps Option (TSopt):
  669.  
  670.          Kind: 8
  671.  
  672.          Length: 10 bytes
  673.  
  674.           +-------+-------+---------------------+---------------------+
  675.           |Kind=8 |  10   |   TS Value (TSval)  |TS Echo Reply (TSecr)|
  676.           +-------+-------+---------------------+---------------------+
  677.               1       1              4                     4
  678.  
  679.          The Timestamps option carries two four-byte timestamp fields.
  680.          The Timestamp Value field (TSval) contains the current value of
  681.          the timestamp clock of the TCP sending the option.
  682.  
  683.          The Timestamp Echo Reply field (TSecr) is only valid if the ACK
  684.          bit is set in the TCP header; if it is valid, it echos a
  685.          timestamp value that was sent by the remote TCP in the TSval
  686.          field of a Timestamps option.  When TSecr is not valid, its
  687.          value must be zero.  The TSecr value will generally be from the
  688.          most recent Timestamp option that was received; however, there
  689.          are exceptions that are explained below.
  690.  
  691.          A TCP may send the Timestamps option (TSopt) in an initial
  692.  
  693.  
  694.  
  695. Network Working Group      Expires August 1997                 [Page 12]
  696.  
  697. Internet-Draft     TCP Extensions for High Performance     February 1997
  698.  
  699.  
  700.          <SYN> segment (i.e., a segment containing a SYN bit and no ACK
  701.          bit), and may send a TSopt in other segments only if it
  702.          received a TSopt in the initial <SYN> segment for the
  703.          connection.
  704.  
  705.    3.3 The RTTM Mechanism
  706.  
  707.       RTTM places a Timestamps option in every segment, with a TSval
  708.       that is obtained from a (virtual) "timestamp clock".  Values of
  709.       this clock values must be at least approximately proportional to
  710.       real time, in order to measure actual RTT.
  711.  
  712.       These TSval values are echoed in TSecr values in the reverse
  713.       direction.  The difference between a received TSecr value and the
  714.       current timestamp clock value provides an RTT measurement.
  715.  
  716.       When timestamps are used, every segment that is received will
  717.       contain a TSecr value; however, these values cannot all be used to
  718.       update the measured RTT.  The following example illustrates why.
  719.       It shows a one-way data flow with segments arriving in sequence
  720.       without loss.  Here A, B, C... represent data blocks occupying
  721.       successive blocks of sequence numbers, and ACK(A),...  represent
  722.       the corresponding cumulative acknowledgments.  The two timestamp
  723.       fields of the Timestamps option are shown symbolically as <TSval=
  724.       x,TSecr=y>.  Each TSecr field contains the value most recently
  725.       received in a TSval field; these echoed values. labelled
  726.       "TS.Recent", are shown in parentheses.
  727.  
  728.          TCP  A                                            TCP B
  729.  
  730.        (TS.Recent)                                        (TS.Recent)
  731.  
  732.       1.  (120)             <A,TSval=1,TSecr=120> --->       (1)
  733.  
  734.       2.  (125)  <--- <ACK(A),TSval=125,TSecr=1>             (1)
  735.  
  736.       3.  (125)             <B,TSval=6,TSecr=125> --->       (6)
  737.  
  738.       4.  (130)  <--- <ACK(B),TSval=130,TSecr=6>             (6)
  739.  
  740.              . . . ( Pause for 60 timestamp clock ticks ) . . . .
  741.  
  742.  
  743.       5.  (130)             <C,TSval=1,TSecr=120> --->       (1)
  744.  
  745.       6.  (125)  <--- <ACK(A),TSval=125,TSecr=1>             (1)
  746.  
  747.       4.  (127)  <b,ACK(x),TSval=65,TSecr=127> --->  ...
  748.  
  749.       5.            ... <--- <y,ACK(A),TSval=191,TSecr=5>    (5)
  750.  
  751.  
  752.  
  753. Network Working Group      Expires August 1997                 [Page 13]
  754.  
  755. Internet-Draft     TCP Extensions for High Performance     February 1997
  756.  
  757.  
  758.  
  759.  
  760.  
  761.          TCP  A                                          TCP B
  762.  
  763.                         <A,TSval=1,TSecr=120> ------>
  764.  
  765.              <---- <ACK(A),TSval=127,TSecr=1>
  766.  
  767.                         <B,TSval=5,TSecr=127> ------>
  768.  
  769.              <---- <ACK(B),TSval=131,TSecr=5>
  770.  
  771.              . . . . . . . . . . . . . . . . . . . . . .
  772.  
  773.                         <C,TSval=65,TSecr=131> ------>
  774.  
  775.              <---- <ACK(C),TSval=191,TSecr=65>
  776.  
  777.                         (etc)
  778.  
  779.  
  780.       The dotted line marks a pause (60 time units long) in which A had
  781.       nothing to send.  Note that this pause inflates the RTT which B
  782.       could infer from receiving TSecr=131 in data segment C.  Thus, in
  783.       one-way data flows, RTTM in the reverse direction measures a value
  784.       that is inflated by gaps in sending data.  However, the following
  785.       rule prevents a resulting inflation of the measured RTT:
  786.  
  787.            RTTM Rule: A TSecr value received in a segment is used to
  788.            update the averaged RTT measurement only if the segment
  789.            acknowledges some new data, i.e., only if it advances the
  790.            left edge of the send window.
  791.  
  792.       Since TCP B is not sending data, the data segment C does not
  793.       acknowledge any new data when it arrives at B.  Thus, the inflated
  794.       RTTM measurement is not used to update B's RTTM measurement.
  795.  
  796.    3.4  Which Timestamp to Echo
  797.  
  798.       If more than one Timestamps option is received before a reply
  799.       segment is sent, the TCP must choose only one of the TSvals to
  800.       echo, ignoring the others.  To minimize the state kept in the
  801.       receiver (i.e., the number of unprocessed TSvals), the receiver
  802.       should be required to retain at most one timestamp in the
  803.       connection control block.
  804.  
  805.       There are three situations to consider:
  806.  
  807.       (A)  Delayed ACKs.
  808.  
  809.  
  810.  
  811. Network Working Group      Expires August 1997                 [Page 14]
  812.  
  813. Internet-Draft     TCP Extensions for High Performance     February 1997
  814.  
  815.  
  816.            Many TCP's acknowledge only every Kth segment out of a group
  817.            of segments arriving within a short time interval; this
  818.            policy is known generally as "delayed ACKs".  The data-sender
  819.            TCP must measure the effective RTT, including the additional
  820.            time due to delayed ACKs, or else it will retransmit
  821.            unnecessarily.  Thus, when delayed ACKs are in use, the
  822.            receiver should reply with the TSval field from the earliest
  823.            unacknowledged segment.
  824.  
  825.       (B)  A hole in the sequence space (segment(s) have been lost).
  826.  
  827.            The sender will continue sending until the window is filled,
  828.            and the receiver may be generating ACKs as these out-of-order
  829.            segments arrive (e.g., to aid "fast retransmit").
  830.  
  831.            The lost segment is probably a sign of congestion, and in
  832.            that situation the sender should be conservative about
  833.            retransmission.  Furthermore, it is better to overestimate
  834.            than underestimate the RTT.  An ACK for an out-of-order
  835.            segment should therefore contain the timestamp from the most
  836.            recent segment that advanced the window.
  837.  
  838.            The same situation occurs if segments are re-ordered by the
  839.            network.
  840.  
  841.       (C)  A filled hole in the sequence space.
  842.  
  843.            The segment that fills the hole represents the most recent
  844.            measurement of the network characteristics.  On the other
  845.            hand, an RTT computed from an earlier segment would probably
  846.            include the sender's retransmit time-out, badly biasing the
  847.            sender's average RTT estimate.  Thus, the timestamp from the
  848.            latest segment (which filled the hole) must be echoed.
  849.  
  850.       An algorithm that covers all three cases is described in the
  851.       following rules for Timestamps option processing on a synchronized
  852.       connection:
  853.  
  854.       (1)  The connection state is augmented with two 32-bit slots:
  855.            TS.Recent holds a timestamp to be echoed in TSecr whenever a
  856.            segment is sent, and Last.ACK.sent holds the ACK field from
  857.            the last segment sent.  Last.ACK.sent will equal RCV.NXT
  858.            except when ACKs have been delayed.
  859.  
  860.       (2)  If:
  861.  
  862.               SEG.TSval >= TSrecent and SEG.SEQ <= Last.ACK.sent
  863.  
  864.            then SEG.TSval is copied to TS.Recent; otherwise, it is
  865.            ignored.
  866.  
  867.  
  868.  
  869. Network Working Group      Expires August 1997                 [Page 15]
  870.  
  871. Internet-Draft     TCP Extensions for High Performance     February 1997
  872.  
  873.  
  874.       (3)  When a TSopt is sent, its TSecr field is set to the current
  875.            TS.Recent value.
  876.  
  877.       The following examples illustrate these rules.  Here A, B, C...
  878.       represent data segments occupying successive blocks of sequence
  879.       numbers, and ACK(A),...  represent the corresponding
  880.       acknowledgment segments.  Note that ACK(A) has the same sequence
  881.       number as B.  We show only one direction of timestamp echoing, for
  882.       clarity.
  883.  
  884.       o    Packets arrive in sequence, and some of the ACKs are delayed.
  885.  
  886.            By Case (A), the timestamp from the oldest unacknowledged
  887.            segment is echoed.
  888.  
  889.                                                       TS.Recent
  890.                     <A, TSval=1> ------------------->
  891.                                                           1
  892.                     <B, TSval=2> ------------------->
  893.                                                           1
  894.                     <C, TSval=3> ------------------->
  895.                                                           1
  896.                              <---- <ACK(C), TSecr=1>
  897.                     (etc)
  898.  
  899.       o    Packets arrive out of order, and every packet is
  900.            acknowledged.
  901.  
  902.            By Case (B), the timestamp from the last segment that
  903.            advanced the left window edge is echoed, until the missing
  904.            segment arrives; it is echoed according to Case (C).  The
  905.            same sequence would occur if segments B and D were lost and
  906.            retransmitted..
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927. Network Working Group      Expires August 1997                 [Page 16]
  928.  
  929. Internet-Draft     TCP Extensions for High Performance     February 1997
  930.  
  931.  
  932.                                                       TS.Recent
  933.                     <A, TSval=1> ------------------->
  934.                                                           1
  935.                              <---- <ACK(A), TSecr=1>
  936.                                                           1
  937.                     <C, TSval=3> ------------------->
  938.                                                           1
  939.                              <---- <ACK(A), TSecr=1>
  940.                                                           1
  941.                     <B, TSval=2> ------------------->
  942.                                                           2
  943.                              <---- <ACK(C), TSecr=2>
  944.                                                           2
  945.                     <E, TSval=5> ------------------->
  946.                                                           2
  947.                              <---- <ACK(C), TSecr=2>
  948.                                                           2
  949.                     <D, TSval=4> ------------------->
  950.                                                           4
  951.                              <---- <ACK(E), TSecr=4>
  952.                     (etc)
  953.  
  954.  
  955.  
  956.  
  957.  
  958. 4.  PAWS: PROTECT AGAINST WRAPPED SEQUENCE NUMBERS
  959.  
  960.    4.1  Introduction
  961.  
  962.       Section 4.2 describes a simple mechanism to reject old duplicate
  963.       segments that might corrupt an open TCP connection; we call this
  964.       mechanism PAWS (Protect Against Wrapped Sequence numbers).  PAWS
  965.       operates within a single TCP connection, using state that is saved
  966.       in the connection control block.  Section 4.3 and Appendix C
  967.       discuss the implications of the PAWS mechanism for avoiding old
  968.       duplicates from previous incarnations of the same connection.
  969.  
  970.    4.2  The PAWS Mechanism
  971.  
  972.       PAWS uses the same TCP Timestamps option as the RTTM mechanism
  973.       described earlier, and assumes that every received TCP segment
  974.       (including data and ACK segments) contains a timestamp SEG.TSval
  975.       whose values are monotone non-decreasing in time.  The basic idea
  976.       is that a segment can be discarded as an old duplicate if it is
  977.       received with a timestamp SEG.TSval less than some timestamp
  978.       recently received on this connection.
  979.  
  980.       In both the PAWS and the RTTM mechanism, the "timestamps" are
  981.       32-bit unsigned integers in a modular 32-bit space.  Thus, "less
  982.  
  983.  
  984.  
  985. Network Working Group      Expires August 1997                 [Page 17]
  986.  
  987. Internet-Draft     TCP Extensions for High Performance     February 1997
  988.  
  989.  
  990.       than" is defined the same way it is for TCP sequence numbers, and
  991.       the same implementation techniques apply.  If s and t are
  992.       timestamp values, s < t if 0 < (t - s) < 2**31, computed in
  993.       unsigned 32-bit arithmetic.
  994.  
  995.       The choice of incoming timestamps to be saved for this comparison
  996.       must guarantee a value that is monotone increasing.  For example,
  997.       we might save the timestamp from the segment that last advanced
  998.       the left edge of the receive window, i.e., the most recent in-
  999.       sequence segment.  Instead, we choose the value TS.Recent
  1000.       introduced in Section 3.4 for the RTTM mechanism, since using a
  1001.       common value for both PAWS and RTTM simplifies the implementation
  1002.       of both.  As Section 3.4 explained, TS.Recent differs from the
  1003.       timestamp from the last in-sequence segment only in the case of
  1004.       delayed ACKs, and therefore by less than one window.  Either
  1005.       choice will therefore protect against sequence number wrap-around.
  1006.  
  1007.       RTTM was specified in a symmetrical manner, so that TSval
  1008.       timestamps are carried in both data and ACK segments and are
  1009.       echoed in TSecr fields carried in returning ACK or data segments.
  1010.       PAWS submits all incoming segments to the same test, and therefore
  1011.       protects against duplicate ACK segments as well as data segments.
  1012.       (An alternative un-symmetric algorithm would protect against old
  1013.       duplicate ACKs: the sender of data would reject incoming ACK
  1014.       segments whose TSecr values were less than the TSecr saved from
  1015.       the last segment whose ACK field advanced the left edge of the
  1016.       send window.  This algorithm was deemed to lack economy of
  1017.       mechanism and symmetry.)
  1018.  
  1019.       TSval timestamps sent on {SYN} and {SYN,ACK} segments are used to
  1020.       initialize PAWS.  PAWS protects against old duplicate non-SYN
  1021.       segments, and duplicate SYN segments received while there is a
  1022.       synchronized connection.  Duplicate {SYN} and {SYN,ACK} segments
  1023.       received when there is no connection will be discarded by the
  1024.       normal 3-way handshake and sequence number checks of TCP.
  1025.  
  1026.       It is recommended that RST segments NOT carry timestamps, and that
  1027.       RST segments be acceptable regardless of their timestamp.  Old
  1028.       duplicate RST segments should be exceedingly unlikely, and their
  1029.       cleanup function should take precedence over timestamps.
  1030.  
  1031.       4.2.1  Basic PAWS Algorithm
  1032.  
  1033.          The PAWS algorithm requires the following processing to be
  1034.          performed on all incoming segments for a synchronized
  1035.          connection:
  1036.  
  1037.          R1)  If there is a Timestamps option in the arriving segment
  1038.               and SEG.TSval < TS.Recent and if TS.Recent is valid (see
  1039.               later discussion), then treat the arriving segment as not
  1040.  
  1041.  
  1042.  
  1043. Network Working Group      Expires August 1997                 [Page 18]
  1044.  
  1045. Internet-Draft     TCP Extensions for High Performance     February 1997
  1046.  
  1047.  
  1048.               acceptable:
  1049.  
  1050.                    Send an acknowledgement in reply as specified in
  1051.                    RFC-793 page 69 and drop the segment.
  1052.  
  1053.                    Note: it is necessary to send an ACK segment in order
  1054.                    to retain TCP's mechanisms for detecting and
  1055.                    recovering from half-open connections.  For example,
  1056.                    see Figure 10 of RFC-793.
  1057.  
  1058.  
  1059.          R2)  If the segment is outside the window, reject it (normal
  1060.               TCP processing)
  1061.  
  1062.          R3)  If an arriving segment satisfies: SEG.SEQ <= Last.ACK.sent
  1063.               (see Section 3.4), then record its timestamp in TS.Recent.
  1064.  
  1065.          R4)  If an arriving segment is in-sequence (i.e., at the left
  1066.               window edge), then accept it normally.
  1067.  
  1068.          R5)  Otherwise, treat the segment as a normal in-window, out-
  1069.               of-sequence TCP segment (e.g., queue it for later delivery
  1070.               to the user).
  1071.  
  1072.          Steps R2, R4, and R5 are the normal TCP processing steps
  1073.          specified by RFC-793.
  1074.  
  1075.          It is important to note that the timestamp is checked only when
  1076.          a segment first arrives at the receiver, regardless of whether
  1077.          it is in-sequence or it must be queued for later delivery.
  1078.          Consider the following example.
  1079.  
  1080.               Suppose the segment sequence: A.1, B.1, C.1, ..., Z.1 has
  1081.               been sent, where the letter indicates the sequence number
  1082.               and the digit represents the timestamp.  Suppose also that
  1083.               segment B.1 has been lost.  The timestamp in TS.TStamp is
  1084.               1 (from A.1), so C.1, ..., Z.1 are considered acceptable
  1085.               and are queued.  When B is retransmitted as segment B.2
  1086.               (using the latest timestamp), it fills the hole and causes
  1087.               all the segments through Z to be acknowledged and passed
  1088.               to the user.  The timestamps of the queued segments are
  1089.               *not* inspected again at this time, since they have
  1090.               already been accepted.  When B.2 is accepted, TS.Stamp is
  1091.               set to 2.
  1092.  
  1093.          This rule allows reasonable performance under loss.  A full
  1094.          window of data is in transit at all times, and after a loss a
  1095.          full window less one packet will show up out-of-sequence to be
  1096.          queued at the receiver (e.g., up to ~2**30 bytes of data); the
  1097.          timestamp option must not result in discarding this data.
  1098.  
  1099.  
  1100.  
  1101. Network Working Group      Expires August 1997                 [Page 19]
  1102.  
  1103. Internet-Draft     TCP Extensions for High Performance     February 1997
  1104.  
  1105.  
  1106.          In certain unlikely circumstances, the algorithm of rules R1-R4
  1107.          could lead to discarding some segments unnecessarily, as shown
  1108.          in the following example:
  1109.  
  1110.               Suppose again that segments: A.1, B.1, C.1, ..., Z.1 have
  1111.               been sent in sequence and that segment B.1 has been lost.
  1112.               Furthermore, suppose delivery of some of C.1, ... Z.1 is
  1113.               delayed until AFTER the retransmission B.2 arrives at the
  1114.               receiver.  These delayed segments will be discarded
  1115.               unnecessarily when they do arrive, since their timestamps
  1116.               are now out of date.
  1117.  
  1118.          This case is very unlikely to occur.  If the retransmission was
  1119.          triggered by a timeout, some of the segments C.1, ... Z.1 must
  1120.          have been delayed longer than the RTO time.  This is presumably
  1121.          an unlikely event, or there would be many spurious timeouts and
  1122.          retransmissions.  If B's retransmission was triggered by the
  1123.          "fast retransmit" algorithm, i.e., by duplicate ACKs, then the
  1124.          queued segments that caused these ACKs must have been received
  1125.          already.
  1126.  
  1127.          Even if a segment were delayed past the RTO, the Fast
  1128.          Retransmit mechanism [Jacobson90c] will cause the delayed
  1129.          packets to be retransmitted at the same time as B.2, avoiding
  1130.          an extra RTT and therefore causing a very small performance
  1131.          penalty.
  1132.  
  1133.          We know of no case with a significant probability of occurrence
  1134.          in which timestamps will cause performance degradation by
  1135.          unnecessarily discarding segments.
  1136.  
  1137.       4.2.2  Timestamp Clock
  1138.  
  1139.          It is important to understand that the PAWS algorithm does not
  1140.          require clock synchronization between sender and receiver.  The
  1141.          sender's timestamp clock is used to stamp the segments, and the
  1142.          sender uses the echoed timestamp to measure RTT's.  However,
  1143.          the receiver treats the timestamp as simply a monotone-
  1144.          increasing serial number, without any necessary connection to
  1145.          its clock.  From the receiver's viewpoint, the timestamp is
  1146.          acting as a logical extension of the high-order bits of the
  1147.          sequence number.
  1148.  
  1149.          The receiver algorithm does place some requirements on the
  1150.          frequency of the timestamp clock.
  1151.  
  1152.          (a)  The timestamp clock must not be "too slow".
  1153.  
  1154.               It must tick at least once for each 2**31 bytes sent.  In
  1155.               fact, in order to be useful to the sender for round trip
  1156.  
  1157.  
  1158.  
  1159. Network Working Group      Expires August 1997                 [Page 20]
  1160.  
  1161. Internet-Draft     TCP Extensions for High Performance     February 1997
  1162.  
  1163.  
  1164.               timing, the clock should tick at least once per window's
  1165.               worth of data, and even with the RFC-1072 window
  1166.               extension, 2**31 bytes must be at least two windows.
  1167.  
  1168.               To make this more quantitative, any clock faster than 1
  1169.               tick/sec will reject old duplicate segments for link
  1170.               speeds of ~8 Gbps.  A 1ms timestamp clock will work at
  1171.               link speeds up to 8 Tbps (8*10**12) bps!
  1172.  
  1173.          (b)  The timestamp clock must not be "too fast".
  1174.  
  1175.               Its recycling time must be greater than MSL seconds.
  1176.               Since the clock (timestamp) is 32 bits and the worst-case
  1177.               MSL is 255 seconds, the maximum acceptable clock frequency
  1178.               is one tick every 59 ns.
  1179.  
  1180.               However, it is desirable to establish a much longer
  1181.               recycle period, in order to handle outdated timestamps on
  1182.               idle connections (see Section 4.2.3), and to relax the MSL
  1183.               requirement for preventing sequence number wrap-around.
  1184.               With a 1 ms timestamp clock, the 32-bit timestamp will
  1185.               wrap its sign bit in 24.8 days.  Thus, it will reject old
  1186.               duplicates on the same connection if MSL is 24.8 days or
  1187.               less.  This appears to be a very safe figure; an MSL of
  1188.               24.8 days or longer can probably be assumed by the gateway
  1189.               system without requiring precise MSL enforcement by the
  1190.               TTL value in the IP layer.
  1191.  
  1192.          Based upon these considerations, we choose a timestamp clock
  1193.          frequency in the range 1 ms to 1 sec per tick.  This range also
  1194.          matches the requirements of the RTTM mechanism, which does not
  1195.          need much more resolution than the granularity of the
  1196.          retransmit timer, e.g., tens or hundreds of milliseconds.
  1197.  
  1198.          The PAWS mechanism also puts a strong monotonicity requirement
  1199.          on the sender's timestamp clock.  The method of implementation
  1200.          of the timestamp clock to meet this requirement depends upon
  1201.          the system hardware and software.
  1202.  
  1203.          *    Some hosts have a hardware clock that is guaranteed to be
  1204.               monotonic between hardware resets.
  1205.  
  1206.          *    A clock interrupt may be used to simply increment a binary
  1207.               integer by 1 periodically.
  1208.  
  1209.          *    The timestamp clock may be derived from a system clock
  1210.               that is subject to being abruptly changed, by adding a
  1211.               variable offset value.  This offset is initialized to
  1212.               zero.  When a new timestamp clock value is needed, the
  1213.               offset can be adjusted as necessary to make the new value
  1214.  
  1215.  
  1216.  
  1217. Network Working Group      Expires August 1997                 [Page 21]
  1218.  
  1219. Internet-Draft     TCP Extensions for High Performance     February 1997
  1220.  
  1221.  
  1222.               equal to or larger than the previous value (which was
  1223.               saved for this purpose).
  1224.  
  1225.  
  1226.       4.2.3  Outdated Timestamps
  1227.  
  1228.          If a connection remains idle long enough for the timestamp
  1229.          clock of the other TCP to wrap its sign bit, then the value
  1230.          saved in TS.Recent will become too old; as a result, the PAWS
  1231.          mechanism will cause all subsequent segments to be rejected,
  1232.          freezing the connection (until the timestamp clock wraps its
  1233.          sign bit again).
  1234.  
  1235.          With the chosen range of timestamp clock frequencies (1 sec to
  1236.          1 ms), the time to wrap the sign bit will be between 24.8 days
  1237.          and 24800 days.  A TCP connection that is idle for more than 24
  1238.          days and then comes to life is exceedingly unusual.  However,
  1239.          it is undesirable in principle to place any limitation on TCP
  1240.          connection lifetimes.
  1241.  
  1242.          We therefore require that an implementation of PAWS include a
  1243.          mechanism to "invalidate" the TS.Recent value when a connection
  1244.          is idle for more than 24 days.  (An alternative solution to the
  1245.          problem of outdated timestamps would be to send keepalive
  1246.          segments at a very low rate, but still more often than the
  1247.          wrap-around time for timestamps, e.g., once a day.  This would
  1248.          impose negligible overhead.  However, the TCP specification has
  1249.          never included keepalives, so the solution based upon
  1250.          invalidation was chosen.)
  1251.  
  1252.          Note that a TCP does not know the frequency, and therefore, the
  1253.          wraparound time, of the other TCP, so it must assume the worst.
  1254.          The validity of TS.Recent needs to be checked only if the basic
  1255.          PAWS timestamp check fails, i.e., only if SEG.TSval <
  1256.          TS.Recent.  If TS.Recent is found to be invalid, then the
  1257.          segment is accepted, regardless of the failure of the timestamp
  1258.          check, and rule R3 updates TS.Recent with the TSval from the
  1259.          new segment.
  1260.  
  1261.          To detect how long the connection has been idle, the TCP may
  1262.          update a clock or timestamp value associated with the
  1263.          connection whenever TS.Recent is updated, for example.  The
  1264.          details will be implementation-dependent.
  1265.  
  1266.       4.2.4  Header Prediction
  1267.  
  1268.          "Header prediction" [Jacobson90a] is a high-performance
  1269.          transport protocol implementation technique that is most
  1270.          important for high-speed links.  This technique optimizes the
  1271.          code for the most common case, receiving a segment correctly
  1272.  
  1273.  
  1274.  
  1275. Network Working Group      Expires August 1997                 [Page 22]
  1276.  
  1277. Internet-Draft     TCP Extensions for High Performance     February 1997
  1278.  
  1279.  
  1280.          and in order.  Using header prediction, the receiver asks the
  1281.          question, "Is this segment the next in sequence?"  This
  1282.          question can be answered in fewer machine instructions than the
  1283.          question, "Is this segment within the window?"
  1284.  
  1285.          Adding header prediction to our timestamp procedure leads to
  1286.          the following recommended sequence for processing an arriving
  1287.          TCP segment:
  1288.  
  1289.          H1)  Check timestamp (same as step R1 above)
  1290.  
  1291.          H2)  Do header prediction: if segment is next in sequence and
  1292.               if there are no special conditions requiring additional
  1293.               processing, accept the segment, record its timestamp, and
  1294.               skip H3.
  1295.  
  1296.          H3)  Process the segment normally, as specified in RFC-793.
  1297.               This includes dropping segments that are outside the
  1298.               window and possibly sending acknowledgments, and queueing
  1299.               in-window, out-of-sequence segments.
  1300.  
  1301.  
  1302.          Another possibility would be to interchange steps H1 and H2,
  1303.          i.e., to perform the header prediction step H2 FIRST, and
  1304.          perform H1 and H3 only when header prediction fails.  This
  1305.          could be a performance improvement, since the timestamp check
  1306.          in step H1 is very unlikely to fail, and it requires interval
  1307.          arithmetic on a finite field, a relatively expensive operation.
  1308.          To perform this check on every single segment is contrary to
  1309.          the philosophy of header prediction.  We believe that this
  1310.          change might reduce CPU time for TCP protocol processing by up
  1311.          to 5-10% on high-speed networks.
  1312.  
  1313.          However, putting H2 first would create a hazard: a segment from
  1314.          2**32 bytes in the past might arrive at exactly the wrong time
  1315.          and be accepted mistakenly by the header-prediction step.  The
  1316.          following reasoning has been introduced [Jacobson90b] to show
  1317.          that the probability of this failure is negligible.
  1318.  
  1319.               If all segments are equally likely to show up as old
  1320.               duplicates, then the probability of an old duplicate
  1321.               exactly matching the left window edge is the maximum
  1322.               segment size (MSS) divided by the size of the sequence
  1323.               space.  This ratio must be less than 2**-16, since MSS
  1324.               must be < 2**16; for example, it will be (2**12)/(2**32) =
  1325.               2**-20 for an FDDI link.  However, the older a segment is,
  1326.               the less likely it is to be retained in the Internet, and
  1327.               under any reasonable model of segment lifetime the
  1328.               probability of an old duplicate exactly at the left window
  1329.               edge must be much smaller than 2**-16.
  1330.  
  1331.  
  1332.  
  1333. Network Working Group      Expires August 1997                 [Page 23]
  1334.  
  1335. Internet-Draft     TCP Extensions for High Performance     February 1997
  1336.  
  1337.  
  1338.               The 16 bit TCP checksum also allows a basic unreliability
  1339.               of one part in 2**16.  A protocol mechanism whose
  1340.               reliability exceeds the reliability of the TCP checksum
  1341.               should be considered "good enough", i.e., it won't
  1342.               contribute significantly to the overall error rate.  We
  1343.               therefore believe we can ignore the problem of an old
  1344.               duplicate being accepted by doing header prediction before
  1345.               checking the timestamp.
  1346.  
  1347.          However, this probabilistic argument is not universally
  1348.          accepted, and the consensus at present is that the performance
  1349.          gain does not justify the hazard in the general case.  It is
  1350.          therefore recommended that H2 follow H1.
  1351.  
  1352.  
  1353.    4.3.  Duplicates from Earlier Incarnations of Connection
  1354.  
  1355.       The PAWS mechanism protects against errors due to sequence number
  1356.       wrap-around on high-speed connection.  Segments from an earlier
  1357.       incarnation of the same connection are also a potential cause of
  1358.       old duplicate errors.  In both cases, the TCP mechanisms to
  1359.       prevent such errors depend upon the enforcement of a maximum
  1360.       segment lifetime (MSL) by the Internet (IP) layer (see Appendix of
  1361.       RFC-1185 for a detailed discussion).  Unlike the case of sequence
  1362.       space wrap-around, the MSL required to prevent old duplicate
  1363.       errors from earlier incarnations does not depend upon the transfer
  1364.       rate.  If the IP layer enforces the recommended 2 minute MSL of
  1365.       TCP, and if the TCP rules are followed, TCP connections will be
  1366.       safe from earlier incarnations, no matter how high the network
  1367.       speed.  Thus, the PAWS mechanism is not required for this case.
  1368.  
  1369.       We may still ask whether the PAWS mechanism can provide additional
  1370.       security against old duplicates from earlier connections, allowing
  1371.       us to relax the enforcement of MSL by the IP layer.  Appendix B
  1372.       explores this question, showing that further assumptions and/or
  1373.       mechanisms are required, beyond those of PAWS.  This is not part
  1374.       of the current extension.
  1375.  
  1376.  
  1377. 5.  CONCLUSIONS AND ACKNOWLEDGMENTS
  1378.  
  1379.    This memo presented a set of extensions to TCP to provide efficient
  1380.    operation over large-bandwidth*delay-product paths and reliable
  1381.    operation over very high-speed paths.  These extensions are designed
  1382.    to provide compatible interworking with TCP's that do not implement
  1383.    the extensions.
  1384.  
  1385.    These mechanisms are implemented using new TCP options for scaled
  1386.    windows and timestamps.  The timestamps are used for two distinct
  1387.    mechanisms: RTTM (Round Trip Time Measurement) and PAWS (Protect
  1388.  
  1389.  
  1390.  
  1391. Network Working Group      Expires August 1997                 [Page 24]
  1392.  
  1393. Internet-Draft     TCP Extensions for High Performance     February 1997
  1394.  
  1395.  
  1396.    Against Wrapped Sequences).
  1397.  
  1398.    The Window Scale option was originally suggested by Mike St. Johns of
  1399.    USAF/DCA.  The present form of the option was suggested by Mike
  1400.    Karels of UC Berkeley in response to a more cumbersome scheme defined
  1401.    by Van Jacobson.  Lixia Zhang helped formulate the PAWS mechanism
  1402.    description in RFC-1185.
  1403.  
  1404.    Finally, much of this work originated as the result of discussions
  1405.    within the End-to-End Task Force on the theoretical limitations of
  1406.    transport protocols in general and TCP in particular.  More recently,
  1407.    task force members and other on the end2end-interest list have made
  1408.    valuable contributions by pointing out flaws in the algorithms and
  1409.    the documentation.  The authors are grateful for all these
  1410.    contributions.
  1411.  
  1412. 6.  REFERENCES
  1413.  
  1414.       [Braden89] Braden, R., editor, "Requirements for Internet Hosts --
  1415.       Communication Layers", RFC 1122, October, 1989 [Clark87]  Clark,
  1416.       D., Lambert, M., and L. Zhang, "NETBLT: A Bulk Data Transfer
  1417.       Protocol", RFC 998, MIT, March 1987.
  1418.  
  1419.       [Garlick77]  Garlick, L., R. Rom, and J. Postel, "Issues in
  1420.       Reliable Host-to-Host Protocols", Proc. Second Berkeley Workshop
  1421.       on Distributed Data Management and Computer Networks, May 1977.
  1422.  
  1423.       [Hamming77]  Hamming, R., "Digital Filters", ISBN 0-13-212571-4,
  1424.       Prentice Hall, Englewood Cliffs, N.J., 1977.
  1425.  
  1426.       [Cheriton88]  Cheriton, D., "VMTP: Versatile Message Transaction
  1427.       Protocol", RFC 1045, Stanford University, February 1988.
  1428.  
  1429.       [Jacobson88a] Jacobson, V., "Congestion Avoidance and Control",
  1430.       SIGCOMM '88, Stanford, CA., August 1988.
  1431.  
  1432.       [Jacobson88b]  Jacobson, V., and R. Braden, "TCP Extensions for
  1433.       Long-Delay Paths", RFC-1072, LBL and USC/Information Sciences
  1434.       Institute, October 1988.
  1435.  
  1436.       [Jacobson90a]  Jacobson, V., "4BSD Header Prediction", ACM
  1437.       Computer Communication Review, April 1990.
  1438.  
  1439.       [Jacobson90b]  Jacobson, V., Braden, R., and Zhang, L., "TCP
  1440.       Extension for High-Speed Paths", RFC-1185, LBL and USC/Information
  1441.       Sciences Institute, October 1990.
  1442.  
  1443.       [Jacobson90c]  Jacobson, V., "Modified TCP congestion avoidance
  1444.       algorithm", Message to end2end-interest mailing list, April 1990.
  1445.  
  1446.  
  1447.  
  1448.  
  1449. Network Working Group      Expires August 1997                 [Page 25]
  1450.  
  1451. Internet-Draft     TCP Extensions for High Performance     February 1997
  1452.  
  1453.  
  1454.       [Jain86]  Jain, R., "Divergence of Timeout Algorithms for Packet
  1455.       Retransmissions", Proc. Fifth Phoenix Conf. on Comp. and Comm.,
  1456.       Scottsdale, Arizona, March 1986.
  1457.  
  1458.       [Karn87]  Karn, P. and C. Partridge, "Estimating Round-Trip Times
  1459.       in Reliable Transport Protocols", Proc. SIGCOMM '87, Stowe, VT,
  1460.       August 1987.
  1461.  
  1462.       [Mathis96] Mathis, M., Mahdavi, J., Floyd, S., and Romanow, A.,
  1463.       "TCP Selective Acknowledgment Options", RFC 2018, October, 1996.
  1464.  
  1465.       [McKenzie89]  McKenzie, A., "A Problem with the TCP Big Window
  1466.       Option", RFC 1110, BBN STC, August 1989.
  1467.  
  1468.       [Nagle84]  Nagle, J., "Congestion Control in IP/TCP
  1469.       Internetworks", RFC 896, FACC, January 1984.
  1470.  
  1471.       [NBS85]  Colella, R., Aronoff, R., and K. Mills, "Performance
  1472.       Improvements for ISO Transport", Ninth Data Comm Symposium,
  1473.       published in ACM SIGCOMM Comp Comm Review, vol. 15, no. 5,
  1474.       September 1985.
  1475.  
  1476.       [Postel81]  Postel, J., "Transmission Control Protocol - DARPA
  1477.       Internet Program Protocol Specification", RFC 793, DARPA,
  1478.       September 1981.
  1479.  
  1480.       [Postel83]  Postel, J., "The TCP Maximum Segment Size and Related
  1481.       Topics", RFC 879, ISI, November 1983.
  1482.  
  1483.       [Velten84] Velten, D., Hinden, R., and J. Sax, "Reliable Data
  1484.       Protocol", RFC 908, BBN, July 1984.
  1485.  
  1486.       [Watson81]  Watson, R., "Timer-based Mechanisms in Reliable
  1487.       Transport Protocol Connection Management", Computer Networks, Vol.
  1488.       5, 1981.
  1489.  
  1490.       [Zhang86]  Zhang, L., "Why TCP Timers Don't Work Well", Proc.
  1491.       SIGCOMM '86, Stowe, Vt., August 1986.
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507. Network Working Group      Expires August 1997                 [Page 26]
  1508.  
  1509. Internet-Draft     TCP Extensions for High Performance     February 1997
  1510.  
  1511.  
  1512.  
  1513.  
  1514. APPENDIX A:  IMPLEMENTATION SUGGESTIONS
  1515.  
  1516.    The following layouts are recommended for sending options on non-SYN
  1517.    segments, to achieve maximum feasible alignment of 32-bit and 64-bit
  1518.    machines.
  1519.  
  1520.  
  1521.        +--------+--------+--------+--------+
  1522.        |   NOP  |  NOP   |  TSopt |   10   |
  1523.        +--------+--------+--------+--------+
  1524.        |           TSval  timestamp        |
  1525.        +--------+--------+--------+--------+
  1526.        |           TSecr  timestamp        |
  1527.        +--------+--------+--------+--------+
  1528.  
  1529. APPENDIX B: DUPLICATES FROM EARLIER CONNECTION INCARNATIONS
  1530.  
  1531.    There are two cases to be considered:  (1) a system crashing (and
  1532.    losing connection state) and restarting, and (2) the same connection
  1533.    being closed and reopened without a loss of host state.  These will
  1534.    be described in the following two sections.
  1535.  
  1536.  
  1537.    B.1  System Crash with Loss of State
  1538.  
  1539.       TCP's quiet time of one MSL upon system startup handles the loss
  1540.       of connection state in a system crash/restart.  For an
  1541.       explanation, see for example "When to Keep Quiet" in the TCP
  1542.       protocol specification [Postel81].  The MSL that is required here
  1543.       does not depend upon the transfer speed.  The current TCP MSL of 2
  1544.       minutes seems acceptable as an operational compromise, as many
  1545.       host systems take this long to boot after a crash.
  1546.  
  1547.       However, the timestamp option may be used to ease the MSL
  1548.       requirements (or to provide additional security against data
  1549.       corruption).  If timestamps are being used and if the timestamp
  1550.       clock can be guaranteed to be monotonic over a system
  1551.       crash/restart, i.e., if the first value of the sender's timestamp
  1552.       clock after a crash/restart can be guaranteed to be greater than
  1553.       the last value before the restart, then a quiet time will be
  1554.       unnecessary.
  1555.  
  1556.       To dispense totally with the quiet time would require that the
  1557.       host clock be synchronized to a time source that is stable over
  1558.       the crash/restart period, with an accuracy of one timestamp clock
  1559.       tick or better.  We can back off from this strict requirement to
  1560.       take advantage of approximate clock synchronization.  Suppose that
  1561.       the clock is always re-synchronized to within N timestamp clock
  1562.  
  1563.  
  1564.  
  1565. Network Working Group      Expires August 1997                 [Page 27]
  1566.  
  1567. Internet-Draft     TCP Extensions for High Performance     February 1997
  1568.  
  1569.  
  1570.       ticks and that booting (extended with a quiet time, if necessary)
  1571.       takes more than N ticks.  This will guarantee monotonicity of the
  1572.       timestamps, which can then be used to reject old duplicates even
  1573.       without an enforced MSL.
  1574.  
  1575.    B.2  Closing and Reopening a Connection
  1576.  
  1577.       When a TCP connection is closed, a delay of 2*MSL in TIME-WAIT
  1578.       state ties up the socket pair for 4 minutes (see Section 3.5 of
  1579.       [Postel81].  Applications built upon TCP that close one connection
  1580.       and open a new one (e.g., an FTP data transfer connection using
  1581.       Stream mode) must choose a new socket pair each time.  The TIME-
  1582.       WAIT delay serves two different purposes:
  1583.  
  1584.       (a)  Implement the full-duplex reliable close handshake of TCP.
  1585.  
  1586.            The proper time to delay the final close step is not really
  1587.            related to the MSL; it depends instead upon the RTO for the
  1588.            FIN segments and therefore upon the RTT of the path.  (It
  1589.            could be argued that the side that is sending a FIN knows
  1590.            what degree of reliability it needs, and therefore it should
  1591.            be able to determine the length of the TIME-WAIT delay for
  1592.            the FIN's recipient.  This could be accomplished with an
  1593.            appropriate TCP option in FIN segments.)
  1594.  
  1595.            Although there is no formal upper-bound on RTT, common
  1596.            network engineering practice makes an RTT greater than 1
  1597.            minute very unlikely.  Thus, the 4 minute delay in TIME-WAIT
  1598.            state works satisfactorily to provide a reliable full-duplex
  1599.            TCP close.  Note again that this is independent of MSL
  1600.            enforcement and network speed.
  1601.  
  1602.            The TIME-WAIT state could cause an indirect performance
  1603.            problem if an application needed to repeatedly close one
  1604.            connection and open another at a very high frequency, since
  1605.            the number of available TCP ports on a host is less than
  1606.            2**16.  However, high network speeds are not the major
  1607.            contributor to this problem; the RTT is the limiting factor
  1608.            in how quickly connections can be opened and closed.
  1609.            Therefore, this problem will be no worse at high transfer
  1610.            speeds.
  1611.  
  1612.       (b)  Allow old duplicate segments to expire.
  1613.  
  1614.            To replace this function of TIME-WAIT state, a mechanism
  1615.            would have to operate across connections.  PAWS is defined
  1616.            strictly within a single connection; the last timestamp is
  1617.            TS.Recent is kept in the connection control block, and
  1618.            discarded when a connection is closed.
  1619.  
  1620.  
  1621.  
  1622.  
  1623. Network Working Group      Expires August 1997                 [Page 28]
  1624.  
  1625. Internet-Draft     TCP Extensions for High Performance     February 1997
  1626.  
  1627.  
  1628.            An additional mechanism could be added to the TCP, a per-host
  1629.            cache of the last timestamp received from any connection.
  1630.            This value could then be used in the PAWS mechanism to reject
  1631.            old duplicate segments from earlier incarnations of the
  1632.            connection, if the timestamp clock can be guaranteed to have
  1633.            ticked at least once since the old connection was open.  This
  1634.            would require that the TIME-WAIT delay plus the RTT together
  1635.            must be at least one tick of the sender's timestamp clock.
  1636.            Such an extension is not part of the proposal of this RFC.
  1637.  
  1638.            Note that this is a variant on the mechanism proposed by
  1639.            Garlick, Rom, and Postel [Garlick77], which required each
  1640.            host to maintain connection records containing the highest
  1641.            sequence numbers on every connection.  Using timestamps
  1642.            instead, it is only necessary to keep one quantity per remote
  1643.            host, regardless of the number of simultaneous connections to
  1644.            that host.
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681. Network Working Group      Expires August 1997                 [Page 29]
  1682.  
  1683. Internet-Draft     TCP Extensions for High Performance     February 1997
  1684.  
  1685.  
  1686. APPENDIX C: CHANGES FROM RFC-1072, RFC-1185, RFC-1323
  1687.  
  1688.    The protocol extensions defined in RFC-1323 document differ in
  1689.    several important ways from those defined in RFC-1072 and RFC-1185.
  1690.  
  1691.    (a)  SACK has been split off into a separate document, RFC 2018
  1692.         [Mathis96].
  1693.  
  1694.    (b)  The detailed rules for sending timestamp replies (see Section
  1695.         3.4) differ in important ways.  The earlier rules could result
  1696.         in an under-estimate of the RTT in certain cases (packets
  1697.         dropped or out of order).
  1698.  
  1699.    (c)  The same value TS.Recent is now shared by the two distinct
  1700.         mechanisms RTTM and PAWS.  This simplification became possible
  1701.         because of change (b).
  1702.  
  1703.    (d)  An ambiguity in RFC-1185 was resolved in favor of putting
  1704.         timestamps on ACK as well as data segments.  This supports the
  1705.         symmetry of the underlying TCP protocol.
  1706.  
  1707.    (e)  The echo and echo reply options of RFC-1072 were combined into a
  1708.         single Timestamps option, to reflect the symmetry and to
  1709.         simplify processing.
  1710.  
  1711.    (f)  The problem of outdated timestamps on long-idle connections,
  1712.         discussed in Section 4.2.2, was realized and resolved.
  1713.  
  1714.    (g)  RFC-1185 recommended that header prediction take precedence over
  1715.         the timestamp check.  Based upon some scepticism about the
  1716.         probabilistic arguments given in Section 4.2.4, it was decided
  1717.         to recommend that the timestamp check be performed first.
  1718.  
  1719.    (h)  The spec was modified so that the extended options will be sent
  1720.         on <SYN,ACK> segments only when they are received in the
  1721.         corresponding <SYN> segments.  This provides the most
  1722.         conservative possible conditions for interoperation with
  1723.         implementations without the extensions.
  1724.  
  1725.  
  1726.    In addition to these substantive changes, the present RFC attempts to
  1727.    specify the algorithms unambiguously by presenting modifications to
  1728.    the Event Processing rules of RFC-793; see Appendix F.
  1729.  
  1730.    There are additional changes in this document from RFC-1323.  These
  1731.    changes are:
  1732.  
  1733.    (a)  The description of which TSecr values can be used to update the
  1734.         measured RTT has been clarified.  Specifically, with Timestamps,
  1735.         the Karn algorithm [Karn87] is disabled.  The Karn algorithm
  1736.  
  1737.  
  1738.  
  1739. Network Working Group      Expires August 1997                 [Page 30]
  1740.  
  1741. Internet-Draft     TCP Extensions for High Performance     February 1997
  1742.  
  1743.  
  1744.         disables all RTT measurements during retransmission, since it is
  1745.         ambiguous whether the ACK is is for the original packet, or the
  1746.         retransmitted packet.  With Timestamps, that ambiguity is
  1747.         removed since the TSecr in the ACK will contain the TSval from
  1748.         which ever data packet made it to the destination.
  1749.  
  1750.    (b)  In RFC-1323, section 3.4, step (2) of the algorithm to control
  1751.         which timestamp is echoed was incorrect in two regards:
  1752.  
  1753.         (1)  It failed to update TSrecent for a retransmitted segment
  1754.              that resulted from a lost ACK.
  1755.  
  1756.         (2)  It failed if SEG.LEN = 0.
  1757.  
  1758.         In the new algorithm, the case of SEG.TSval = TSrecent is
  1759.         included for consistency with the PAWS test.
  1760.  
  1761.    (c)  One correction was made to the Event Processing Summary in
  1762.         Appendix F.  In SEND CALL/ESTABLISHED STATE, RCV.WND is used to
  1763.         fill in the SEG.WND value, not SND.WND.
  1764.  
  1765.    (d)  New pseudo-code summary has been added in Appendix E.
  1766.  
  1767.    (e)  A description was added describing the interaction between TCP
  1768.         options and the TCP MSS option in Appendix G.
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797. Network Working Group      Expires August 1997                 [Page 31]
  1798.  
  1799. Internet-Draft     TCP Extensions for High Performance     February 1997
  1800.  
  1801.  
  1802. APPENDIX D: SUMMARY OF NOTATION
  1803.  
  1804.    The following notation has been used in this document.
  1805.  
  1806.    Options
  1807.  
  1808.        WSopt:       TCP Window Scale Option
  1809.        TSopt:       TCP Timestamps Option
  1810.  
  1811.    Option Fields
  1812.  
  1813.        shift.cnt:   Window scale byte in WSopt.
  1814.        TSval:       32-bit Timestamp Value field in TSopt.
  1815.        TSecr:       32-bit Timestamp Reply field in TSopt.
  1816.  
  1817.    Option Fields in Current Segment
  1818.  
  1819.        SEG.TSval:   TSval field from TSopt in current segment.
  1820.        SEG.TSecr:   TSecr field from TSopt in current segment.
  1821.        SEG.WSopt:   8-bit value in WSopt
  1822.  
  1823.    Clock Values
  1824.  
  1825.        my.TSclock:      Local source of 32-bit timestamp values
  1826.        my.TSclock.rate: Period of my.TSclock (1 ms to 1 sec).
  1827.  
  1828.    Per-Connection State Variables
  1829.  
  1830.        TS.Recent:       Latest received Timestamp
  1831.        Last.ACK.sent:   Last ACK field sent
  1832.  
  1833.        Snd.TS.OK:       1-bit flag
  1834.        Snd.WS.OK:       1-bit flag
  1835.  
  1836.        Rcv.Wind.Scale:  Receive window scale power
  1837.        Snd.Wind.Scale:  Send window scale power
  1838.  
  1839.        Start.Time:      my.TSclock value when segment being timed was
  1840.                         sent (used by pre-1323 code).
  1841.  
  1842.    Procedure
  1843.  
  1844.        Update_SRTT( m ) Procedure to update the smoothed RTT and RTT
  1845.                         variance estimates, using the rules of
  1846.                         [Jacobson88], given m, a new RTT measurement.
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855. Network Working Group      Expires August 1997                 [Page 32]
  1856.  
  1857. Internet-Draft     TCP Extensions for High Performance     February 1997
  1858.  
  1859.  
  1860. APPENDIX E: PSEUDO-CODE SUMMARY
  1861.  
  1862.    Create new TCB => {
  1863.        Rcv.wind.scale =
  1864.              MIN( 14, MAX( 0, floor(log2(receive buffer space)) - 15 ) );
  1865.        Snd.wind.scale = 0;
  1866.        Last.ACK.sent = 0;
  1867.        Snd.TS.OK = Snd.WS.OK = FALSE;
  1868.    }
  1869.  
  1870.  
  1871.    Send initial {SYN} segment => {
  1872.  
  1873.        SEG.WND = MIN( RCV.WND, 65535 );
  1874.        Include in segment: TSopt(TSval=my.TSclock, TCecr=0);
  1875.        Include in segment: WSopt = Rcv.wind.scale;
  1876.    }
  1877.  
  1878.  
  1879.    Send {SYN, ACK} segment => {
  1880.  
  1881.        SEG.ACK = Last.ACK.sent = RCV.NXT;
  1882.        SEG.WND = MIN( RCV.WND, 65535 );
  1883.        if (Snd.TS.OK) then
  1884.              Include in segment: TSopt(TSval=my.TSclock, TSecr=TS.Recent);
  1885.        if (Snd.WS.OK) then
  1886.              Include in segment: WSopt = Rcv.wind.scale;
  1887.    }
  1888.  
  1889.  
  1890.    Receive {SYN} or {SYN,ACK} segment => {
  1891.  
  1892.        if (Segment contains TSopt) then {
  1893.              TS.Recent = SEG.TSval;
  1894.              Snd.TS.OK = TRUE;
  1895.              if (is {SYN,ACK} segment) then
  1896.                    Update_SRTT(
  1897.                             (my.TSclock - SEG.TSecr)*my.TSclock.rate ) ;
  1898.        }
  1899.  
  1900.        if Segment contains WSopt) then {
  1901.              Snd.wind.scale = SEG.WSopt;
  1902.              Snd.WS.OK = TRUE;
  1903.        }
  1904.        else
  1905.              Rcv.wind.scale = Snd.wind.scale = 0;
  1906.    }
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913. Network Working Group      Expires August 1997                 [Page 33]
  1914.  
  1915. Internet-Draft     TCP Extensions for High Performance     February 1997
  1916.  
  1917.  
  1918.    Send non-SYN segment => {
  1919.  
  1920.        SEG.ACK = Last.ACK.sent = RCV.NXT;
  1921.        SEG.WND = MIN( RCV.WND >> Rcv.wind.scale, 65535 );
  1922.        if (Snd.TS.OK) then
  1923.              Include in segment: TSopt(TSval=my.TSclock, TSecr=TS.Recent);
  1924.    }
  1925.  
  1926.  
  1927.    Receive non-SYN segment in (state >= ESTABLISHED) => {
  1928.  
  1929.        Window = (SEG.WND << Snd.wind.scale);
  1930.              /* Use 32-bit 'Window' instead of 16-bit 'SEG.WND'
  1931.               * in rest of processing.
  1932.               */
  1933.  
  1934.        if (Segment contains TSopt) then {
  1935.              if (SEG.TSval < TS.Recent && Idle less than 25 days) then {
  1936.                    if (Send.TS.OK AND (NOT RST) ) then {
  1937.                                /* Timestamp too old =>
  1938.                                 *    segment is unacceptable.
  1939.                                 */
  1940.                          Send ACK segment;
  1941.                          Discard segment and return;
  1942.                    }
  1943.              }
  1944.              else {
  1945.                    if (SEG.SEQ =< Last.ACK.sent) then
  1946.                                TS.Recent = SEG.TSval;
  1947.              }
  1948.        }
  1949.  
  1950.        if (SEG.ACK > SND.UNA) then {
  1951.                     /* (At least part of) first segment in
  1952.                      * retransmission queue has been ACKd
  1953.                      */
  1954.              if (Segment contains TSopt) then
  1955.                    Update_SRTT(
  1956.                           (my.TSclock - SEG.TSecr)/my.TSclock.rate);
  1957.              else
  1958.                    Update_SRTT( /* for compatibility */
  1959.                           (my.TSclock - Start.Time)/my.TSclock.rate);
  1960.        }
  1961.    }
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971. Network Working Group      Expires August 1997                 [Page 34]
  1972.  
  1973. Internet-Draft     TCP Extensions for High Performance     February 1997
  1974.  
  1975.  
  1976.  
  1977. APPENDIX F: EVENT PROCESSING SUMMARY
  1978.  
  1979.  
  1980. Event Processing
  1981.  
  1982.   OPEN Call
  1983.  
  1984.      ...
  1985.     An initial send sequence number (ISS) is selected.  Send a SYN
  1986.     segment of the form:
  1987.  
  1988.         <SEQ=ISS><CTL=SYN><TSval=my.TSclock><WSopt=Rcv.Wind.Scale>
  1989.  
  1990.       ...
  1991.  
  1992.   SEND Call
  1993.  
  1994.     CLOSED STATE (i.e., TCB does not exist)
  1995.  
  1996.       ...
  1997.  
  1998.     LISTEN STATE
  1999.  
  2000.       If the foreign socket is specified, then change the connection
  2001.       from passive to active, select an ISS.  Send a SYN segment
  2002.       containing the options: <TSval=my.TSclock> and
  2003.       <WSopt=Rcv.Wind.Scale>.  Set SND.UNA to ISS, SND.NXT to ISS+1.
  2004.       Enter SYN-SENT state. ...
  2005.  
  2006.     SYN-SENT STATE
  2007.     SYN-RECEIVED STATE
  2008.  
  2009.      ...
  2010.  
  2011.     ESTABLISHED STATE
  2012.     CLOSE-WAIT STATE
  2013.  
  2014.       Segmentize the buffer and send it with a piggybacked
  2015.       acknowledgment (acknowledgment value = RCV.NXT).  ...
  2016.  
  2017.       If the urgent flag is set ...
  2018.  
  2019.       If the Snd.TS.OK flag is set, then include the TCP Timestamps
  2020.       option <TSval=my.TSclock,TSecr=TS.Recent> in each data segment.
  2021.  
  2022.       Scale the receive window for transmission in the segment header:
  2023.  
  2024.             SEG.WND = (RCV.WND >> Rcv.Wind.Scale).
  2025.  
  2026.  
  2027.  
  2028.  
  2029. Network Working Group      Expires August 1997                 [Page 35]
  2030.  
  2031. Internet-Draft     TCP Extensions for High Performance     February 1997
  2032.  
  2033.  
  2034.   SEGMENT ARRIVES
  2035.  
  2036.      ...
  2037.  
  2038.     If the state is LISTEN then
  2039.  
  2040.       first check for an RST
  2041.  
  2042.        ...
  2043.  
  2044.       second check for an ACK
  2045.  
  2046.        ...
  2047.  
  2048.       third check for a SYN
  2049.  
  2050.         if the SYN bit is set, check the security.  If the ...
  2051.  
  2052.          ...
  2053.  
  2054.         If the SEG.PRC is less than the TCB.PRC then continue.
  2055.  
  2056.         Check for a Window Scale option (WSopt); if one is found, save
  2057.         SEG.WSopt in Snd.Wind.Scale and set Snd.WS.OK flag on.
  2058.         Otherwise, set both Snd.Wind.Scale and Rcv.Wind.Scale to zero
  2059.         and clear Snd.WS.OK flag.
  2060.  
  2061.         Check for a TSopt option; if one is found, save SEG.TSval in the
  2062.         variable TS.Recent and turn on the Snd.TS.OK bit.
  2063.  
  2064.         Set RCV.NXT to SEG.SEQ+1, IRS is set to SEG.SEQ and any other
  2065.         control or text should be queued for processing later.  ISS
  2066.         should be selected and a SYN segment sent of the form:
  2067.  
  2068.           <SEQ=ISS><ACK=RCV.NXT><CTL=SYN,ACK>
  2069.  
  2070.         If the Snd.WS.OK bit is on, include a WSopt option
  2071.         <WSopt=Rcv.Wind.Scale> in this segment.  If the Snd.TS.OK bit is
  2072.         on, include a TSopt <TSval=my.TSclock,TSecr=TS.Recent> in this
  2073.         segment.  Last.ACK.sent is set to RCV.NXT.
  2074.  
  2075.         SND.NXT is set to ISS+1 and SND.UNA to ISS.  The connection
  2076.         state should be changed to SYN-RECEIVED.  Note that any other
  2077.         incoming control or data (combined with SYN) will be processed
  2078.         in the SYN-RECEIVED state, but processing of SYN and ACK should
  2079.         not be repeated.  If the listen was not fully specified (i.e.,
  2080.         the foreign socket was not fully specified), then the
  2081.         unspecified fields should be filled in now.
  2082.  
  2083.       fourth other text or control
  2084.  
  2085.  
  2086.  
  2087. Network Working Group      Expires August 1997                 [Page 36]
  2088.  
  2089. Internet-Draft     TCP Extensions for High Performance     February 1997
  2090.  
  2091.  
  2092.        ...
  2093.  
  2094.     If the state is SYN-SENT then
  2095.  
  2096.  
  2097.       first check the ACK bit
  2098.  
  2099.        ...
  2100.  
  2101.       fourth check the SYN bit
  2102.  
  2103.          ...
  2104.  
  2105.         If the SYN bit is on and the security/compartment and precedence
  2106.         are acceptable then, RCV.NXT is set to SEG.SEQ+1, IRS is set to
  2107.         SEG.SEQ, and any acknowledgements on the retransmission queue
  2108.         which are thereby acknowledged should be removed.
  2109.  
  2110.         Check for a Window Scale option (WSopt); if is found, save
  2111.         SEG.WSopt in Snd.Wind.Scale; otherwise, set both Snd.Wind.Scale
  2112.         and Rcv.Wind.Scale to zero.
  2113.  
  2114.         Check for a TSopt option; if one is found, save SEG.TSval in
  2115.         variable TS.Recent and turn on the Snd.TS.OK bit in the
  2116.         connection control block.  If the ACK bit is set, use my.TSclock
  2117.         - SEG.TSecr as the initial RTT estimate.
  2118.  
  2119.         If SND.UNA > ISS (our SYN has been ACKed), change the connection
  2120.         state to ESTABLISHED, form an ACK segment:
  2121.  
  2122.             <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
  2123.  
  2124.         and send it.  If the Snd.Echo.OK bit is on, include a TSopt
  2125.         option <TSval=my.TSclock,TSecr=TS.Recent> in this ACK segment.
  2126.         Last.ACK.sent is set to RCV.NXT.
  2127.  
  2128.         Data or controls which were queued for transmission may be
  2129.         included.  If there are other controls or text in the segment
  2130.         then continue processing at the sixth step below where the URG
  2131.         bit is checked, otherwise return.
  2132.  
  2133.         Otherwise enter SYN-RECEIVED, form a SYN,ACK segment:
  2134.  
  2135.             <SEQ=ISS><ACK=RCV.NXT><CTL=SYN,ACK>
  2136.  
  2137.         and send it.  If the Snd.Echo.OK bit is on, include a TSopt
  2138.         option <TSval=my.TSclock,TSecr=TS.Recent> in this segment.  If
  2139.         the Snd.WS.OK bit is on, include a WSopt option
  2140.         <WSopt=Rcv.Wind.Scale> in this segment.  Last.ACK.sent is set to
  2141.         RCV.NXT.
  2142.  
  2143.  
  2144.  
  2145. Network Working Group      Expires August 1997                 [Page 37]
  2146.  
  2147. Internet-Draft     TCP Extensions for High Performance     February 1997
  2148.  
  2149.  
  2150.         If there are other controls or text in the segment, queue them
  2151.         for processing after the ESTABLISHED state has been reached,
  2152.         return.
  2153.  
  2154.       fifth, if neither of the SYN or RST bits is set then drop the
  2155.       segment and return.
  2156.  
  2157.  
  2158.     Otherwise,
  2159.  
  2160.     First, check sequence number
  2161.  
  2162.       SYN-RECEIVED STATE
  2163.       ESTABLISHED STATE
  2164.       FIN-WAIT-1 STATE
  2165.       FIN-WAIT-2 STATE
  2166.       CLOSE-WAIT STATE
  2167.       CLOSING STATE
  2168.       LAST-ACK STATE
  2169.       TIME-WAIT STATE
  2170.  
  2171.         Segments are processed in sequence.  Initial tests on arrival
  2172.         are used to discard old duplicates, but further processing is
  2173.         done in SEG.SEQ order.  If a segment's contents straddle the
  2174.         boundary between old and new, only the new parts should be
  2175.         processed.
  2176.  
  2177.         Rescale the received window field:
  2178.  
  2179.             TrueWindow = SEG.WND << Snd.Wind.Scale,
  2180.  
  2181.         and use "TrueWindow" in place of SEG.WND in the following steps.
  2182.  
  2183.         Check whether the segment contains a Timestamps option and bit
  2184.         Snd.TS.OK is on.  If so:
  2185.  
  2186.           If SEG.TSval < TS.Recent, then test whether connection has
  2187.           been idle less than 24 days; if both are true, then the
  2188.           segment is not acceptable; follow steps below for an
  2189.           unacceptable segment.
  2190.  
  2191.           If SEG.SEQ is equal to Last.ACK.sent, then save SEG.ECopt in
  2192.           variable TS.Recent.
  2193.  
  2194.  
  2195.         There are four cases for the acceptability test for an incoming
  2196.         segment:
  2197.  
  2198.          ...
  2199.  
  2200.  
  2201.  
  2202.  
  2203. Network Working Group      Expires August 1997                 [Page 38]
  2204.  
  2205. Internet-Draft     TCP Extensions for High Performance     February 1997
  2206.  
  2207.  
  2208.         If an incoming segment is not acceptable, an acknowledgment
  2209.         should be sent in reply (unless the RST bit is set, if so drop
  2210.         the segment and return):
  2211.  
  2212.           <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
  2213.  
  2214.         Last.ACK.sent is set to SEG.ACK of the acknowledgment.  If the
  2215.         Snd.Echo.OK bit is on, include the Timestamps option
  2216.         <TSval=my.TSclock,TSecr=TS.Recent> in this ACK segment.  Set
  2217.         Last.ACK.sent to SEG.ACK and send the ACK segment.  After
  2218.         sending the acknowledgment, drop the unacceptable segment and
  2219.         return.
  2220.  
  2221.          ...
  2222.  
  2223.  
  2224.     fifth check the ACK field.
  2225.  
  2226.       if the ACK bit is off drop the segment and return.
  2227.  
  2228.       if the ACK bit is on
  2229.  
  2230.        ...
  2231.  
  2232.  
  2233.         ESTABLISHED STATE
  2234.  
  2235.           If SND.UNA < SEG.ACK =< SND.NXT then, set SND.UNA <- SEG.ACK.
  2236.           Also compute a new estimate of round-trip time.  If Snd.TS.OK
  2237.           bit is on, use my.TSclock - SEG.TSecr; otherwise use the
  2238.           elapsed time since the first segment in the retransmission
  2239.           queue was sent.  Any segments on the retransmission queue
  2240.           which are thereby entirely acknowledged...
  2241.  
  2242.            ...
  2243.  
  2244.  
  2245.     Seventh, process the segment text.
  2246.  
  2247.       ESTABLISHED STATE
  2248.       FIN-WAIT-1 STATE
  2249.       FIN-WAIT-2 STATE
  2250.  
  2251.          ...
  2252.  
  2253.         Send an acknowledgment of the form:
  2254.  
  2255.           <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
  2256.  
  2257.         If the Snd.TS.OK bit is on, include Timestamps option
  2258.  
  2259.  
  2260.  
  2261. Network Working Group      Expires August 1997                 [Page 39]
  2262.  
  2263. Internet-Draft     TCP Extensions for High Performance     February 1997
  2264.  
  2265.  
  2266.         <TSval=my.TSclock,TSecr=TS.Recent> in this ACK segment.  Set
  2267.         Last.ACK.sent to SEG.ACK of the acknowledgment, and send it.
  2268.         This acknowledgment should be piggy-backed on a segment being
  2269.         transmitted if possible without incurring undue delay.
  2270.  
  2271.  
  2272.          ...
  2273.  
  2274.  
  2275.  
  2276. APPENDIX G: TCP OPTIONS AND MSS
  2277.  
  2278.    There has been some confusion as to what value should be filled in
  2279.    the TCP MSS option when using TCP options.  RFC-879 [Postel83]
  2280.    stated:
  2281.  
  2282.         The MSS counts only data octets in the segment, it does not
  2283.         count the TCP header or the IP header.
  2284.  
  2285.    which is unclear about what to do about TCP options.  RFC-1122
  2286.    [Braden89] attempted to clarify this in section 4.2.2.6, but there
  2287.    still seems to be confusion.
  2288.  
  2289.    So, the MSS value to be sent in an MSS option should be equal to the
  2290.    effective MTU minus the fixed IP and TCP headers.  Since both IP and
  2291.    TCP options are ignored when calculating value for the MSS option, if
  2292.    there are any IP or TCP options to be sent in a packet, then the
  2293.    sender must decrease the size of the TCP data accordingly.  The
  2294.    reason for this can be seen in the following table:
  2295.  
  2296.                    | MSS is adjusted       | MSS is not adjusted
  2297.                    | to include options    | to include options
  2298.    ----------------+-----------------------+--------------------
  2299.    Sender adjusts  | packets are too       | packets are the
  2300.    length for      | short                 | correct length
  2301.    options         |                       |
  2302.    ----------------+-----------------------+--------------------
  2303.    Sender doesn't  | packets are the       | packets are too
  2304.    adjust length   | correct length        | long.
  2305.    for options     |                       |
  2306.  
  2307.    Since the goal is to not send IP datagrams that have to be
  2308.    fragmented, and packets sent with the constraints in the lower right
  2309.    of this grid will cause IP fragmentation, the only way to guarantee
  2310.    that this doesn't happen is for the data sender to decrease the TCP
  2311.    data length by the size of the IP and TCP options.  And since the
  2312.    sender will be adjusting the TCP data length when sending IP and TCP
  2313.    options, there is no need to include the IP and TCP option lengths in
  2314.    the MSS value.
  2315.  
  2316.  
  2317.  
  2318.  
  2319. Network Working Group      Expires August 1997                 [Page 40]
  2320.  
  2321. Internet-Draft     TCP Extensions for High Performance     February 1997
  2322.  
  2323.  
  2324. Security Considerations
  2325.  
  2326.    Security issues are not discussed in this memo.
  2327.  
  2328. Authors' Addresses
  2329.  
  2330.    Van Jacobson
  2331.    University of California
  2332.    Lawrence Berkeley Laboratory
  2333.    Mail Stop 46A
  2334.    Berkeley, CA 94720
  2335.  
  2336.    Phone: (415) 486-6411
  2337.    EMail: van@CSAM.LBL.GOV
  2338.  
  2339.  
  2340.    Bob Braden
  2341.    University of Southern California
  2342.    Information Sciences Institute
  2343.    4676 Admiralty Way
  2344.    Marina del Rey, CA 90292
  2345.  
  2346.    Phone: (310) 822-1511
  2347.    EMail: Braden@ISI.EDU
  2348.  
  2349.  
  2350.    David Borman
  2351.    Berkeley Software Design, Inc.
  2352.    5575 Tech Center Drive, Suite #110
  2353.    Colorado Springs, CO 80919
  2354.  
  2355.    Phone: (612) 405-8194
  2356.    Email: dab@BSDI.COM
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377. Network Working Group      Expires August 1997                 [Page 41]
  2378.  
  2379.  
  2380.  
  2381.