home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1100s / rfc1146.txt < prev    next >
Text File  |  1990-03-06  |  11KB  |  283 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                          J. Zweig
  8. Request for Comments: 1146                                         UIUC
  9. Obsoletes: RFC 1145                                        C. Partridge
  10.                                                                     BBN
  11.                                                              March 1990
  12.  
  13.  
  14.                      TCP Alternate Checksum Options
  15.  
  16. Status of This Memo
  17.  
  18.    This memo suggests a pair of TCP options to allow use of alternate
  19.    data checksum algorithms in the TCP header.  The use of these options
  20.    is experimental, and not recommended for production use.
  21.  
  22.    Note:  This RFC corrects errors introduced in the editing process in
  23.    RFC 1145.
  24.  
  25.    Distribution of this memo is unlimited.
  26.  
  27. Introduction
  28.  
  29.    Some members of the networking community have expressed interest in
  30.    using checksum-algorithms with different error detection and
  31.    correction properties than the standard TCP checksum.  The option
  32.    described in this memo provides a mechanism to negotiate the use of
  33.    an alternate checksum at connection-establishment time, as well as a
  34.    mechanism to carry additional checksum information for algorithms
  35.    that utilize checksums that are longer than 16 bits.
  36.  
  37. Definition of the Options
  38.  
  39.    The TCP Alternate Checksum Request Option may be sent in a SYN
  40.    segment by a TCP to indicate that the TCP is prepared to both
  41.    generate and receive checksums based on an alternate algorithm.
  42.    During communication, the alternate checksum replaces the regular TCP
  43.    checksum in the checksum field of the TCP header.  Should the
  44.    alternate checksum require more than 2 octets to transmit, the
  45.    checksum may either be moved into a TCP Alternate Checksum Data
  46.    Option and the checksum field of the TCP header be sent as 0, or the
  47.    data may be split between the header field and the option.  Alternate
  48.    checksums are computed over the same data as the regular TCP checksum
  49.    (see TCP Alternate Checksum Data Option discussion below).
  50.  
  51. TCP Alternate Checksum Request Option
  52.  
  53.    The format of the TCP Alternate Checksum Request Option is:
  54.  
  55.  
  56.  
  57.  
  58. Zweig & Partridge                                               [Page 1]
  59.  
  60. RFC 1146             TCP Alternate Checksum Options           March 1990
  61.  
  62.  
  63.                  +----------+----------+----------+
  64.                  |  Kind=14 | Length=3 |  chksum  |
  65.                  +----------+----------+----------+
  66.  
  67.    Here chksum is a number identifying the type of checksum to be used.
  68.  
  69.    The currently defined values of chksum are:
  70.  
  71.                    0  -- TCP checksum
  72.                    1  -- 8-bit  Fletcher's algorithm (see Appendix I)
  73.                    2  -- 16-bit Fletcher's algorithm (see Appendix II)
  74.  
  75.    Note that the 8-bit Fletcher algorithm gives a 16-bit checksum and
  76.    the 16-bit algorithm gives a 32-bit checksum.
  77.  
  78.    Alternate checksum negotiation proceeds as follows:
  79.  
  80.       A SYN segment used to originate a connection may contain the
  81.       Alternate Checksum Request Option, which specifies an alternate
  82.       checksum-calculation algorithm to be used for the connection.  The
  83.       acknowledging SYN-ACK segment may also carry the option.
  84.  
  85.       If both SYN segments carry the Alternate Checksum Request option,
  86.       and both specify the same algorithm, that algorithm must be used
  87.       for the remainder of the connection.  Otherwise, the standard TCP
  88.       checksum algorithm must be used for the entire connection.  Thus,
  89.       for example, if one TCP specifies type 1 checksums, and the other
  90.       specifies type 2 checksums, then they will use type 0 (the regular
  91.       TCP checksum).  Note that in practice, one TCP will typically be
  92.       responding to the other's SYN, and thus either accepting or
  93.       rejecting the proposed alternate checksum algorithm.
  94.  
  95.       Any segment with the SYN bit set must always use the standard TCP
  96.       checksum algorithm.  Thus the SYN segment will always be
  97.       understood by the receiving TCP.  The alternate checksum must not
  98.       be used until the first non-SYN segment.  In addition, because RST
  99.       segments may also be received or sent without complete state
  100.       information, any segment with the RST bit set must use the
  101.       standard TCP checksum.
  102.  
  103.       The option may not be sent in any segment that does not have the
  104.       SYN bit set.
  105.  
  106.       An implementation of TCP which does not support the option should
  107.       silently ignore it (as RFC 1122 requires).  Ignoring the option
  108.       will force any TCP attempting to use an alternate checksum to use
  109.       the standard TCP checksum algorithm, thus ensuring
  110.       interoperability.
  111.  
  112.  
  113.  
  114. Zweig & Partridge                                               [Page 2]
  115.  
  116. RFC 1146             TCP Alternate Checksum Options           March 1990
  117.  
  118.  
  119. TCP Alternate Checksum Data Option
  120.  
  121.    The format of the TCP Alternate Checksum Data Option is:
  122.  
  123.                 +---------+---------+---------+     +---------+
  124.                 | Kind=15 |Length=N |  data   | ... |  data   |
  125.                 +---------+---------+---------+     +---------+
  126.  
  127.    This field is used only when the alternate checksum that is
  128.    negotiated is longer than 16 bits.  These checksums will not fit in
  129.    the checksum field of the TCP header and thus at least part of them
  130.    must be put in an option.  Whether the checksum is split between the
  131.    checksum field in the TCP header and the option or the entire
  132.    checksum is placed in the option is determined on a checksum by
  133.    checksum basis.
  134.  
  135.    The length of this option will depend on the choice of alternate
  136.    checksum algorithm for this connection.
  137.  
  138.    While computing the alternate checksum, the TCP checksum field and
  139.    the data portion TCP Alternate Checksum Data Option are replaced with
  140.    zeros.
  141.  
  142.    An otherwise acceptable segment carrying this option on a connection
  143.    using a 16-bit checksum algorithm, or carrying this option with an
  144.    inappropriate number of data octets for the chosen alternate checksum
  145.    algorithm is in error and must be discarded; a RST-segment must be
  146.    generated, and the connection aborted.
  147.  
  148.    Note the requirement above that RST and SYN segments must always use
  149.    the standard TCP checksum.
  150.  
  151. APPENDIX I:  The 8-bit Fletcher Checksum Algorithm
  152.  
  153.    The 8-bit Fletcher Checksum Algorithm is calculated over a sequence
  154.    of data octets (call them D[1] through D[N]) by maintaining 2
  155.    unsigned 1's-complement 8-bit accumulators A and B whose contents are
  156.    initially zero, and performing the following loop where i ranges from
  157.    1 to N:
  158.  
  159.            A := A + D[i]
  160.            B := B + A
  161.  
  162.    It can be shown that at the end of the loop A will contain the 8-bit
  163.    1's complement sum of all octets in the datagram, and that B will
  164.    contain (N)D[1] + (N-1)D[2] + ... + D[N].
  165.  
  166.    The octets covered by this algorithm should be the same as those over
  167.  
  168.  
  169.  
  170. Zweig & Partridge                                               [Page 3]
  171.  
  172. RFC 1146             TCP Alternate Checksum Options           March 1990
  173.  
  174.  
  175.    which the standard TCP checksum calculation is performed, with the
  176.    pseudoheader being D[1] through D[12] and the TCP header beginning at
  177.    D[13].  Note that, for purposes of the checksum computation, the
  178.    checksum field itself must be equal to zero.
  179.  
  180.    At the end of the loop, the A goes in the first byte of the TCP
  181.    checksum and B goes in the second byte.
  182.  
  183.    Note that, unlike the OSI version of the Fletcher checksum, this
  184.    checksum does not adjust the check bytes so that the receiver
  185.    checksum is 0.
  186.  
  187.    There are a number of much faster algorithms for calculating the two
  188.    octets of the 8-bit Fletcher checksum.  For more information see
  189.    [Sklower89], [Nakassis88] and [Fletcher82].  Naturally, any
  190.    computation which computes the same number as would be calculated by
  191.    the loop above may be used to calculate the checksum.  One advantage
  192.    of the Fletcher algorithms over the standard TCP checksum algorithm
  193.    is the ability to detect the transposition of octets/words of any
  194.    size within a datagram.
  195.  
  196. APPENDIX II:  The 16-bit Fletcher Checksum Algorithm
  197.  
  198.    The 16-bit Fletcher Checksum algorithm proceeds in precisely the same
  199.    manner as the 8-bit checksum algorithm,, except that A, B and the
  200.    D[i] are 16-bit quantities.  It is necessary (as it is with the
  201.    standard TCP checksum algorithm) to pad a datagram containing an odd
  202.    number of octets with a zero octet.
  203.  
  204.    Result A should be placed in the TCP header checksum field and Result
  205.    B should appear in an TCP Alternate Checksum Data option.  This
  206.    option must be present in every TCP header. The two bytes reserved
  207.    for B should be set to zero during the calculation of the checksum.
  208.  
  209.    The checksum field of the TCP header shall contain the contents of A
  210.    at the end of the loop.  The TCP Alternate Checksum Data option must
  211.    be present and contain the contents of B at the end of the loop.
  212.  
  213. BIBLIOGRAPHY:
  214.  
  215.    [BrBoPa89]     Braden, R., Borman, D., and C. Partridge, "Computing
  216.                   the Internet Checksum", ACM Computer Communication
  217.                   Review, Vol. 19, No. 2, pp. 86-101, April 1989.
  218.                   [Note that this includes Plummer, W. "IEN-45: TCP
  219.                   Checksum Function Design" (1978) as an appendix.]
  220.  
  221.    [Fletcher82]   Fletcher, J., "An Arithmetic Checksum for Serial
  222.                   Transmissions", IEEE Transactions on Communication,
  223.  
  224.  
  225.  
  226. Zweig & Partridge                                               [Page 4]
  227.  
  228. RFC 1146             TCP Alternate Checksum Options           March 1990
  229.  
  230.  
  231.                   Vol. COM-30, No. 1, pp. 247-252, January 1982.
  232.  
  233.    [Nakassis88]   Nakassis, T., "Fletcher's Error Detection Algorithm:
  234.                   How to implement it efficiently and how to avoid the
  235.                   most common pitfalls", ACM Computer Communication
  236.                   Review, Vol. 18, No. 5, pp. 86-94, October 1988.
  237.  
  238.    [Sklower89]    Sklower, K., "Improving the Efficiency of the OSI
  239.                   Checksum Calculation", ACM Computer Communication
  240.                   Review, Vol. 19, No. 5, pp. 32-43, October 1989.
  241.  
  242. Security Considerations
  243.  
  244.    Security issues are not addressed in this memo.
  245.  
  246. Authors' Addresses
  247.  
  248.    Johnny Zweig
  249.    Digital Computer Lab
  250.    University of Illinois (UIUC)
  251.    1304 West Springfield Avenue
  252.    CAMPUS MC 258
  253.    Urbana, IL 61801
  254.  
  255.    Phone:  (217) 333-7937
  256.  
  257.    EMail:  zweig@CS.UIUC.EDU
  258.  
  259.  
  260.    Craig Partridge
  261.    Bolt Beranek and Newman Inc.
  262.    50 Moulton Street
  263.    Cambridge, MA 02138
  264.  
  265.    Phone: (617) 873-2459
  266.  
  267.    EMail: craig@BBN.COM
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Zweig & Partridge                                               [Page 5]
  283.