Debian Codegraph @

rfc1145.html

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