Imported Upstream version 1.0.10
[platform/upstream/lksctp-tools.git] / doc / rfc2960.txt
1 \r
2 \r
3 \r
4 \r
5 \r
6 \r
7 Network Working Group                                         R. Stewart\r
8 Request for Comments: 2960                                        Q. Xie\r
9 Category: Standards Track                                       Motorola\r
10                                                             K. Morneault\r
11                                                                 C. Sharp\r
12                                                                    Cisco\r
13                                                          H. Schwarzbauer\r
14                                                                  Siemens\r
15                                                                T. Taylor\r
16                                                          Nortel Networks\r
17                                                                I. Rytina\r
18                                                                 Ericsson\r
19                                                                 M. Kalla\r
20                                                                Telcordia\r
21                                                                 L. Zhang\r
22                                                                     UCLA\r
23                                                                V. Paxson\r
24                                                                    ACIRI\r
25                                                             October 2000\r
26 \r
27 \r
28                   Stream Control Transmission Protocol\r
29 \r
30 Status of this Memo\r
31 \r
32    This document specifies an Internet standards track protocol for the\r
33    Internet community, and requests discussion and suggestions for\r
34    improvements.  Please refer to the current edition of the "Internet\r
35    Official Protocol Standards" (STD 1) for the standardization state\r
36    and status of this protocol.  Distribution of this memo is unlimited.\r
37 \r
38 Copyright Notice\r
39 \r
40    Copyright (C) The Internet Society (2000).  All Rights Reserved.\r
41 \r
42 Abstract\r
43 \r
44    This document describes the Stream Control Transmission Protocol\r
45    (SCTP).  SCTP is designed to transport PSTN signaling messages over\r
46    IP networks, but is capable of broader applications.\r
47 \r
48    SCTP is a reliable transport protocol operating on top of a\r
49    connectionless packet network such as IP.  It offers the following\r
50    services to its users:\r
51 \r
52       -- acknowledged error-free non-duplicated transfer of user data,\r
53       -- data fragmentation to conform to discovered path MTU size,\r
54 \r
55 \r
56 \r
57 \r
58 Stewart, et al.             Standards Track                     [Page 1]\r
59 \f\r
60 RFC 2960          Stream Control Transmission Protocol      October 2000\r
61 \r
62 \r
63       -- sequenced delivery of user messages within multiple streams,\r
64          with an option for order-of-arrival delivery of individual user\r
65          messages,\r
66       -- optional bundling of multiple user messages into a single SCTP\r
67          packet, and\r
68       -- network-level fault tolerance through supporting of multi-\r
69          homing at either or both ends of an association.\r
70 \r
71    The design of SCTP includes appropriate congestion avoidance behavior\r
72    and resistance to flooding and masquerade attacks.\r
73 \r
74 \r
75 \r
76 \r
77 \r
78 \r
79 \r
80 \r
81 \r
82 \r
83 \r
84 \r
85 \r
86 \r
87 \r
88 \r
89 \r
90 \r
91 \r
92 \r
93 \r
94 \r
95 \r
96 \r
97 \r
98 \r
99 \r
100 \r
101 \r
102 \r
103 \r
104 \r
105 \r
106 \r
107 \r
108 \r
109 \r
110 \r
111 \r
112 \r
113 \r
114 Stewart, et al.             Standards Track                     [Page 2]\r
115 \f\r
116 RFC 2960          Stream Control Transmission Protocol      October 2000\r
117 \r
118 \r
119 Table of Contents\r
120 \r
121    1.  Introduction..................................................  5\r
122      1.1 Motivation..................................................  6\r
123      1.2 Architectural View of SCTP..................................  6\r
124      1.3 Functional View of SCTP.....................................  7\r
125        1.3.1 Association Startup and Takedown........................  8\r
126        1.3.2 Sequenced Delivery within Streams.......................  9\r
127        1.3.3 User Data Fragmentation.................................  9\r
128        1.3.4 Acknowledgement and Congestion Avoidance................  9\r
129        1.3.5 Chunk Bundling ......................................... 10\r
130        1.3.6 Packet Validation....................................... 10\r
131        1.3.7 Path Management......................................... 11\r
132      1.4 Key Terms................................................... 11\r
133      1.5 Abbreviations............................................... 15\r
134      1.6 Serial Number Arithmetic.................................... 15\r
135    2. Conventions.................................................... 16\r
136    3.  SCTP packet Format............................................ 16\r
137      3.1 SCTP Common Header Field Descriptions....................... 17\r
138      3.2 Chunk Field Descriptions.................................... 18\r
139        3.2.1 Optional/Variable-length Parameter Format............... 20\r
140      3.3 SCTP Chunk Definitions...................................... 21\r
141        3.3.1 Payload Data (DATA)..................................... 22\r
142        3.3.2 Initiation (INIT)....................................... 24\r
143          3.3.2.1 Optional or Variable Length Parameters.............. 26\r
144        3.3.3 Initiation Acknowledgement (INIT ACK)................... 30\r
145          3.3.3.1 Optional or Variable Length Parameters.............. 33\r
146        3.3.4 Selective Acknowledgement (SACK)........................ 33\r
147        3.3.5 Heartbeat Request (HEARTBEAT)........................... 37\r
148        3.3.6 Heartbeat Acknowledgement (HEARTBEAT ACK)............... 38\r
149        3.3.7 Abort Association (ABORT)............................... 39\r
150        3.3.8 Shutdown Association (SHUTDOWN)......................... 40\r
151        3.3.9 Shutdown Acknowledgement (SHUTDOWN ACK)................. 40\r
152        3.3.10 Operation Error (ERROR)................................ 41\r
153          3.3.10.1 Invalid Stream Identifier.......................... 42\r
154          3.3.10.2 Missing Mandatory Parameter........................ 43\r
155          3.3.10.3 Stale Cookie Error................................. 43\r
156          3.3.10.4 Out of Resource.................................... 44\r
157          3.3.10.5 Unresolvable Address............................... 44\r
158          3.3.10.6 Unrecognized Chunk Type............................ 44\r
159          3.3.10.7 Invalid Mandatory Parameter........................ 45\r
160          3.3.10.8 Unrecognized Parameters............................ 45\r
161          3.3.10.9 No User Data....................................... 46\r
162          3.3.10.10 Cookie Received While Shutting Down............... 46\r
163        3.3.11 Cookie Echo (COOKIE ECHO).............................. 46\r
164        3.3.12 Cookie Acknowledgement (COOKIE ACK).................... 47\r
165        3.3.13 Shutdown Complete (SHUTDOWN COMPLETE).................. 48\r
166    4. SCTP Association State Diagram................................. 48\r
167 \r
168 \r
169 \r
170 Stewart, et al.             Standards Track                     [Page 3]\r
171 \f\r
172 RFC 2960          Stream Control Transmission Protocol      October 2000\r
173 \r
174 \r
175    5. Association Initialization..................................... 52\r
176      5.1 Normal Establishment of an Association...................... 52\r
177        5.1.1 Handle Stream Parameters................................ 54\r
178        5.1.2 Handle Address Parameters............................... 54\r
179        5.1.3 Generating State Cookie................................. 56\r
180        5.1.4 State Cookie Processing................................. 57\r
181        5.1.5 State Cookie Authentication............................. 57\r
182        5.1.6 An Example of Normal Association Establishment.......... 58\r
183      5.2 Handle Duplicate or unexpected INIT, INIT ACK, COOKIE ECHO,\r
184          and COOKIE ACK.............................................. 60\r
185        5.2.1 Handle Duplicate INIT in COOKIE-WAIT\r
186              or COOKIE-ECHOED States................................. 60\r
187        5.2.2 Unexpected INIT in States Other than CLOSED,\r
188              COOKIE-ECHOED, COOKIE-WAIT and SHUTDOWN-ACK-SENT........ 61\r
189        5.2.3 Unexpected INIT ACK..................................... 61\r
190        5.2.4 Handle a COOKIE ECHO when a TCB exists.................. 62\r
191          5.2.4.1 An Example of a Association Restart................. 64\r
192        5.2.5 Handle Duplicate COOKIE ACK............................. 66\r
193        5.2.6 Handle Stale COOKIE Error............................... 66\r
194      5.3 Other Initialization Issues................................. 67\r
195        5.3.1 Selection of Tag Value.................................. 67\r
196    6. User Data Transfer............................................. 67\r
197      6.1 Transmission of DATA Chunks................................. 69\r
198      6.2 Acknowledgement on Reception of DATA Chunks................. 70\r
199        6.2.1 Tracking Peer's Receive Buffer Space.................... 73\r
200      6.3 Management Retransmission Timer............................. 75\r
201        6.3.1 RTO Calculation......................................... 75\r
202        6.3.2 Retransmission Timer Rules.............................. 76\r
203        6.3.3 Handle T3-rtx Expiration................................ 77\r
204      6.4 Multi-homed SCTP Endpoints.................................. 78\r
205        6.4.1 Failover from Inactive Destination Address.............. 79\r
206      6.5 Stream Identifier and Stream Sequence Number................ 80\r
207      6.6 Ordered and Unordered Delivery.............................. 80\r
208      6.7 Report Gaps in Received DATA TSNs........................... 81\r
209      6.8 Adler-32 Checksum Calculation............................... 82\r
210      6.9 Fragmentation............................................... 83\r
211      6.10 Bundling .................................................. 84\r
212    7. Congestion Control   .......................................... 85\r
213      7.1 SCTP Differences from TCP Congestion Control................ 85\r
214      7.2 SCTP Slow-Start and Congestion Avoidance.................... 87\r
215        7.2.1 Slow-Start.............................................. 87\r
216        7.2.2 Congestion Avoidance.................................... 89\r
217        7.2.3 Congestion Control...................................... 89\r
218        7.2.4 Fast Retransmit on Gap Reports.......................... 90\r
219      7.3 Path MTU Discovery.......................................... 91\r
220    8.  Fault Management.............................................. 92\r
221      8.1 Endpoint Failure Detection.................................. 92\r
222      8.2 Path Failure Detection...................................... 92\r
223 \r
224 \r
225 \r
226 Stewart, et al.             Standards Track                     [Page 4]\r
227 \f\r
228 RFC 2960          Stream Control Transmission Protocol      October 2000\r
229 \r
230 \r
231      8.3 Path Heartbeat.............................................. 93\r
232      8.4 Handle "Out of the blue" Packets............................ 95\r
233      8.5 Verification Tag............................................ 96\r
234        8.5.1 Exceptions in Verification Tag Rules.................... 97\r
235    9. Termination of Association..................................... 98\r
236      9.1 Abort of an Association..................................... 98\r
237      9.2 Shutdown of an Association.................................. 98\r
238    10. Interface with Upper Layer....................................101\r
239      10.1 ULP-to-SCTP................................................101\r
240      10.2 SCTP-to-ULP................................................111\r
241    11. Security Considerations.......................................114\r
242      11.1 Security Objectives........................................114\r
243      11.2 SCTP Responses To Potential Threats........................115\r
244        11.2.1 Countering Insider Attacks.............................115\r
245        11.2.2 Protecting against Data Corruption in the Network......115\r
246        11.2.3 Protecting Confidentiality.............................115\r
247        11.2.4 Protecting against Blind Denial of Service Attacks.....116\r
248          11.2.4.1 Flooding...........................................116\r
249          11.2.4.2 Blind Masquerade...................................118\r
250          11.2.4.3 Improper Monopolization of Services................118\r
251      11.3 Protection against Fraud and Repudiation...................119\r
252    12. Recommended Transmission Control Block (TCB) Parameters.......120\r
253      12.1 Parameters necessary for the SCTP instance.................120\r
254      12.2 Parameters necessary per association (i.e. the TCB)........120\r
255      12.3 Per Transport Address Data.................................122\r
256      12.4 General Parameters Needed..................................123\r
257    13. IANA Considerations...........................................123\r
258      13.1 IETF-defined Chunk Extension...............................123\r
259      13.2 IETF-defined Chunk Parameter Extension.....................124\r
260      13.3 IETF-defined Additional Error Causes.......................124\r
261      13.4 Payload Protocol Identifiers...............................125\r
262    14. Suggested SCTP Protocol Parameter Values......................125\r
263    15. Acknowledgements..............................................126\r
264    16. Authors' Addresses............................................126\r
265    17. References....................................................128\r
266    18. Bibliography..................................................129\r
267    Appendix A .......................................................131\r
268    Appendix B .......................................................132\r
269    Full Copyright Statement .........................................134\r
270 \r
271 1. Introduction\r
272 \r
273    This section explains the reasoning behind the development of the\r
274    Stream Control Transmission Protocol (SCTP), the services it offers,\r
275    and the basic concepts needed to understand the detailed description\r
276    of the protocol.\r
277 \r
278 \r
279 \r
280 \r
281 \r
282 Stewart, et al.             Standards Track                     [Page 5]\r
283 \f\r
284 RFC 2960          Stream Control Transmission Protocol      October 2000\r
285 \r
286 \r
287 1.1 Motivation\r
288 \r
289    TCP [RFC793] has performed immense service as the primary means of\r
290    reliable data transfer in IP networks.  However, an increasing number\r
291    of recent applications have found TCP too limiting, and have\r
292    incorporated their own reliable data transfer protocol on top of UDP\r
293    [RFC768].  The limitations which users have wished to bypass include\r
294    the following:\r
295 \r
296       -- TCP provides both reliable data transfer and strict order-of-\r
297       transmission delivery of data.  Some applications need reliable\r
298       transfer without sequence maintenance, while others would be\r
299       satisfied with partial ordering of the data.  In both of these\r
300       cases the head-of-line blocking offered by TCP causes unnecessary\r
301       delay.\r
302 \r
303       -- The stream-oriented nature of TCP is often an inconvenience.\r
304       Applications must add their own record marking to delineate their\r
305       messages, and must make explicit use of the push facility to\r
306       ensure that a complete message is transferred in a reasonable\r
307       time.\r
308 \r
309       -- The limited scope of TCP sockets complicates the task of\r
310       providing highly-available data transfer capability using multi-\r
311       homed hosts.\r
312 \r
313       -- TCP is relatively vulnerable to denial of service attacks, such\r
314       as SYN attacks.\r
315 \r
316    Transport of PSTN signaling across the IP network is an application\r
317    for which all of these limitations of TCP are relevant.  While this\r
318    application directly motivated the development of SCTP, other\r
319    applications may find SCTP a good match to their requirements.\r
320 \r
321 1.2 Architectural View of SCTP\r
322 \r
323    SCTP is viewed as a layer between the SCTP user application ("SCTP\r
324    user" for short) and a connectionless packet network service such as\r
325    IP.  The remainder of this document assumes SCTP runs on top of IP.\r
326    The basic service offered by SCTP is the reliable transfer of user\r
327    messages between peer SCTP users.  It performs this service within\r
328    the context of an association between two SCTP endpoints. Section 10\r
329    of this document sketches the API which should exist at the boundary\r
330    between the SCTP and the SCTP user layers.\r
331 \r
332    SCTP is connection-oriented in nature, but the SCTP association is a\r
333    broader concept than the TCP connection.  SCTP provides the means for\r
334    each SCTP endpoint (Section 1.4) to provide the other endpoint\r
335 \r
336 \r
337 \r
338 Stewart, et al.             Standards Track                     [Page 6]\r
339 \f\r
340 RFC 2960          Stream Control Transmission Protocol      October 2000\r
341 \r
342 \r
343    (during association startup) with a list of transport addresses\r
344    (i.e., multiple IP addresses in combination with an SCTP port)\r
345    through which that endpoint can be reached and from which it will\r
346    originate SCTP packets.  The association spans transfers over all of\r
347    the possible source/destination combinations which may be generated\r
348    from each endpoint's lists.\r
349 \r
350        _____________                                      _____________\r
351       |  SCTP User  |                                    |  SCTP User  |\r
352       | Application |                                    | Application |\r
353       |-------------|                                    |-------------|\r
354       |    SCTP     |                                    |    SCTP     |\r
355       |  Transport  |                                    |  Transport  |\r
356       |   Service   |                                    |   Service   |\r
357       |-------------|                                    |-------------|\r
358       |             |One or more    ----      One or more|             |\r
359       | IP Network  |IP address      \/        IP address| IP Network  |\r
360       |   Service   |appearances     /\       appearances|   Service   |\r
361       |_____________|               ----                 |_____________|\r
362 \r
363         SCTP Node A |<-------- Network transport ------->| SCTP Node B\r
364 \r
365                         Figure 1: An SCTP Association\r
366 \r
367 1.3 Functional View of SCTP\r
368 \r
369    The SCTP transport service can be decomposed into a number of\r
370    functions.  These are depicted in Figure 2 and explained in the\r
371    remainder of this section.\r
372 \r
373 \r
374 \r
375 \r
376 \r
377 \r
378 \r
379 \r
380 \r
381 \r
382 \r
383 \r
384 \r
385 \r
386 \r
387 \r
388 \r
389 \r
390 \r
391 \r
392 \r
393 \r
394 Stewart, et al.             Standards Track                     [Page 7]\r
395 \f\r
396 RFC 2960          Stream Control Transmission Protocol      October 2000\r
397 \r
398 \r
399                            SCTP User Application\r
400 \r
401          -----------------------------------------------------\r
402           _____________                  ____________________\r
403          |             |                | Sequenced delivery |\r
404          | Association |                |   within streams   |\r
405          |             |                |____________________|\r
406          |   startup   |\r
407          |             |         ____________________________\r
408          |     and     |        |    User Data Fragmentation |\r
409          |             |        |____________________________|\r
410          |   takedown  |\r
411          |             |         ____________________________\r
412          |             |        |     Acknowledgement        |\r
413          |             |        |          and               |\r
414          |             |        |    Congestion Avoidance    |\r
415          |             |        |____________________________|\r
416          |             |\r
417          |             |         ____________________________\r
418          |             |        |       Chunk Bundling       |\r
419          |             |        |____________________________|\r
420          |             |\r
421          |             |     ________________________________\r
422          |             |    |      Packet Validation         |\r
423          |             |    |________________________________|\r
424          |             |\r
425          |             |     ________________________________\r
426          |             |    |     Path Management            |\r
427          |_____________|    |________________________________|\r
428 \r
429            Figure 2: Functional View of the SCTP Transport Service\r
430 \r
431 1.3.1 Association Startup and Takedown\r
432 \r
433    An association is initiated by a request from the SCTP user (see the\r
434    description of the ASSOCIATE (or SEND) primitive in Section 10).\r
435 \r
436    A cookie mechanism, similar to one described by Karn and Simpson in\r
437    [RFC2522], is employed during the initialization to provide\r
438    protection against security attacks.  The cookie mechanism uses a\r
439    four-way handshake, the last two legs of which are allowed to carry\r
440    user data for fast setup.  The startup sequence is described in\r
441    Section 5 of this document.\r
442 \r
443    SCTP provides for graceful close (i.e., shutdown) of an active\r
444    association on request from the SCTP user.  See the description of\r
445    the SHUTDOWN primitive in Section 10.  SCTP also allows ungraceful\r
446    close (i.e., abort), either on request from the user (ABORT\r
447 \r
448 \r
449 \r
450 Stewart, et al.             Standards Track                     [Page 8]\r
451 \f\r
452 RFC 2960          Stream Control Transmission Protocol      October 2000\r
453 \r
454 \r
455    primitive) or as a result of an error condition detected within the\r
456    SCTP layer.  Section 9 describes both the graceful and the ungraceful\r
457    close procedures.\r
458 \r
459    SCTP does not support a half-open state (like TCP) wherein one side\r
460    may continue sending data while the other end is closed.  When either\r
461    endpoint performs a shutdown, the association on each peer will stop\r
462    accepting new data from its user and only deliver data in queue at\r
463    the time of the graceful close (see Section 9).\r
464 \r
465 1.3.2 Sequenced Delivery within Streams\r
466 \r
467    The term "stream" is used in SCTP to refer to a sequence of user\r
468    messages that are to be delivered to the upper-layer protocol in\r
469    order with respect to other messages within the same stream.  This is\r
470    in contrast to its usage in TCP, where it refers to a sequence of\r
471    bytes (in this document a byte is assumed to be eight bits).\r
472 \r
473    The SCTP user can specify at association startup time the number of\r
474    streams to be supported by the association.  This number is\r
475    negotiated with the remote end (see Section 5.1.1).  User messages\r
476    are associated with stream numbers (SEND, RECEIVE primitives, Section\r
477    10).  Internally, SCTP assigns a stream sequence number to each\r
478    message passed to it by the SCTP user.  On the receiving side, SCTP\r
479    ensures that messages are delivered to the SCTP user in sequence\r
480    within a given stream.  However, while one stream may be blocked\r
481    waiting for the next in-sequence user message, delivery from other\r
482    streams may proceed.\r
483 \r
484    SCTP provides a mechanism for bypassing the sequenced delivery\r
485    service.  User messages sent using this mechanism are delivered to\r
486    the SCTP user as soon as they are received.\r
487 \r
488 1.3.3 User Data Fragmentation\r
489 \r
490    When needed, SCTP fragments user messages to ensure that the SCTP\r
491    packet passed to the lower layer conforms to the path MTU.  On\r
492    receipt, fragments are reassembled into complete messages before\r
493    being passed to the SCTP user.\r
494 \r
495 1.3.4 Acknowledgement and Congestion Avoidance\r
496 \r
497    SCTP assigns a Transmission Sequence Number (TSN) to each user data\r
498    fragment or unfragmented message.  The TSN is independent of any\r
499    stream sequence number assigned at the stream level.  The receiving\r
500 \r
501 \r
502 \r
503 \r
504 \r
505 \r
506 Stewart, et al.             Standards Track                     [Page 9]\r
507 \f\r
508 RFC 2960          Stream Control Transmission Protocol      October 2000\r
509 \r
510 \r
511    end acknowledges all TSNs received, even if there are gaps in the\r
512    sequence.  In this way, reliable delivery is kept functionally\r
513    separate from sequenced stream delivery.\r
514 \r
515    The acknowledgement and congestion avoidance function is responsible\r
516    for packet retransmission when timely acknowledgement has not been\r
517    received.  Packet retransmission is conditioned by congestion\r
518    avoidance procedures similar to those used for TCP.  See Sections 6\r
519    and 7 for a detailed description of the protocol procedures\r
520    associated with this function.\r
521 \r
522 1.3.5 Chunk Bundling\r
523 \r
524    As described in Section 3, the SCTP packet as delivered to the lower\r
525    layer consists of a common header followed by one or more chunks.\r
526    Each chunk may contain either user data or SCTP control information.\r
527    The SCTP user has the option to request bundling of more than one\r
528    user messages into a single SCTP packet.  The chunk bundling function\r
529    of SCTP is responsible for assembly of the complete SCTP packet and\r
530    its disassembly at the receiving end.\r
531 \r
532    During times of congestion an SCTP implementation MAY still perform\r
533    bundling even if the user has requested that SCTP not bundle.  The\r
534    user's disabling of bundling only affects SCTP implementations that\r
535    may delay a small period of time before transmission (to attempt to\r
536    encourage bundling).  When the user layer disables bundling, this\r
537    small delay is prohibited but not bundling that is performed during\r
538    congestion or retransmission.\r
539 \r
540 1.3.6 Packet Validation\r
541 \r
542    A mandatory Verification Tag field and a 32 bit checksum field (see\r
543    Appendix B for a description of the Adler-32 checksum) are included\r
544    in the SCTP common header.  The Verification Tag value is chosen by\r
545    each end of the association during association startup.  Packets\r
546    received without the expected Verification Tag value are discarded,\r
547    as a protection against blind masquerade attacks and against stale\r
548    SCTP packets from a previous association.  The Adler-32 checksum\r
549    should be set by the sender of each SCTP packet to provide additional\r
550    protection against data corruption in the network.  The receiver of\r
551    an SCTP packet with an invalid Adler-32 checksum silently discards\r
552    the packet.\r
553 \r
554 \r
555 \r
556 \r
557 \r
558 \r
559 \r
560 \r
561 \r
562 Stewart, et al.             Standards Track                    [Page 10]\r
563 \f\r
564 RFC 2960          Stream Control Transmission Protocol      October 2000\r
565 \r
566 \r
567 1.3.7 Path Management\r
568 \r
569    The sending SCTP user is able to manipulate the set of transport\r
570    addresses used as destinations for SCTP packets through the\r
571    primitives described in Section 10.  The SCTP path management\r
572    function chooses the destination transport address for each outgoing\r
573    SCTP packet based on the SCTP user's instructions and the currently\r
574    perceived reachability status of the eligible destination set.  The\r
575    path management function monitors reachability through heartbeats\r
576    when other packet traffic is inadequate to provide this information\r
577    and advises the SCTP user when reachability of any far-end transport\r
578    address changes.  The path management function is also responsible\r
579    for reporting the eligible set of local transport addresses to the\r
580    far end during association startup, and for reporting the transport\r
581    addresses returned from the far end to the SCTP user.\r
582 \r
583    At association start-up, a primary path is defined for each SCTP\r
584    endpoint, and is used for normal sending of SCTP packets.\r
585 \r
586    On the receiving end, the path management is responsible for\r
587    verifying the existence of a valid SCTP association to which the\r
588    inbound SCTP packet belongs before passing it for further processing.\r
589 \r
590    Note: Path Management and Packet Validation are done at the same\r
591    time, so although described separately above, in reality they cannot\r
592    be performed as separate items.\r
593 \r
594 1.4 Key Terms\r
595 \r
596    Some of the language used to describe SCTP has been introduced in the\r
597    previous sections.  This section provides a consolidated list of the\r
598    key terms and their definitions.\r
599 \r
600    o  Active destination transport address: A transport address on a\r
601       peer endpoint which a transmitting endpoint considers available\r
602       for receiving user messages.\r
603 \r
604    o  Bundling: An optional multiplexing operation, whereby more than\r
605       one user message may be carried in the same SCTP packet.  Each\r
606       user message occupies its own DATA chunk.\r
607 \r
608    o  Chunk: A unit of information within an SCTP packet, consisting of\r
609       a chunk header and chunk-specific content.\r
610 \r
611    o  Congestion Window (cwnd): An SCTP variable that limits the data,\r
612       in number of bytes, a sender can send to a particular destination\r
613       transport address before receiving an acknowledgement.\r
614 \r
615 \r
616 \r
617 \r
618 Stewart, et al.             Standards Track                    [Page 11]\r
619 \f\r
620 RFC 2960          Stream Control Transmission Protocol      October 2000\r
621 \r
622 \r
623    o  Cumulative TSN Ack Point: The TSN of the last DATA chunk\r
624       acknowledged via the Cumulative TSN Ack field of a SACK.\r
625 \r
626    o  Idle destination address: An address that has not had user\r
627       messages sent to it within some length of time, normally the\r
628       HEARTBEAT interval or greater.\r
629 \r
630    o  Inactive destination transport address: An address which is\r
631       considered inactive due to errors and unavailable to transport\r
632       user messages.\r
633 \r
634    o  Message = user message:  Data submitted to SCTP by the Upper Layer\r
635       Protocol (ULP).\r
636 \r
637    o  Message Authentication Code (MAC):  An integrity check mechanism\r
638       based on cryptographic hash functions using a secret key.\r
639       Typically, message authentication codes are used between two\r
640       parties that share a secret key in order to validate information\r
641       transmitted between these parties.  In SCTP it is used by an\r
642       endpoint to validate the State Cookie information that is returned\r
643       from the peer in the COOKIE ECHO chunk.  The term "MAC" has\r
644       different meanings in different contexts.  SCTP uses this term\r
645       with the same meaning as in [RFC2104].\r
646 \r
647    o  Network Byte Order: Most significant byte first, a.k.a., Big\r
648       Endian.\r
649 \r
650    o  Ordered Message: A user message that is delivered in order with\r
651       respect to all previous user messages sent within the stream the\r
652       message was sent on.\r
653 \r
654    o  Outstanding TSN (at an SCTP endpoint): A TSN (and the associated\r
655       DATA chunk) that has been sent by the endpoint but for which it\r
656       has not yet received an acknowledgement.\r
657 \r
658    o  Path: The route taken by the SCTP packets sent by one SCTP\r
659       endpoint to a specific destination transport address of its peer\r
660       SCTP endpoint.  Sending to different destination transport\r
661       addresses does not necessarily guarantee getting separate paths.\r
662 \r
663    o  Primary Path: The primary path is the destination and source\r
664       address that will be put into a packet outbound to the peer\r
665       endpoint by default.  The definition includes the source address\r
666       since an implementation MAY wish to specify both destination and\r
667       source address to better control the return path taken by reply\r
668       chunks and on which interface the packet is transmitted when the\r
669       data sender is multi-homed.\r
670 \r
671 \r
672 \r
673 \r
674 Stewart, et al.             Standards Track                    [Page 12]\r
675 \f\r
676 RFC 2960          Stream Control Transmission Protocol      October 2000\r
677 \r
678 \r
679    o  Receiver Window (rwnd): An SCTP variable a data sender uses to\r
680       store the most recently calculated receiver window of its peer, in\r
681       number of bytes.  This gives the sender an indication of the space\r
682       available in the receiver's inbound buffer.\r
683 \r
684    o  SCTP association: A protocol relationship between SCTP endpoints,\r
685       composed of the two SCTP endpoints and protocol state information\r
686       including Verification Tags and the currently active set of\r
687       Transmission Sequence Numbers (TSNs), etc.  An association can be\r
688       uniquely identified by the transport addresses used by the\r
689       endpoints in the association.  Two SCTP endpoints MUST NOT have\r
690       more than one SCTP association between them at any given time.\r
691 \r
692    o  SCTP endpoint: The logical sender/receiver of SCTP packets.  On a\r
693       multi-homed host, an SCTP endpoint is represented to its peers as\r
694       a combination of a set of eligible destination transport addresses\r
695       to which SCTP packets can be sent and a set of eligible source\r
696       transport addresses from which SCTP packets can be received.  All\r
697       transport addresses used by an SCTP endpoint must use the same\r
698       port number, but can use multiple IP addresses.  A transport\r
699       address used by an SCTP endpoint must not be used by another SCTP\r
700       endpoint.  In other words, a transport address is unique to an\r
701       SCTP endpoint.\r
702 \r
703    o  SCTP packet (or packet): The unit of data delivery across the\r
704       interface between SCTP and the connectionless packet network\r
705       (e.g., IP).  An SCTP packet includes the common SCTP header,\r
706       possible SCTP control chunks, and user data encapsulated within\r
707       SCTP DATA chunks.\r
708 \r
709    o  SCTP user application (SCTP user): The logical higher-layer\r
710       application entity which uses the services of SCTP, also called\r
711       the Upper-layer Protocol (ULP).\r
712 \r
713    o  Slow Start Threshold (ssthresh): An SCTP variable.  This is the\r
714       threshold which the endpoint will use to determine whether to\r
715       perform slow start or congestion avoidance on a particular\r
716       destination transport address.  Ssthresh is in number of bytes.\r
717 \r
718    o  Stream: A uni-directional logical channel established from one to\r
719       another associated SCTP endpoint, within which all user messages\r
720       are delivered in sequence except for those submitted to the\r
721       unordered delivery service.\r
722 \r
723    Note: The relationship between stream numbers in opposite directions\r
724    is strictly a matter of how the applications use them.  It is the\r
725    responsibility of the SCTP user to create and manage these\r
726    correlations if they are so desired.\r
727 \r
728 \r
729 \r
730 Stewart, et al.             Standards Track                    [Page 13]\r
731 \f\r
732 RFC 2960          Stream Control Transmission Protocol      October 2000\r
733 \r
734 \r
735    o  Stream Sequence Number: A 16-bit sequence number used internally\r
736       by SCTP to assure sequenced delivery of the user messages within a\r
737       given stream.  One stream sequence number is attached to each user\r
738       message.\r
739 \r
740    o  Tie-Tags: Verification Tags from a previous association.  These\r
741       Tags are used within a State Cookie so that the newly restarting\r
742       association can be linked to the original association within the\r
743       endpoint that did not restart.\r
744 \r
745    o  Transmission Control Block (TCB): An internal data structure\r
746       created by an SCTP endpoint for each of its existing SCTP\r
747       associations to other SCTP endpoints.  TCB contains all the status\r
748       and operational information for the endpoint to maintain and\r
749       manage the corresponding association.\r
750 \r
751    o  Transmission Sequence Number (TSN): A 32-bit sequence number used\r
752       internally by SCTP.  One TSN is attached to each chunk containing\r
753       user data to permit the receiving SCTP endpoint to acknowledge its\r
754       receipt and detect duplicate deliveries.\r
755 \r
756    o  Transport address:  A Transport Address is traditionally defined\r
757       by Network Layer address, Transport Layer protocol and Transport\r
758       Layer port number.  In the case of SCTP running over IP, a\r
759       transport address is defined by the combination of an IP address\r
760       and an SCTP port number (where SCTP is the Transport protocol).\r
761 \r
762    o Unacknowledged TSN (at an SCTP endpoint): A TSN (and the associated\r
763       DATA chunk) which has been received by the endpoint but for which\r
764       an acknowledgement has not yet been sent. Or in the opposite case,\r
765       for a packet that has been sent but no acknowledgement has been\r
766       received.\r
767 \r
768    o  Unordered Message: Unordered messages are "unordered" with respect\r
769       to any other message, this includes both other unordered messages\r
770       as well as other ordered messages.  Unordered message might be\r
771       delivered prior to or later than ordered messages sent on the same\r
772       stream.\r
773 \r
774    o  User message: The unit of data delivery across the interface\r
775       between SCTP and its user.\r
776 \r
777    o  Verification Tag: A 32 bit unsigned integer that is randomly\r
778       generated.  The Verification Tag provides a key that allows a\r
779       receiver to verify that the SCTP packet belongs to the current\r
780       association and is not an old or stale packet from a previous\r
781       association.\r
782 \r
783 \r
784 \r
785 \r
786 Stewart, et al.             Standards Track                    [Page 14]\r
787 \f\r
788 RFC 2960          Stream Control Transmission Protocol      October 2000\r
789 \r
790 \r
791 1.5. Abbreviations\r
792 \r
793    MAC    - Message Authentication Code [RFC2104]\r
794 \r
795    RTO    - Retransmission Time-out\r
796 \r
797    RTT    - Round-trip Time\r
798 \r
799    RTTVAR - Round-trip Time Variation\r
800 \r
801    SCTP   - Stream Control Transmission Protocol\r
802 \r
803    SRTT   - Smoothed RTT\r
804 \r
805    TCB    - Transmission Control Block\r
806 \r
807    TLV    - Type-Length-Value Coding Format\r
808 \r
809    TSN    - Transmission Sequence Number\r
810 \r
811    ULP    - Upper-layer Protocol\r
812 \r
813 1.6 Serial Number Arithmetic\r
814 \r
815    It is essential to remember that the actual Transmission Sequence\r
816    Number space is finite, though very large.  This space ranges from 0\r
817    to 2**32 - 1. Since the space is finite, all arithmetic dealing with\r
818    Transmission Sequence Numbers must be performed modulo 2**32.  This\r
819    unsigned arithmetic preserves the relationship of sequence numbers as\r
820    they cycle from 2**32 - 1 to 0 again.  There are some subtleties to\r
821    computer modulo arithmetic, so great care should be taken in\r
822    programming the comparison of such values.  When referring to TSNs,\r
823    the symbol "=<" means "less than or equal"(modulo 2**32).\r
824 \r
825    Comparisons and arithmetic on TSNs in this document SHOULD use Serial\r
826    Number Arithmetic as defined in [RFC1982] where SERIAL_BITS = 32.\r
827 \r
828    An endpoint SHOULD NOT transmit a DATA chunk with a TSN that is more\r
829    than 2**31 - 1 above the beginning TSN of its current send window.\r
830    Doing so will cause problems in comparing TSNs.\r
831 \r
832    Transmission Sequence Numbers wrap around when they reach 2**32 - 1.\r
833    That is, the next TSN a DATA chunk MUST use after transmitting TSN =\r
834    2*32 - 1 is TSN = 0.\r
835 \r
836    Any arithmetic done on Stream Sequence Numbers SHOULD use Serial\r
837    Number Arithmetic as defined in [RFC1982] where SERIAL_BITS = 16.\r
838 \r
839 \r
840 \r
841 \r
842 Stewart, et al.             Standards Track                    [Page 15]\r
843 \f\r
844 RFC 2960          Stream Control Transmission Protocol      October 2000\r
845 \r
846 \r
847    All other arithmetic and comparisons in this document uses normal\r
848    arithmetic.\r
849 \r
850 2. Conventions\r
851 \r
852    The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD,\r
853    SHOULD NOT, RECOMMENDED, NOT RECOMMENDED, MAY, and OPTIONAL, when\r
854    they appear in this document, are to be interpreted as described in\r
855    [RFC2119].\r
856 \r
857 3.  SCTP packet Format\r
858 \r
859    An SCTP packet is composed of a common header and chunks. A chunk\r
860    contains either control information or user data.\r
861 \r
862    The SCTP packet format is shown below:\r
863 \r
864        0                   1                   2                   3\r
865        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
866       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
867       |                        Common Header                          |\r
868       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
869       |                          Chunk #1                             |\r
870       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
871       |                           ...                                 |\r
872       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
873       |                          Chunk #n                             |\r
874       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
875 \r
876    Multiple chunks can be bundled into one SCTP packet up to the MTU\r
877    size, except for the INIT, INIT ACK, and SHUTDOWN COMPLETE chunks.\r
878    These chunks MUST NOT be bundled with any other chunk in a packet.\r
879    See Section 6.10 for more details on chunk bundling.\r
880 \r
881    If a user data message doesn't fit into one SCTP packet it can be\r
882    fragmented into multiple chunks using the procedure defined in\r
883    Section 6.9.\r
884 \r
885    All integer fields in an SCTP packet MUST be transmitted in network\r
886    byte order, unless otherwise stated.\r
887 \r
888 \r
889 \r
890 \r
891 \r
892 \r
893 \r
894 \r
895 \r
896 \r
897 \r
898 Stewart, et al.             Standards Track                    [Page 16]\r
899 \f\r
900 RFC 2960          Stream Control Transmission Protocol      October 2000\r
901 \r
902 \r
903 3.1 SCTP Common Header Field Descriptions\r
904 \r
905                          SCTP Common Header Format\r
906 \r
907        0                   1                   2                   3\r
908        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
909       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
910       |     Source Port Number        |     Destination Port Number   |\r
911       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
912       |                      Verification Tag                         |\r
913       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
914       |                           Checksum                            |\r
915       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
916 \r
917    Source Port Number: 16 bits (unsigned integer)\r
918 \r
919       This is the SCTP sender's port number.  It can be used by the\r
920       receiver in combination with the source IP address, the SCTP\r
921       destination port and possibly the destination IP address to\r
922       identify the association to which this packet belongs.\r
923 \r
924    Destination Port Number: 16 bits (unsigned integer)\r
925 \r
926       This is the SCTP port number to which this packet is destined.\r
927       The receiving host will use this port number to de-multiplex the\r
928       SCTP packet to the correct receiving endpoint/application.\r
929 \r
930    Verification Tag: 32 bits (unsigned integer)\r
931 \r
932       The receiver of this packet uses the Verification Tag to validate\r
933       the sender of this SCTP packet.  On transmit, the value of this\r
934       Verification Tag MUST be set to the value of the Initiate Tag\r
935       received from the peer endpoint during the association\r
936       initialization, with the following exceptions:\r
937 \r
938       -  A packet containing an INIT chunk MUST have a zero Verification\r
939          Tag.\r
940       -  A packet containing a SHUTDOWN-COMPLETE chunk with the T-bit\r
941          set MUST have the Verification Tag copied from the packet with\r
942          the SHUTDOWN-ACK chunk.\r
943       -  A packet containing an ABORT chunk may have the verification\r
944          tag copied from the packet which caused the ABORT to be sent.\r
945          For details see Section 8.4 and 8.5.\r
946 \r
947    An INIT chunk MUST be the only chunk in the SCTP packet carrying it.\r
948 \r
949 \r
950 \r
951 \r
952 \r
953 \r
954 Stewart, et al.             Standards Track                    [Page 17]\r
955 \f\r
956 RFC 2960          Stream Control Transmission Protocol      October 2000\r
957 \r
958 \r
959    Checksum: 32 bits (unsigned integer)\r
960 \r
961          This field contains the checksum of this SCTP packet.  Its\r
962          calculation is discussed in Section 6.8.  SCTP uses the Adler-\r
963          32 algorithm as described in Appendix B for calculating the\r
964          checksum\r
965 \r
966 3.2  Chunk Field Descriptions\r
967 \r
968    The figure below illustrates the field format for the chunks to be\r
969    transmitted in the SCTP packet.  Each chunk is formatted with a Chunk\r
970    Type field, a chunk-specific Flag field, a Chunk Length field, and a\r
971    Value field.\r
972 \r
973        0                   1                   2                   3\r
974        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
975       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
976       |   Chunk Type  | Chunk  Flags  |        Chunk Length           |\r
977       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
978       \                                                               \\r
979       /                          Chunk Value                          /\r
980       \                                                               \\r
981       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
982 \r
983    Chunk Type: 8 bits (unsigned integer)\r
984 \r
985       This field identifies the type of information contained in the\r
986       Chunk Value field.  It takes a value from 0 to 254.  The value of\r
987       255 is reserved for future use as an extension field.\r
988 \r
989    The values of Chunk Types are defined as follows:\r
990 \r
991    ID Value    Chunk Type\r
992    -----       ----------\r
993    0          - Payload Data (DATA)\r
994    1          - Initiation (INIT)\r
995    2          - Initiation Acknowledgement (INIT ACK)\r
996    3          - Selective Acknowledgement (SACK)\r
997    4          - Heartbeat Request (HEARTBEAT)\r
998    5          - Heartbeat Acknowledgement (HEARTBEAT ACK)\r
999    6          - Abort (ABORT)\r
1000    7          - Shutdown (SHUTDOWN)\r
1001    8          - Shutdown Acknowledgement (SHUTDOWN ACK)\r
1002    9          - Operation Error (ERROR)\r
1003    10         - State Cookie (COOKIE ECHO)\r
1004    11         - Cookie Acknowledgement (COOKIE ACK)\r
1005    12         - Reserved for Explicit Congestion Notification Echo (ECNE)\r
1006    13         - Reserved for Congestion Window Reduced (CWR)\r
1007 \r
1008 \r
1009 \r
1010 Stewart, et al.             Standards Track                    [Page 18]\r
1011 \f\r
1012 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1013 \r
1014 \r
1015    14         - Shutdown Complete (SHUTDOWN COMPLETE)\r
1016    15 to 62   - reserved by IETF\r
1017    63         - IETF-defined Chunk Extensions\r
1018    64 to 126  - reserved by IETF\r
1019    127        - IETF-defined Chunk Extensions\r
1020    128 to 190 - reserved by IETF\r
1021    191        - IETF-defined Chunk Extensions\r
1022    192 to 254 - reserved by IETF\r
1023    255        - IETF-defined Chunk Extensions\r
1024 \r
1025    Chunk Types are encoded such that the highest-order two bits specify\r
1026    the action that must be taken if the processing endpoint does not\r
1027    recognize the Chunk Type.\r
1028 \r
1029    00 - Stop processing this SCTP packet and discard it, do not process\r
1030         any further chunks within it.\r
1031 \r
1032    01 - Stop processing this SCTP packet and discard it, do not process\r
1033         any further chunks within it, and report the unrecognized\r
1034         parameter in an 'Unrecognized Parameter Type' (in either an\r
1035         ERROR or in the INIT ACK).\r
1036 \r
1037    10 - Skip this chunk and continue processing.\r
1038 \r
1039    11 - Skip this chunk and continue processing, but report in an ERROR\r
1040         Chunk using the 'Unrecognized Chunk Type' cause of error.\r
1041 \r
1042    Note: The ECNE and CWR chunk types are reserved for future use of\r
1043    Explicit Congestion Notification (ECN).\r
1044 \r
1045    Chunk Flags: 8 bits\r
1046 \r
1047       The usage of these bits depends on the chunk type as given by the\r
1048       Chunk Type.  Unless otherwise specified, they are set to zero on\r
1049       transmit and are ignored on receipt.\r
1050 \r
1051    Chunk Length: 16 bits (unsigned integer)\r
1052 \r
1053       This value represents the size of the chunk in bytes including the\r
1054       Chunk Type, Chunk Flags, Chunk Length, and Chunk Value fields.\r
1055       Therefore, if the Chunk Value field is zero-length, the Length\r
1056       field will be set to 4.  The Chunk Length field does not count any\r
1057       padding.\r
1058 \r
1059 \r
1060 \r
1061 \r
1062 \r
1063 \r
1064 \r
1065 \r
1066 Stewart, et al.             Standards Track                    [Page 19]\r
1067 \f\r
1068 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1069 \r
1070 \r
1071    Chunk Value: variable length\r
1072 \r
1073       The Chunk Value field contains the actual information to be\r
1074       transferred in the chunk.  The usage and format of this field is\r
1075       dependent on the Chunk Type.\r
1076 \r
1077    The total length of a chunk (including Type, Length and Value fields)\r
1078    MUST be a multiple of 4 bytes.  If the length of the chunk is not a\r
1079    multiple of 4 bytes, the sender MUST pad the chunk with all zero\r
1080    bytes and this padding is not included in the chunk length field.\r
1081    The sender should never pad with more than 3 bytes.  The receiver\r
1082    MUST ignore the padding bytes.\r
1083 \r
1084    SCTP defined chunks are described in detail in Section 3.3.  The\r
1085    guidelines for IETF-defined chunk extensions can be found in Section\r
1086    13.1 of this document.\r
1087 \r
1088 3.2.1  Optional/Variable-length Parameter Format\r
1089 \r
1090    Chunk values of SCTP control chunks consist of a chunk-type-specific\r
1091    header of required fields, followed by zero or more parameters.  The\r
1092    optional and variable-length parameters contained in a chunk are\r
1093    defined in a Type-Length-Value format as shown below.\r
1094 \r
1095        0                   1                   2                   3\r
1096        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1097       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1098       |          Parameter Type       |       Parameter Length        |\r
1099       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1100       \                                                               \\r
1101       /                       Parameter Value                         /\r
1102       \                                                               \\r
1103       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1104 \r
1105    Chunk Parameter Type:  16 bits (unsigned integer)\r
1106 \r
1107       The Type field is a 16 bit identifier of the type of parameter.\r
1108       It takes a value of 0 to 65534.\r
1109 \r
1110       The value of 65535 is reserved for IETF-defined extensions. Values\r
1111       other than those defined in specific SCTP chunk description are\r
1112       reserved for use by IETF.\r
1113 \r
1114 \r
1115 \r
1116 \r
1117 \r
1118 \r
1119 \r
1120 \r
1121 \r
1122 Stewart, et al.             Standards Track                    [Page 20]\r
1123 \f\r
1124 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1125 \r
1126 \r
1127    Chunk Parameter Length:  16 bits (unsigned integer)\r
1128 \r
1129       The Parameter Length field contains the size of the parameter in\r
1130       bytes, including the Parameter Type, Parameter Length, and\r
1131       Parameter Value fields.  Thus, a parameter with a zero-length\r
1132       Parameter Value field would have a Length field of 4.  The\r
1133       Parameter Length does not include any padding bytes.\r
1134 \r
1135    Chunk Parameter Value: variable-length.\r
1136 \r
1137       The Parameter Value field contains the actual information to be\r
1138       transferred in the parameter.\r
1139 \r
1140    The total length of a parameter (including Type, Parameter Length and\r
1141    Value fields) MUST be a multiple of 4 bytes.  If the length of the\r
1142    parameter is not a multiple of 4 bytes, the sender pads the Parameter\r
1143    at the end (i.e., after the Parameter Value field) with all zero\r
1144    bytes.  The length of the padding is not included in the parameter\r
1145    length field.  A sender SHOULD NOT pad with more than 3 bytes.  The\r
1146    receiver MUST ignore the padding bytes.\r
1147 \r
1148    The Parameter Types are encoded such that the highest-order two bits\r
1149    specify the action that must be taken if the processing endpoint does\r
1150    not recognize the Parameter Type.\r
1151 \r
1152    00 - Stop processing this SCTP packet and discard it, do not process\r
1153         any further chunks within it.\r
1154 \r
1155    01 - Stop processing this SCTP packet and discard it, do not process\r
1156         any further chunks within it, and report the unrecognized\r
1157         parameter in an 'Unrecognized Parameter Type' (in either an\r
1158         ERROR or in the INIT ACK).\r
1159 \r
1160    10 - Skip this parameter and continue processing.\r
1161 \r
1162    11 - Skip this parameter and continue processing but report the\r
1163         unrecognized parameter in an 'Unrecognized Parameter Type' (in\r
1164         either an ERROR or in the INIT ACK).\r
1165 \r
1166    The actual SCTP parameters are defined in the specific SCTP chunk\r
1167    sections.  The rules for IETF-defined parameter extensions are\r
1168    defined in Section 13.2.\r
1169 \r
1170 3.3 SCTP Chunk Definitions\r
1171 \r
1172    This section defines the format of the different SCTP chunk types.\r
1173 \r
1174 \r
1175 \r
1176 \r
1177 \r
1178 Stewart, et al.             Standards Track                    [Page 21]\r
1179 \f\r
1180 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1181 \r
1182 \r
1183 3.3.1 Payload Data (DATA) (0)\r
1184 \r
1185    The following format MUST be used for the DATA chunk:\r
1186 \r
1187        0                   1                   2                   3\r
1188        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1189       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1190       |   Type = 0    | Reserved|U|B|E|    Length                     |\r
1191       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1192       |                              TSN                              |\r
1193       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1194       |      Stream Identifier S      |   Stream Sequence Number n    |\r
1195       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1196       |                  Payload Protocol Identifier                  |\r
1197       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1198       \                                                               \\r
1199       /                 User Data (seq n of Stream S)                 /\r
1200       \                                                               \\r
1201       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1202 \r
1203    Reserved: 5 bits\r
1204 \r
1205       Should be set to all '0's and ignored by the receiver.\r
1206 \r
1207    U bit: 1 bit\r
1208 \r
1209       The (U)nordered bit, if set to '1', indicates that this is an\r
1210       unordered DATA chunk, and there is no Stream Sequence Number\r
1211       assigned to this DATA chunk.  Therefore, the receiver MUST ignore\r
1212       the Stream Sequence Number field.\r
1213 \r
1214       After re-assembly (if necessary), unordered DATA chunks MUST be\r
1215       dispatched to the upper layer by the receiver without any attempt\r
1216       to re-order.\r
1217 \r
1218       If an unordered user message is fragmented, each fragment of the\r
1219       message MUST have its U bit set to '1'.\r
1220 \r
1221    B bit: 1 bit\r
1222 \r
1223       The (B)eginning fragment bit, if set, indicates the first fragment\r
1224       of a user message.\r
1225 \r
1226    E bit:  1 bit\r
1227 \r
1228       The (E)nding fragment bit, if set, indicates the last fragment of\r
1229       a user message.\r
1230 \r
1231 \r
1232 \r
1233 \r
1234 Stewart, et al.             Standards Track                    [Page 22]\r
1235 \f\r
1236 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1237 \r
1238 \r
1239    An unfragmented user message shall have both the B and E bits set to\r
1240    '1'.  Setting both B and E bits to '0' indicates a middle fragment of\r
1241    a multi-fragment user message, as summarized in the following table:\r
1242 \r
1243             B E                  Description\r
1244          ============================================================\r
1245          |  1 0 | First piece of a fragmented user message          |\r
1246          +----------------------------------------------------------+\r
1247          |  0 0 | Middle piece of a fragmented user message         |\r
1248          +----------------------------------------------------------+\r
1249          |  0 1 | Last piece of a fragmented user message           |\r
1250          +----------------------------------------------------------+\r
1251          |  1 1 | Unfragmented Message                              |\r
1252          ============================================================\r
1253          |             Table 1: Fragment Description Flags          |\r
1254          ============================================================\r
1255 \r
1256    When a user message is fragmented into multiple chunks, the TSNs are\r
1257    used by the receiver to reassemble the message.  This means that the\r
1258    TSNs for each fragment of a fragmented user message MUST be strictly\r
1259    sequential.\r
1260 \r
1261    Length:  16 bits (unsigned integer)\r
1262 \r
1263       This field indicates the length of the DATA chunk in bytes from\r
1264       the beginning of the type field to the end of the user data field\r
1265       excluding any padding.  A DATA chunk with no user data field will\r
1266       have Length set to 16 (indicating 16 bytes).\r
1267 \r
1268    TSN : 32 bits (unsigned integer)\r
1269 \r
1270       This value represents the TSN for this DATA chunk.  The valid\r
1271       range of TSN is from 0 to 4294967295 (2**32 - 1).  TSN wraps back\r
1272       to 0 after reaching 4294967295.\r
1273 \r
1274    Stream Identifier S: 16 bits (unsigned integer)\r
1275 \r
1276       Identifies the stream to which the following user data belongs.\r
1277 \r
1278    Stream Sequence Number n: 16 bits (unsigned integer)\r
1279 \r
1280       This value represents the stream sequence number of the following\r
1281       user data within the stream S.  Valid range is 0 to 65535.\r
1282 \r
1283       When a user message is fragmented by SCTP for transport, the same\r
1284       stream sequence number MUST be carried in each of the fragments of\r
1285       the message.\r
1286 \r
1287 \r
1288 \r
1289 \r
1290 Stewart, et al.             Standards Track                    [Page 23]\r
1291 \f\r
1292 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1293 \r
1294 \r
1295    Payload Protocol Identifier: 32 bits (unsigned integer)\r
1296 \r
1297       This value represents an application (or upper layer) specified\r
1298       protocol identifier.  This value is passed to SCTP by its upper\r
1299       layer and sent to its peer.  This identifier is not used by SCTP\r
1300       but can be used by certain network entities as well as the peer\r
1301       application to identify the type of information being carried in\r
1302       this DATA chunk. This field must be sent even in fragmented DATA\r
1303       chunks (to make sure it is available for agents in the middle of\r
1304       the network).\r
1305 \r
1306       The value 0 indicates no application identifier is specified by\r
1307       the upper layer for this payload data.\r
1308 \r
1309    User Data: variable length\r
1310 \r
1311       This is the payload user data.  The implementation MUST pad the\r
1312       end of the data to a 4 byte boundary with all-zero bytes.  Any\r
1313       padding MUST NOT be included in the length field.  A sender MUST\r
1314       never add more than 3 bytes of padding.\r
1315 \r
1316 3.3.2 Initiation (INIT) (1)\r
1317 \r
1318    This chunk is used to initiate a SCTP association between two\r
1319    endpoints.  The format of the INIT chunk is shown below:\r
1320 \r
1321        0                   1                   2                   3\r
1322        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1323       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1324       |   Type = 1    |  Chunk Flags  |      Chunk Length             |\r
1325       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1326       |                         Initiate Tag                          |\r
1327       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1328       |           Advertised Receiver Window Credit (a_rwnd)          |\r
1329       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1330       |  Number of Outbound Streams   |  Number of Inbound Streams    |\r
1331       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1332       |                          Initial TSN                          |\r
1333       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1334       \                                                               \\r
1335       /              Optional/Variable-Length Parameters              /\r
1336       \                                                               \\r
1337       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1338 \r
1339    The INIT chunk contains the following parameters.  Unless otherwise\r
1340    noted, each parameter MUST only be included once in the INIT chunk.\r
1341 \r
1342 \r
1343 \r
1344 \r
1345 \r
1346 Stewart, et al.             Standards Track                    [Page 24]\r
1347 \f\r
1348 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1349 \r
1350 \r
1351          Fixed Parameters                     Status\r
1352          ----------------------------------------------\r
1353          Initiate Tag                        Mandatory\r
1354          Advertised Receiver Window Credit   Mandatory\r
1355          Number of Outbound Streams          Mandatory\r
1356          Number of Inbound Streams           Mandatory\r
1357          Initial TSN                         Mandatory\r
1358 \r
1359          Variable Parameters                  Status     Type Value\r
1360          -------------------------------------------------------------\r
1361          IPv4 Address (Note 1)               Optional    5\r
1362          IPv6 Address (Note 1)               Optional    6\r
1363          Cookie Preservative                 Optional    9\r
1364          Reserved for ECN Capable (Note 2)   Optional    32768 (0x8000)\r
1365          Host Name Address (Note 3)          Optional    11\r
1366          Supported Address Types (Note 4)    Optional    12\r
1367 \r
1368    Note 1: The INIT chunks can contain multiple addresses that can be\r
1369    IPv4 and/or IPv6 in any combination.\r
1370 \r
1371    Note 2: The ECN capable field is reserved for future use of Explicit\r
1372    Congestion Notification.\r
1373 \r
1374    Note 3: An INIT chunk MUST NOT contain more than one Host Name\r
1375    address parameter.  Moreover, the sender of the INIT MUST NOT combine\r
1376    any other address types with the Host Name address in the INIT.  The\r
1377    receiver of INIT MUST ignore any other address types if the Host Name\r
1378    address parameter is present in the received INIT chunk.\r
1379 \r
1380    Note 4: This parameter, when present, specifies all the address types\r
1381    the sending endpoint can support.  The absence of this parameter\r
1382    indicates that the sending endpoint can support any address type.\r
1383 \r
1384    The Chunk Flags field in INIT is reserved and all bits in it should\r
1385    be set to 0 by the sender and ignored by the receiver.  The sequence\r
1386    of parameters within an INIT can be processed in any order.\r
1387 \r
1388    Initiate Tag: 32 bits (unsigned integer)\r
1389 \r
1390       The receiver of the INIT (the responding end) records the value of\r
1391       the Initiate Tag parameter.  This value MUST be placed into the\r
1392       Verification Tag field of every SCTP packet that the receiver of\r
1393       the INIT transmits within this association.\r
1394 \r
1395       The Initiate Tag is allowed to have any value except 0.  See\r
1396       Section 5.3.1 for more on the selection of the tag value.\r
1397 \r
1398 \r
1399 \r
1400 \r
1401 \r
1402 Stewart, et al.             Standards Track                    [Page 25]\r
1403 \f\r
1404 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1405 \r
1406 \r
1407       If the value of the Initiate Tag in a received INIT chunk is found\r
1408       to be 0, the receiver MUST treat it as an error and close the\r
1409       association by transmitting an ABORT.\r
1410 \r
1411    Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned\r
1412       integer)\r
1413 \r
1414       This value represents the dedicated buffer space, in number of\r
1415       bytes, the sender of the INIT has reserved in association with\r
1416       this window.  During the life of the association this buffer space\r
1417       SHOULD not be lessened (i.e. dedicated buffers taken away from\r
1418       this association); however, an endpoint MAY change the value of\r
1419       a_rwnd it sends in SACK chunks.\r
1420 \r
1421    Number of Outbound Streams (OS):  16 bits (unsigned integer)\r
1422 \r
1423       Defines the number of outbound streams the sender of this INIT\r
1424       chunk wishes to create in this association.  The value of 0 MUST\r
1425       NOT be used.\r
1426 \r
1427       Note: A receiver of an INIT with the OS value set to 0 SHOULD\r
1428       abort the association.\r
1429 \r
1430    Number of Inbound Streams (MIS) : 16 bits (unsigned integer)\r
1431 \r
1432       Defines the maximum number of streams the sender of this INIT\r
1433       chunk allows the peer end to create in this association.  The\r
1434       value 0 MUST NOT be used.\r
1435 \r
1436       Note: There is no negotiation of the actual number of streams but\r
1437       instead the two endpoints will use the min(requested, offered).\r
1438       See Section 5.1.1 for details.\r
1439 \r
1440       Note: A receiver of an INIT with the MIS value of 0 SHOULD abort\r
1441       the association.\r
1442 \r
1443    Initial TSN (I-TSN) : 32 bits (unsigned integer)\r
1444 \r
1445       Defines the initial TSN that the sender will use.  The valid range\r
1446       is from 0 to 4294967295.  This field MAY be set to the value of\r
1447       the Initiate Tag field.\r
1448 \r
1449 3.3.2.1 Optional/Variable Length Parameters in INIT\r
1450 \r
1451    The following parameters follow the Type-Length-Value format as\r
1452    defined in Section 3.2.1.  Any Type-Length-Value fields MUST come\r
1453    after the fixed-length fields defined in the previous section.\r
1454 \r
1455 \r
1456 \r
1457 \r
1458 Stewart, et al.             Standards Track                    [Page 26]\r
1459 \f\r
1460 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1461 \r
1462 \r
1463    IPv4 Address Parameter (5)\r
1464 \r
1465        0                   1                   2                   3\r
1466        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1467       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1468       |        Type = 5               |      Length = 8               |\r
1469       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1470       |                        IPv4 Address                           |\r
1471       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1472 \r
1473 \r
1474    IPv4 Address: 32 bits (unsigned integer)\r
1475 \r
1476       Contains an IPv4 address of the sending endpoint.  It is binary\r
1477       encoded.\r
1478 \r
1479    IPv6 Address Parameter (6)\r
1480 \r
1481        0                   1                   2                   3\r
1482        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1483       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1484       |            Type = 6           |          Length = 20          |\r
1485       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1486       |                                                               |\r
1487       |                         IPv6 Address                          |\r
1488       |                                                               |\r
1489       |                                                               |\r
1490       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1491 \r
1492    IPv6 Address: 128 bit (unsigned integer)\r
1493 \r
1494       Contains an IPv6 address of the sending endpoint.  It is binary\r
1495       encoded.\r
1496 \r
1497       Note: A sender MUST NOT use an IPv4-mapped IPv6 address [RFC2373]\r
1498       but should instead use an IPv4 Address Parameter for an IPv4\r
1499       address.\r
1500 \r
1501       Combined with the Source Port Number in the SCTP common header,\r
1502       the value passed in an IPv4 or IPv6 Address parameter indicates a\r
1503       transport address the sender of the INIT will support for the\r
1504       association being initiated.  That is, during the lifetime of this\r
1505       association, this IP address can appear in the source address\r
1506       field of an IP datagram sent from the sender of the INIT, and can\r
1507       be used as a destination address of an IP datagram sent from the\r
1508       receiver of the INIT.\r
1509 \r
1510 \r
1511 \r
1512 \r
1513 \r
1514 Stewart, et al.             Standards Track                    [Page 27]\r
1515 \f\r
1516 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1517 \r
1518 \r
1519       More than one IP Address parameter can be included in an INIT\r
1520       chunk when the INIT sender is multi-homed.  Moreover, a multi-\r
1521       homed endpoint may have access to different types of network, thus\r
1522       more than one address type can be present in one INIT chunk, i.e.,\r
1523       IPv4 and IPv6 addresses are allowed in the same INIT chunk.\r
1524 \r
1525       If the INIT contains at least one IP Address parameter, then the\r
1526       source address of the IP datagram containing the INIT chunk and\r
1527       any additional address(es) provided within the INIT can be used as\r
1528       destinations by the endpoint receiving the INIT.  If the INIT does\r
1529       not contain any IP Address parameters, the endpoint receiving the\r
1530       INIT MUST use the source address associated with the received IP\r
1531       datagram as its sole destination address for the association.\r
1532 \r
1533       Note that not using any IP address parameters in the INIT and\r
1534       INIT-ACK is an alternative to make an association more likely to\r
1535       work across a NAT box.\r
1536 \r
1537    Cookie Preservative (9)\r
1538 \r
1539       The sender of the INIT shall use this parameter to suggest to the\r
1540       receiver of the INIT for a longer life-span of the State Cookie.\r
1541 \r
1542        0                   1                   2                   3\r
1543        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1544       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1545       |          Type = 9             |          Length = 8           |\r
1546       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1547       |         Suggested Cookie Life-span Increment (msec.)          |\r
1548       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1549 \r
1550    Suggested Cookie Life-span Increment: 32 bits (unsigned integer)\r
1551 \r
1552       This parameter indicates to the receiver how much increment in\r
1553       milliseconds the sender wishes the receiver to add to its default\r
1554       cookie life-span.\r
1555 \r
1556       This optional parameter should be added to the INIT chunk by the\r
1557       sender when it re-attempts establishing an association with a peer\r
1558       to which its previous attempt of establishing the association failed\r
1559       due to a stale cookie operation error.  The receiver MAY choose to\r
1560       ignore the suggested cookie life-span increase for its own security\r
1561       reasons.\r
1562 \r
1563 \r
1564 \r
1565 \r
1566 \r
1567 \r
1568 \r
1569 \r
1570 Stewart, et al.             Standards Track                    [Page 28]\r
1571 \f\r
1572 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1573 \r
1574 \r
1575    Host Name Address (11)\r
1576 \r
1577       The sender of INIT uses this parameter to pass its Host Name (in\r
1578       place of its IP addresses) to its peer.  The peer is responsible\r
1579       for resolving the name.  Using this parameter might make it more\r
1580       likely for the association to work across a NAT box.\r
1581 \r
1582       0                   1                   2                   3\r
1583       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1584       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1585       |          Type = 11            |          Length               |\r
1586       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1587       /                          Host Name                            /\r
1588       \                                                               \\r
1589       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1590 \r
1591    Host Name: variable length\r
1592 \r
1593       This field contains a host name in "host name syntax" per RFC1123\r
1594       Section 2.1 [RFC1123].  The method for resolving the host name is\r
1595       out of scope of SCTP.\r
1596 \r
1597       Note: At least one null terminator is included in the Host Name\r
1598       string and must be included in the length.\r
1599 \r
1600    Supported Address Types (12)\r
1601 \r
1602       The sender of INIT uses this parameter to list all the address\r
1603       types it can support.\r
1604 \r
1605        0                   1                   2                   3\r
1606        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1607       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1608       |          Type = 12            |          Length               |\r
1609       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1610       |        Address Type #1        |        Address Type #2        |\r
1611       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1612       |        ......\r
1613       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1614 \r
1615    Address Type: 16 bits (unsigned integer)\r
1616 \r
1617       This is filled with the type value of the corresponding address\r
1618       TLV (e.g., IPv4 = 5, IPv6 = 6, Hostname = 11).\r
1619 \r
1620 \r
1621 \r
1622 \r
1623 \r
1624 \r
1625 \r
1626 Stewart, et al.             Standards Track                    [Page 29]\r
1627 \f\r
1628 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1629 \r
1630 \r
1631 3.3.3 Initiation Acknowledgement (INIT ACK) (2):\r
1632 \r
1633    The INIT ACK chunk is used to acknowledge the initiation of an SCTP\r
1634    association.\r
1635 \r
1636    The parameter part of INIT ACK is formatted similarly to the INIT\r
1637    chunk.  It uses two extra variable parameters: The State Cookie and\r
1638    the Unrecognized Parameter:\r
1639 \r
1640    The format of the INIT ACK chunk is shown below:\r
1641 \r
1642        0                   1                   2                   3\r
1643        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1644       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1645       |   Type = 2    |  Chunk Flags  |      Chunk Length             |\r
1646       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1647       |                         Initiate Tag                          |\r
1648       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1649       |              Advertised Receiver Window Credit                |\r
1650       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1651       |  Number of Outbound Streams   |  Number of Inbound Streams    |\r
1652       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1653       |                          Initial TSN                          |\r
1654       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1655       \                                                               \\r
1656       /              Optional/Variable-Length Parameters              /\r
1657       \                                                               \\r
1658       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1659 \r
1660    Initiate Tag: 32 bits (unsigned integer)\r
1661 \r
1662       The receiver of the INIT ACK records the value of the Initiate Tag\r
1663       parameter.  This value MUST be placed into the Verification Tag\r
1664       field of every SCTP packet that the INIT ACK receiver transmits\r
1665       within this association.\r
1666 \r
1667       The Initiate Tag MUST NOT take the value 0.  See Section 5.3.1 for\r
1668       more on the selection of the Initiate Tag value.\r
1669 \r
1670       If the value of the Initiate Tag in a received INIT ACK chunk is\r
1671       found to be 0, the receiver MUST treat it as an error and close\r
1672       the association by transmitting an ABORT.\r
1673 \r
1674 \r
1675 \r
1676 \r
1677 \r
1678 \r
1679 \r
1680 \r
1681 \r
1682 Stewart, et al.             Standards Track                    [Page 30]\r
1683 \f\r
1684 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1685 \r
1686 \r
1687    Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned\r
1688    integer)\r
1689 \r
1690       This value represents the dedicated buffer space, in number of\r
1691       bytes, the sender of the INIT ACK has reserved in association with\r
1692       this window.  During the life of the association this buffer space\r
1693       SHOULD not be lessened (i.e. dedicated buffers taken away from\r
1694       this association).\r
1695 \r
1696    Number of Outbound Streams (OS):  16 bits (unsigned integer)\r
1697 \r
1698       Defines the number of outbound streams the sender of this INIT ACK\r
1699       chunk wishes to create in this association.  The value of 0 MUST\r
1700       NOT be used.\r
1701 \r
1702       Note: A receiver of an INIT ACK  with the OS value set to 0 SHOULD\r
1703       destroy the association discarding its TCB.\r
1704 \r
1705    Number of Inbound Streams (MIS) : 16 bits (unsigned integer)\r
1706 \r
1707       Defines the maximum number of streams the sender of this INIT ACK\r
1708       chunk allows the peer end to create in this association.  The\r
1709       value 0 MUST NOT be used.\r
1710 \r
1711       Note: There is no negotiation of the actual number of streams but\r
1712       instead the two endpoints will use the min(requested, offered).\r
1713       See Section 5.1.1 for details.\r
1714 \r
1715       Note: A receiver of an INIT ACK  with the MIS value set to 0\r
1716       SHOULD destroy the association discarding its TCB.\r
1717 \r
1718    Initial TSN (I-TSN) : 32 bits (unsigned integer)\r
1719 \r
1720       Defines the initial TSN that the INIT-ACK sender will use.  The\r
1721       valid range is from 0 to 4294967295.  This field MAY be set to the\r
1722       value of the Initiate Tag field.\r
1723 \r
1724       Fixed Parameters                     Status\r
1725       ----------------------------------------------\r
1726       Initiate Tag                        Mandatory\r
1727       Advertised Receiver Window Credit   Mandatory\r
1728       Number of Outbound Streams          Mandatory\r
1729       Number of Inbound Streams           Mandatory\r
1730       Initial TSN                         Mandatory\r
1731 \r
1732 \r
1733 \r
1734 \r
1735 \r
1736 \r
1737 \r
1738 Stewart, et al.             Standards Track                    [Page 31]\r
1739 \f\r
1740 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1741 \r
1742 \r
1743       Variable Parameters                  Status     Type Value\r
1744       -------------------------------------------------------------\r
1745       State Cookie                        Mandatory   7\r
1746       IPv4 Address (Note 1)               Optional    5\r
1747       IPv6 Address (Note 1)               Optional    6\r
1748       Unrecognized Parameters             Optional    8\r
1749       Reserved for ECN Capable (Note 2)   Optional    32768 (0x8000)\r
1750       Host Name Address (Note 3)          Optional    11\r
1751 \r
1752    Note 1: The INIT ACK chunks can contain any number of IP address\r
1753    parameters that can be IPv4 and/or IPv6 in any combination.\r
1754 \r
1755    Note 2: The ECN capable field is reserved for future use of Explicit\r
1756    Congestion Notification.\r
1757 \r
1758    Note 3: The INIT ACK chunks MUST NOT contain more than one Host Name\r
1759    address parameter.  Moreover, the sender of the INIT ACK MUST NOT\r
1760    combine any other address types with the Host Name address in the\r
1761    INIT ACK.  The receiver of the INIT ACK MUST ignore any other address\r
1762    types if the Host Name address parameter is present.\r
1763 \r
1764    IMPLEMENTATION NOTE: An implementation MUST be prepared to receive a\r
1765    INIT ACK that is quite large (more than 1500 bytes) due to the\r
1766    variable size of the state cookie AND the variable address list.  For\r
1767    example if a responder to the INIT has 1000 IPv4 addresses it wishes\r
1768    to send, it would need at least 8,000 bytes to encode this in the\r
1769    INIT ACK.\r
1770 \r
1771    In combination with the Source Port carried in the SCTP common\r
1772    header, each IP Address parameter in the INIT ACK indicates to the\r
1773    receiver of the INIT ACK a valid transport address supported by the\r
1774    sender of the INIT ACK for the lifetime of the association being\r
1775    initiated.\r
1776 \r
1777    If the INIT ACK contains at least one IP Address parameter, then the\r
1778    source address of the IP datagram containing the INIT ACK and any\r
1779    additional address(es) provided within the INIT ACK may be used as\r
1780    destinations by the receiver of the INIT-ACK.  If the INIT ACK does\r
1781    not contain any IP Address parameters, the receiver of the INIT-ACK\r
1782    MUST use the source address associated with the received IP datagram\r
1783    as its sole destination address for the association.\r
1784 \r
1785    The State Cookie and Unrecognized Parameters use the Type-Length-\r
1786    Value format as defined in Section 3.2.1 and are described below.\r
1787    The other fields are defined the same as their counterparts in the\r
1788    INIT chunk.\r
1789 \r
1790 \r
1791 \r
1792 \r
1793 \r
1794 Stewart, et al.             Standards Track                    [Page 32]\r
1795 \f\r
1796 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1797 \r
1798 \r
1799 3.3.3.1 Optional or Variable Length Parameters\r
1800 \r
1801    State Cookie\r
1802 \r
1803       Parameter Type Value: 7\r
1804 \r
1805       Parameter Length:  variable size, depending on Size of Cookie\r
1806 \r
1807       Parameter Value:\r
1808 \r
1809          This parameter value MUST contain all the necessary state and\r
1810          parameter information required for the sender of this INIT ACK\r
1811          to create the association, along with a Message Authentication\r
1812          Code (MAC).  See Section 5.1.3 for details on State Cookie\r
1813          definition.\r
1814 \r
1815    Unrecognized Parameters:\r
1816 \r
1817       Parameter Type Value: 8\r
1818 \r
1819       Parameter Length:  Variable Size.\r
1820 \r
1821       Parameter Value:\r
1822 \r
1823          This parameter is returned to the originator of the INIT chunk\r
1824          when the INIT contains an unrecognized parameter which has a\r
1825          value that indicates that it should be reported to the sender.\r
1826          This parameter value field will contain unrecognized parameters\r
1827          copied from the INIT chunk complete with Parameter Type, Length\r
1828          and Value fields.\r
1829 \r
1830 3.3.4 Selective Acknowledgement (SACK) (3):\r
1831 \r
1832    This chunk is sent to the peer endpoint to acknowledge received DATA\r
1833    chunks and to inform the peer endpoint of gaps in the received\r
1834    subsequences of DATA chunks as represented by their TSNs.\r
1835 \r
1836    The SACK MUST contain the Cumulative TSN Ack and Advertised Receiver\r
1837    Window Credit (a_rwnd) parameters.\r
1838 \r
1839    By definition, the value of the Cumulative TSN Ack parameter is the\r
1840    last TSN received before a break in the sequence of received TSNs\r
1841    occurs; the next TSN value following this one has not yet been\r
1842    received at the endpoint sending the SACK.  This parameter therefore\r
1843    acknowledges receipt of all TSNs less than or equal to its value.\r
1844 \r
1845    The handling of a_rwnd by the receiver of the SACK is discussed in\r
1846    detail in Section 6.2.1.\r
1847 \r
1848 \r
1849 \r
1850 Stewart, et al.             Standards Track                    [Page 33]\r
1851 \f\r
1852 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1853 \r
1854 \r
1855    The SACK also contains zero or more Gap Ack Blocks.  Each Gap Ack\r
1856    Block acknowledges a subsequence of TSNs received following a break\r
1857    in the sequence of received TSNs.  By definition, all TSNs\r
1858    acknowledged by Gap Ack Blocks are greater than the value of the\r
1859    Cumulative TSN Ack.\r
1860 \r
1861        0                   1                   2                   3\r
1862        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
1863       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1864       |   Type = 3    |Chunk  Flags   |      Chunk Length             |\r
1865       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1866       |                      Cumulative TSN Ack                       |\r
1867       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1868       |          Advertised Receiver Window Credit (a_rwnd)           |\r
1869       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1870       | Number of Gap Ack Blocks = N  |  Number of Duplicate TSNs = X |\r
1871       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1872       |  Gap Ack Block #1 Start       |   Gap Ack Block #1 End        |\r
1873       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1874       /                                                               /\r
1875       \                              ...                              \\r
1876       /                                                               /\r
1877       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1878       |   Gap Ack Block #N Start      |  Gap Ack Block #N End         |\r
1879       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1880       |                       Duplicate TSN 1                         |\r
1881       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1882       /                                                               /\r
1883       \                              ...                              \\r
1884       /                                                               /\r
1885       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1886       |                       Duplicate TSN X                         |\r
1887       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
1888 \r
1889    Chunk Flags: 8 bits\r
1890 \r
1891       Set to all zeros on transmit and ignored on receipt.\r
1892 \r
1893    Cumulative TSN Ack: 32 bits (unsigned integer)\r
1894 \r
1895       This parameter contains the TSN of the last DATA chunk received in\r
1896       sequence before a gap.\r
1897 \r
1898    Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned\r
1899       integer)\r
1900 \r
1901       This field indicates the updated receive buffer space in bytes of\r
1902       the sender of this SACK, see Section 6.2.1 for details.\r
1903 \r
1904 \r
1905 \r
1906 Stewart, et al.             Standards Track                    [Page 34]\r
1907 \f\r
1908 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1909 \r
1910 \r
1911    Number of Gap Ack Blocks: 16 bits (unsigned integer)\r
1912 \r
1913       Indicates the number of Gap Ack Blocks included in this SACK.\r
1914 \r
1915    Number of Duplicate TSNs: 16 bit\r
1916 \r
1917       This field contains the number of duplicate TSNs the endpoint has\r
1918       received.  Each duplicate TSN is listed following the Gap Ack\r
1919       Block list.\r
1920 \r
1921    Gap Ack Blocks:\r
1922 \r
1923       These fields contain the Gap Ack Blocks.  They are repeated for\r
1924       each Gap Ack Block up to the number of Gap Ack Blocks defined in\r
1925       the Number of Gap Ack Blocks field.  All DATA chunks with TSNs\r
1926       greater than or equal to (Cumulative TSN Ack + Gap Ack Block\r
1927       Start) and less than or equal to (Cumulative TSN Ack + Gap Ack\r
1928       Block End) of each Gap Ack Block are assumed to have been received\r
1929       correctly.\r
1930 \r
1931    Gap Ack Block Start: 16 bits (unsigned integer)\r
1932 \r
1933       Indicates the Start offset TSN for this Gap Ack Block.  To\r
1934       calculate the actual TSN number the Cumulative TSN Ack is added to\r
1935       this offset number.  This calculated TSN identifies the first TSN\r
1936       in this Gap Ack Block that has been received.\r
1937 \r
1938    Gap Ack Block End:  16 bits (unsigned integer)\r
1939 \r
1940       Indicates the End offset TSN for this Gap Ack Block.  To calculate\r
1941       the actual TSN number the Cumulative TSN Ack is added to this\r
1942       offset number.  This calculated TSN identifies the TSN of the last\r
1943       DATA chunk received in this Gap Ack Block.\r
1944 \r
1945    For example, assume the receiver has the following DATA chunks newly\r
1946    arrived at the time when it decides to send a Selective ACK,\r
1947 \r
1948 \r
1949 \r
1950 \r
1951 \r
1952 \r
1953 \r
1954 \r
1955 \r
1956 \r
1957 \r
1958 \r
1959 \r
1960 \r
1961 \r
1962 Stewart, et al.             Standards Track                    [Page 35]\r
1963 \f\r
1964 RFC 2960          Stream Control Transmission Protocol      October 2000\r
1965 \r
1966 \r
1967                         ----------\r
1968                         | TSN=17 |\r
1969                         ----------\r
1970                         |        | <- still missing\r
1971                         ----------\r
1972                         | TSN=15 |\r
1973                         ----------\r
1974                         | TSN=14 |\r
1975                         ----------\r
1976                         |        | <- still missing\r
1977                         ----------\r
1978                         | TSN=12 |\r
1979                         ----------\r
1980                         | TSN=11 |\r
1981                         ----------\r
1982                         | TSN=10 |\r
1983                         ----------\r
1984 \r
1985    then, the parameter part of the SACK MUST be constructed as follows\r
1986    (assuming the new a_rwnd is set to 4660 by the sender):\r
1987 \r
1988                   +--------------------------------+\r
1989                   |   Cumulative TSN Ack = 12      |\r
1990                   +--------------------------------+\r
1991                   |        a_rwnd = 4660           |\r
1992                   +----------------+---------------+\r
1993                   | num of block=2 | num of dup=0  |\r
1994                   +----------------+---------------+\r
1995                   |block #1 strt=2 |block #1 end=3 |\r
1996                   +----------------+---------------+\r
1997                   |block #2 strt=5 |block #2 end=5 |\r
1998                   +----------------+---------------+\r
1999 \r
2000 \r
2001    Duplicate TSN: 32 bits (unsigned integer)\r
2002 \r
2003       Indicates the number of times a TSN was received in duplicate\r
2004       since the last SACK was sent.  Every time a receiver gets a\r
2005       duplicate TSN (before sending the SACK) it adds it to the list of\r
2006       duplicates.  The duplicate count is re-initialized to zero after\r
2007       sending each SACK.\r
2008 \r
2009       For example, if a receiver were to get the TSN 19 three times it\r
2010       would list 19 twice in the outbound SACK.  After sending the SACK\r
2011       if it received yet one more TSN 19 it would list 19 as a duplicate\r
2012       once in the next outgoing SACK.\r
2013 \r
2014 \r
2015 \r
2016 \r
2017 \r
2018 Stewart, et al.             Standards Track                    [Page 36]\r
2019 \f\r
2020 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2021 \r
2022 \r
2023 3.3.5 Heartbeat Request (HEARTBEAT) (4):\r
2024 \r
2025    An endpoint should send this chunk to its peer endpoint to probe the\r
2026    reachability of a particular destination transport address defined in\r
2027    the present association.\r
2028 \r
2029    The parameter field contains the Heartbeat Information which is a\r
2030    variable length opaque data structure understood only by the sender.\r
2031 \r
2032        0                   1                   2                   3\r
2033        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2034       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2035       |   Type = 4    | Chunk  Flags  |      Heartbeat Length         |\r
2036       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2037       \                                                               \\r
2038       /            Heartbeat Information TLV (Variable-Length)        /\r
2039       \                                                               \\r
2040       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2041 \r
2042    Chunk Flags: 8 bits\r
2043 \r
2044       Set to zero on transmit and ignored on receipt.\r
2045 \r
2046    Heartbeat Length: 16 bits (unsigned integer)\r
2047 \r
2048       Set to the size of the chunk in bytes, including the chunk header\r
2049       and the Heartbeat Information field.\r
2050 \r
2051    Heartbeat Information: variable length\r
2052 \r
2053       Defined as a variable-length parameter using the format described\r
2054       in Section 3.2.1, i.e.:\r
2055 \r
2056       Variable Parameters                  Status     Type Value\r
2057       -------------------------------------------------------------\r
2058       Heartbeat Info                       Mandatory   1\r
2059 \r
2060        0                   1                   2                   3\r
2061        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2062       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2063       |    Heartbeat Info Type=1      |         HB Info Length        |\r
2064       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2065       /                  Sender-specific Heartbeat Info               /\r
2066       \                                                               \\r
2067       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2068 \r
2069 \r
2070 \r
2071 \r
2072 \r
2073 \r
2074 Stewart, et al.             Standards Track                    [Page 37]\r
2075 \f\r
2076 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2077 \r
2078 \r
2079       The Sender-specific Heartbeat Info field should normally include\r
2080       information about the sender's current time when this HEARTBEAT\r
2081       chunk is sent and the destination transport address to which this\r
2082       HEARTBEAT is sent (see Section 8.3).\r
2083 \r
2084 3.3.6 Heartbeat Acknowledgement (HEARTBEAT ACK) (5):\r
2085 \r
2086    An endpoint should send this chunk to its peer endpoint as a response\r
2087    to a HEARTBEAT chunk (see Section 8.3).  A HEARTBEAT ACK is always\r
2088    sent to the source IP address of the IP datagram containing the\r
2089    HEARTBEAT chunk to which this ack is responding.\r
2090 \r
2091    The parameter field contains a variable length opaque data structure.\r
2092 \r
2093        0                   1                   2                   3\r
2094        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2095       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2096       |   Type = 5    | Chunk  Flags  |    Heartbeat Ack Length       |\r
2097       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2098       \                                                               \\r
2099       /            Heartbeat Information TLV (Variable-Length)        /\r
2100       \                                                               \\r
2101       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2102 \r
2103    Chunk Flags: 8 bits\r
2104 \r
2105       Set to zero on transmit and ignored on receipt.\r
2106 \r
2107    Heartbeat Ack Length:  16 bits (unsigned integer)\r
2108 \r
2109       Set to the size of the chunk in bytes, including the chunk header\r
2110       and the Heartbeat Information field.\r
2111 \r
2112    Heartbeat Information: variable length\r
2113 \r
2114       This field MUST contain the Heartbeat Information parameter of\r
2115       the Heartbeat Request to which this Heartbeat Acknowledgement is\r
2116       responding.\r
2117 \r
2118       Variable Parameters                  Status     Type Value\r
2119       -------------------------------------------------------------\r
2120       Heartbeat Info                       Mandatory   1\r
2121 \r
2122 \r
2123 \r
2124 \r
2125 \r
2126 \r
2127 \r
2128 \r
2129 \r
2130 Stewart, et al.             Standards Track                    [Page 38]\r
2131 \f\r
2132 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2133 \r
2134 \r
2135 3.3.7 Abort Association (ABORT) (6):\r
2136 \r
2137    The ABORT chunk is sent to the peer of an association to close the\r
2138    association.  The ABORT chunk may contain Cause Parameters to inform\r
2139    the receiver the reason of the abort.  DATA chunks MUST NOT be\r
2140    bundled with ABORT.  Control chunks (except for INIT, INIT ACK and\r
2141    SHUTDOWN COMPLETE) MAY be bundled with an ABORT but they MUST be\r
2142    placed before the ABORT in the SCTP packet, or they will be ignored\r
2143    by the receiver.\r
2144 \r
2145    If an endpoint receives an ABORT with a format error or for an\r
2146    association that doesn't exist, it MUST silently discard it.\r
2147    Moreover, under any circumstances, an endpoint that receives an ABORT\r
2148    MUST NOT respond to that ABORT by sending an ABORT of its own.\r
2149 \r
2150        0                   1                   2                   3\r
2151        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2152       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2153       |   Type = 6    |Reserved     |T|           Length              |\r
2154       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2155       \                                                               \\r
2156       /                   zero or more Error Causes                   /\r
2157       \                                                               \\r
2158       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2159 \r
2160    Chunk Flags: 8 bits\r
2161 \r
2162    Reserved:  7 bits\r
2163 \r
2164       Set to 0 on transmit and ignored on receipt.\r
2165 \r
2166    T bit:  1 bit\r
2167 \r
2168       The T bit is set to 0 if the sender had a TCB that it destroyed.\r
2169       If the sender did not have a TCB it should set this bit to 1.\r
2170 \r
2171    Note: Special rules apply to this chunk for verification, please see\r
2172    Section 8.5.1 for details.\r
2173 \r
2174    Length:  16 bits (unsigned integer)\r
2175 \r
2176       Set to the size of the chunk in bytes, including the chunk header\r
2177       and all the Error Cause fields present.\r
2178 \r
2179    See Section 3.3.10 for Error Cause definitions.\r
2180 \r
2181 \r
2182 \r
2183 \r
2184 \r
2185 \r
2186 Stewart, et al.             Standards Track                    [Page 39]\r
2187 \f\r
2188 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2189 \r
2190 \r
2191 3.3.8 Shutdown Association (SHUTDOWN) (7):\r
2192 \r
2193    An endpoint in an association MUST use this chunk to initiate a\r
2194    graceful close of the association with its peer.  This chunk has the\r
2195    following format.\r
2196 \r
2197        0                   1                   2                   3\r
2198        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2199       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2200       |   Type = 7    | Chunk  Flags  |      Length = 8               |\r
2201       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2202       |                      Cumulative TSN Ack                       |\r
2203       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2204 \r
2205    Chunk Flags: 8 bits\r
2206 \r
2207       Set to zero on transmit and ignored on receipt.\r
2208 \r
2209    Length:  16 bits (unsigned integer)\r
2210 \r
2211       Indicates the length of the parameter.  Set to 8.\r
2212 \r
2213    Cumulative TSN Ack: 32 bits (unsigned integer)\r
2214 \r
2215       This parameter contains the TSN of the last chunk received in\r
2216       sequence before any gaps.\r
2217 \r
2218       Note:  Since the SHUTDOWN message does not contain Gap Ack Blocks,\r
2219       it cannot be used to acknowledge TSNs received out of order.  In a\r
2220       SACK, lack of Gap Ack Blocks that were previously included\r
2221       indicates that the data receiver reneged on the associated DATA\r
2222       chunks.  Since SHUTDOWN does not contain Gap Ack Blocks, the\r
2223       receiver of the SHUTDOWN shouldn't interpret the lack of a Gap Ack\r
2224       Block as a renege. (see Section 6.2 for information on reneging)\r
2225 \r
2226 3.3.9 Shutdown Acknowledgement (SHUTDOWN ACK) (8):\r
2227 \r
2228    This chunk MUST be used to acknowledge the receipt of the SHUTDOWN\r
2229    chunk at the completion of the shutdown process, see Section 9.2 for\r
2230    details.\r
2231 \r
2232    The SHUTDOWN ACK chunk has no parameters.\r
2233 \r
2234        0                   1                   2                   3\r
2235        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2236       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2237       |   Type = 8    |Chunk  Flags   |      Length = 4               |\r
2238       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2239 \r
2240 \r
2241 \r
2242 Stewart, et al.             Standards Track                    [Page 40]\r
2243 \f\r
2244 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2245 \r
2246 \r
2247    Chunk Flags:  8 bits\r
2248 \r
2249       Set to zero on transmit and ignored on receipt.\r
2250 \r
2251 3.3.10 Operation Error (ERROR) (9):\r
2252 \r
2253    An endpoint sends this chunk to its peer endpoint to notify it of\r
2254    certain error conditions.  It contains one or more error causes.  An\r
2255    Operation Error is not considered fatal in and of itself, but may be\r
2256    used with an ABORT chunk to report a fatal condition.  It has the\r
2257    following parameters:\r
2258 \r
2259        0                   1                   2                   3\r
2260        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2261       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2262       |   Type = 9    | Chunk  Flags  |           Length              |\r
2263       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2264       \                                                               \\r
2265       /                    one or more Error Causes                   /\r
2266       \                                                               \\r
2267       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2268 \r
2269    Chunk Flags:  8 bits\r
2270 \r
2271       Set to zero on transmit and ignored on receipt.\r
2272 \r
2273    Length:  16 bits (unsigned integer)\r
2274 \r
2275       Set to the size of the chunk in bytes, including the chunk header\r
2276       and all the Error Cause fields present.\r
2277 \r
2278    Error causes are defined as variable-length parameters using the\r
2279    format described in 3.2.1, i.e.:\r
2280 \r
2281        0                   1                   2                   3\r
2282        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2283       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2284       |           Cause Code          |       Cause Length            |\r
2285       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2286       /                    Cause-specific Information                 /\r
2287       \                                                               \\r
2288       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2289 \r
2290    Cause Code: 16 bits (unsigned integer)\r
2291 \r
2292       Defines the type of error conditions being reported.\r
2293 \r
2294 \r
2295 \r
2296 \r
2297 \r
2298 Stewart, et al.             Standards Track                    [Page 41]\r
2299 \f\r
2300 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2301 \r
2302 \r
2303       Cause Code\r
2304       Value           Cause Code\r
2305       ---------      ----------------\r
2306        1              Invalid Stream Identifier\r
2307        2              Missing Mandatory Parameter\r
2308        3              Stale Cookie Error\r
2309        4              Out of Resource\r
2310        5              Unresolvable Address\r
2311        6              Unrecognized Chunk Type\r
2312        7              Invalid Mandatory Parameter\r
2313        8              Unrecognized Parameters\r
2314        9              No User Data\r
2315       10              Cookie Received While Shutting Down\r
2316 \r
2317    Cause Length: 16 bits (unsigned integer)\r
2318 \r
2319       Set to the size of the parameter in bytes, including the Cause\r
2320       Code, Cause Length, and Cause-Specific Information fields\r
2321 \r
2322    Cause-specific Information: variable length\r
2323 \r
2324       This field carries the details of the error condition.\r
2325 \r
2326    Sections 3.3.10.1 - 3.3.10.10 define error causes for SCTP.\r
2327    Guidelines for the IETF to define new error cause values are\r
2328    discussed in Section 13.3.\r
2329 \r
2330 3.3.10.1 Invalid Stream Identifier (1)\r
2331 \r
2332    Cause of error\r
2333    ---------------\r
2334    Invalid Stream Identifier:  Indicates endpoint received a DATA chunk\r
2335    sent to a nonexistent stream.\r
2336 \r
2337       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2338       |     Cause Code=1              |      Cause Length=8           |\r
2339       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2340       |        Stream Identifier      |         (Reserved)            |\r
2341       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2342 \r
2343    Stream Identifier: 16 bits (unsigned integer)\r
2344 \r
2345       Contains the Stream Identifier of the DATA chunk received in\r
2346       error.\r
2347 \r
2348 \r
2349 \r
2350 \r
2351 \r
2352 \r
2353 \r
2354 Stewart, et al.             Standards Track                    [Page 42]\r
2355 \f\r
2356 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2357 \r
2358 \r
2359    Reserved: 16 bits\r
2360 \r
2361       This field is reserved.  It is set to all 0's on transmit and\r
2362       Ignored on receipt.\r
2363 \r
2364 3.3.10.2 Missing Mandatory Parameter (2)\r
2365 \r
2366    Cause of error\r
2367    ---------------\r
2368    Missing Mandatory Parameter:  Indicates that one or more mandatory\r
2369    TLV parameters are missing in a received INIT or INIT ACK.\r
2370 \r
2371       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2372       |     Cause Code=2              |      Cause Length=8+N*2       |\r
2373       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2374       |                   Number of missing params=N                  |\r
2375       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2376       |   Missing Param Type #1       |   Missing Param Type #2       |\r
2377       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2378       |   Missing Param Type #N-1     |   Missing Param Type #N       |\r
2379       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2380 \r
2381    Number of Missing params:  32 bits (unsigned integer)\r
2382 \r
2383       This field contains the number of parameters contained in the\r
2384       Cause-specific Information field.\r
2385 \r
2386    Missing Param Type:  16 bits (unsigned integer)\r
2387 \r
2388       Each field will contain the missing mandatory parameter number.\r
2389 \r
2390 3.3.10.3 Stale Cookie Error (3)\r
2391 \r
2392    Cause of error\r
2393    --------------\r
2394    Stale Cookie Error:  Indicates the receipt of a valid State Cookie\r
2395    that has expired.\r
2396 \r
2397       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2398       |     Cause Code=3              |       Cause Length=8          |\r
2399       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2400       |                 Measure of Staleness (usec.)                  |\r
2401       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2402 \r
2403    Measure of Staleness:  32 bits (unsigned integer)\r
2404 \r
2405       This field contains the difference, in microseconds, between the\r
2406       current time and the time the State Cookie expired.\r
2407 \r
2408 \r
2409 \r
2410 Stewart, et al.             Standards Track                    [Page 43]\r
2411 \f\r
2412 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2413 \r
2414 \r
2415       The sender of this error cause MAY choose to report how long past\r
2416       expiration the State Cookie is by including a non-zero value in\r
2417       the Measure of Staleness field.  If the sender does not wish to\r
2418       provide this information it should set the Measure of Staleness\r
2419       field to the value of zero.\r
2420 \r
2421 3.3.10.4 Out of Resource (4)\r
2422 \r
2423    Cause of error\r
2424    ---------------\r
2425    Out of Resource: Indicates that the sender is out of resource.  This\r
2426    is usually sent in combination with or within an ABORT.\r
2427 \r
2428       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2429       |     Cause Code=4              |      Cause Length=4           |\r
2430       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2431 \r
2432 3.3.10.5 Unresolvable Address (5)\r
2433 \r
2434    Cause of error\r
2435    ---------------\r
2436    Unresolvable Address: Indicates that the sender is not able to\r
2437    resolve the specified address parameter (e.g., type of address is not\r
2438    supported by the sender).  This is usually sent in combination with\r
2439    or within an ABORT.\r
2440 \r
2441       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2442       |     Cause Code=5              |      Cause Length             |\r
2443       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2444       /                  Unresolvable Address                         /\r
2445       \                                                               \\r
2446       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2447 \r
2448    Unresolvable Address:  variable length\r
2449 \r
2450       The unresolvable address field contains the complete Type, Length\r
2451       and Value of the address parameter (or Host Name parameter) that\r
2452       contains the unresolvable address or host name.\r
2453 \r
2454 3.3.10.6 Unrecognized Chunk Type (6)\r
2455 \r
2456    Cause of error\r
2457    ---------------\r
2458    Unrecognized Chunk Type:  This error cause is returned to the\r
2459    originator of the chunk if the receiver does not understand the chunk\r
2460    and the upper bits of the 'Chunk Type' are set to 01 or 11.\r
2461 \r
2462 \r
2463 \r
2464 \r
2465 \r
2466 Stewart, et al.             Standards Track                    [Page 44]\r
2467 \f\r
2468 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2469 \r
2470 \r
2471       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2472       |     Cause Code=6              |      Cause Length             |\r
2473       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2474       /                  Unrecognized Chunk                           /\r
2475       \                                                               \\r
2476       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2477 \r
2478    Unrecognized Chunk:  variable length\r
2479 \r
2480       The Unrecognized Chunk field contains the unrecognized Chunk from\r
2481       the SCTP packet complete with Chunk Type, Chunk Flags and Chunk\r
2482       Length.\r
2483 \r
2484 3.3.10.7 Invalid Mandatory Parameter (7)\r
2485 \r
2486    Cause of error\r
2487    ---------------\r
2488    Invalid Mandatory Parameter:  This error cause is returned to the\r
2489    originator of an INIT or INIT ACK chunk when one of the mandatory\r
2490    parameters is set to a invalid value.\r
2491 \r
2492       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2493       |     Cause Code=7              |      Cause Length=4           |\r
2494       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2495 \r
2496 3.3.10.8 Unrecognized Parameters (8)\r
2497 \r
2498    Cause of error\r
2499    ---------------\r
2500    Unrecognized Parameters:  This error cause is returned to the\r
2501    originator of the INIT ACK chunk if the receiver does not recognize\r
2502    one or more Optional TLV parameters in the INIT ACK chunk.\r
2503 \r
2504       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2505       |     Cause Code=8              |      Cause Length             |\r
2506       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2507       /                  Unrecognized Parameters                      /\r
2508       \                                                               \\r
2509       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2510 \r
2511    Unrecognized Parameters:  variable length\r
2512 \r
2513       The Unrecognized Parameters field contains the unrecognized\r
2514       parameters copied from the INIT ACK chunk complete with TLV.  This\r
2515       error cause is normally contained in an ERROR chunk bundled with\r
2516       the COOKIE ECHO chunk when responding to the INIT ACK, when the\r
2517       sender of the COOKIE ECHO chunk wishes to report unrecognized\r
2518       parameters.\r
2519 \r
2520 \r
2521 \r
2522 Stewart, et al.             Standards Track                    [Page 45]\r
2523 \f\r
2524 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2525 \r
2526 \r
2527 3.3.10.9 No User Data (9)\r
2528 \r
2529    Cause of error\r
2530    ---------------\r
2531    No User Data:  This error cause is returned to the originator of a\r
2532    DATA chunk if a received DATA chunk has no user data.\r
2533 \r
2534       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2535       |     Cause Code=9              |      Cause Length=8           |\r
2536       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2537       /                  TSN value                                    /\r
2538       \                                                               \\r
2539       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2540 \r
2541    TSN value:  32 bits (+unsigned integer)\r
2542 \r
2543       The TSN value field contains the TSN of the DATA chunk received\r
2544       with no user data field.\r
2545 \r
2546       This cause code is normally returned in an ABORT chunk (see\r
2547       Section 6.2)\r
2548 \r
2549 3.3.10.10 Cookie Received While Shutting Down (10)\r
2550 \r
2551    Cause of error\r
2552    ---------------\r
2553    Cookie Received While Shutting Down:  A COOKIE ECHO was received\r
2554    While the endpoint was in SHUTDOWN-ACK-SENT state.  This error is\r
2555    usually returned in an ERROR chunk bundled with the retransmitted\r
2556    SHUTDOWN ACK.\r
2557 \r
2558       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2559       |     Cause Code=10              |      Cause Length=4          |\r
2560       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2561 \r
2562 3.3.11 Cookie Echo (COOKIE ECHO) (10):\r
2563 \r
2564    This chunk is used only during the initialization of an association.\r
2565    It is sent by the initiator of an association to its peer to complete\r
2566    the initialization process.  This chunk MUST precede any DATA chunk\r
2567    sent within the association, but MAY be bundled with one or more DATA\r
2568    chunks in the same packet.\r
2569 \r
2570 \r
2571 \r
2572 \r
2573 \r
2574 \r
2575 \r
2576 \r
2577 \r
2578 Stewart, et al.             Standards Track                    [Page 46]\r
2579 \f\r
2580 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2581 \r
2582 \r
2583        0                   1                   2                   3\r
2584        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2585       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2586       |   Type = 10   |Chunk  Flags   |         Length                |\r
2587       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2588       /                     Cookie                                    /\r
2589       \                                                               \\r
2590       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2591 \r
2592    Chunk Flags: 8 bit\r
2593 \r
2594       Set to zero on transmit and ignored on receipt.\r
2595 \r
2596    Length: 16 bits (unsigned integer)\r
2597 \r
2598       Set to the size of the chunk in bytes, including the 4 bytes of\r
2599       the chunk header and the size of the Cookie.\r
2600 \r
2601    Cookie: variable size\r
2602 \r
2603       This field must contain the exact cookie received in the State\r
2604       Cookie parameter from the previous INIT ACK.\r
2605 \r
2606       An implementation SHOULD make the cookie as small as possible to\r
2607       insure interoperability.\r
2608 \r
2609 3.3.12 Cookie Acknowledgement (COOKIE ACK) (11):\r
2610 \r
2611    This chunk is used only during the initialization of an association.\r
2612    It is used to acknowledge the receipt of a COOKIE ECHO chunk.  This\r
2613    chunk MUST precede any DATA or SACK chunk sent within the\r
2614    association, but MAY be bundled with one or more DATA chunks or SACK\r
2615    chunk in the same SCTP packet.\r
2616 \r
2617        0                   1                   2                   3\r
2618        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2619       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2620       |   Type = 11   |Chunk  Flags   |     Length = 4                |\r
2621       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2622 \r
2623    Chunk Flags: 8 bits\r
2624 \r
2625       Set to zero on transmit and ignored on receipt.\r
2626 \r
2627 \r
2628 \r
2629 \r
2630 \r
2631 \r
2632 \r
2633 \r
2634 Stewart, et al.             Standards Track                    [Page 47]\r
2635 \f\r
2636 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2637 \r
2638 \r
2639 3.3.13 Shutdown Complete (SHUTDOWN COMPLETE) (14):\r
2640 \r
2641    This chunk MUST be used to acknowledge the receipt of the SHUTDOWN\r
2642    ACK chunk at the completion of the shutdown process, see Section 9.2\r
2643    for details.\r
2644 \r
2645    The SHUTDOWN COMPLETE chunk has no parameters.\r
2646 \r
2647        0                   1                   2                   3\r
2648        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
2649       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2650       |   Type = 14   |Reserved     |T|      Length = 4               |\r
2651       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
2652 \r
2653    Chunk Flags: 8 bits\r
2654 \r
2655    Reserved:  7 bits\r
2656 \r
2657       Set to 0 on transmit and ignored on receipt.\r
2658 \r
2659    T bit:  1 bit\r
2660 \r
2661       The T bit is set to 0 if the sender had a TCB that it destroyed.\r
2662       If the sender did not have a TCB it should set this bit to 1.\r
2663 \r
2664    Note: Special rules apply to this chunk for verification, please see\r
2665    Section 8.5.1 for details.\r
2666 \r
2667 4. SCTP Association State Diagram\r
2668 \r
2669    During the lifetime of an SCTP association, the SCTP endpoint's\r
2670    association progress from one state to another in response to various\r
2671    events.  The events that may potentially advance an association's\r
2672    state include:\r
2673 \r
2674    o  SCTP user primitive calls, e.g., [ASSOCIATE], [SHUTDOWN], [ABORT],\r
2675 \r
2676    o  Reception of INIT, COOKIE ECHO, ABORT, SHUTDOWN, etc., control\r
2677       chunks, or\r
2678 \r
2679    o  Some timeout events.\r
2680 \r
2681    The state diagram in the figures below illustrates state changes,\r
2682    together with the causing events and resulting actions.  Note that\r
2683    some of the error conditions are not shown in the state diagram.\r
2684    Full description of all special cases should be found in the text.\r
2685 \r
2686 \r
2687 \r
2688 \r
2689 \r
2690 Stewart, et al.             Standards Track                    [Page 48]\r
2691 \f\r
2692 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2693 \r
2694 \r
2695    Note: Chunk names are given in all capital letters, while parameter\r
2696    names have the first letter capitalized, e.g., COOKIE ECHO chunk type\r
2697    vs. State Cookie parameter.  If more than one event/message can occur\r
2698    which causes a state transition it is labeled (A), (B) etc.\r
2699 \r
2700                        -----          -------- (frm any state)\r
2701                      /       \      /  rcv ABORT      [ABORT]\r
2702     rcv INIT        |         |    |   ----------  or ----------\r
2703     --------------- |         v    v   delete TCB     snd ABORT\r
2704     generate Cookie  \    +---------+                 delete TCB\r
2705     snd INIT ACK       ---|  CLOSED |\r
2706                           +---------+\r
2707                            /      \      [ASSOCIATE]\r
2708                           /        \     ---------------\r
2709                          |          |    create TCB\r
2710                          |          |    snd INIT\r
2711                          |          |    strt init timer\r
2712           rcv valid      |          |\r
2713         COOKIE  ECHO     |          v\r
2714     (1) ---------------- |      +------------+\r
2715         create TCB       |      | COOKIE-WAIT| (2)\r
2716         snd COOKIE ACK   |      +------------+\r
2717                          |          |\r
2718                          |          |    rcv INIT ACK\r
2719                          |          |    -----------------\r
2720                          |          |    snd COOKIE ECHO\r
2721                          |          |    stop init timer\r
2722                          |          |    strt cookie timer\r
2723                          |          v\r
2724                          |      +--------------+\r
2725                          |      | COOKIE-ECHOED| (3)\r
2726                          |      +--------------+\r
2727                          |          |\r
2728                          |          |    rcv COOKIE ACK\r
2729                          |          |    -----------------\r
2730                          |          |    stop cookie timer\r
2731                          v          v\r
2732                        +---------------+\r
2733                        |  ESTABLISHED  |\r
2734                        +---------------+\r
2735 \r
2736 \r
2737 \r
2738 \r
2739 \r
2740 \r
2741 \r
2742 \r
2743 \r
2744 \r
2745 \r
2746 Stewart, et al.             Standards Track                    [Page 49]\r
2747 \f\r
2748 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2749 \r
2750 \r
2751                       (from the ESTABLISHED state only)\r
2752                                     |\r
2753                                     |\r
2754                            /--------+--------\\r
2755        [SHUTDOWN]         /                   \\r
2756        -------------------|                   |\r
2757        check outstanding  |                   |\r
2758        DATA chunks        |                   |\r
2759                           v                   |\r
2760                      +---------+              |\r
2761                      |SHUTDOWN-|              | rcv SHUTDOWN/check\r
2762                      |PENDING  |              | outstanding DATA\r
2763                      +---------+              | chunks\r
2764                           |                   |------------------\r
2765      No more outstanding  |                   |\r
2766      ---------------------|                   |\r
2767      snd SHUTDOWN         |                   |\r
2768      strt shutdown timer  |                   |\r
2769                           v                   v\r
2770                      +---------+        +-----------+\r
2771                  (4) |SHUTDOWN-|        | SHUTDOWN- |  (5,6)\r
2772                      |SENT     |        | RECEIVED  |\r
2773                      +---------+        +-----------+\r
2774                           |  \                |\r
2775     (A) rcv SHUTDOWN ACK  |   \               |\r
2776     ----------------------|    \              |\r
2777     stop shutdown timer   |     \rcv:SHUTDOWN |\r
2778     send SHUTDOWN COMPLETE|      \  (B)       |\r
2779     delete TCB            |       \           |\r
2780                           |        \          | No more outstanding\r
2781                           |         \         |-----------------\r
2782                           |          \        | send SHUTDOWN ACK\r
2783     (B)rcv SHUTDOWN       |           \       | strt shutdown timer\r
2784     ----------------------|            \      |\r
2785     send SHUTDOWN ACK     |             \     |\r
2786     start shutdown timer  |              \    |\r
2787     move to SHUTDOWN-     |               \   |\r
2788     ACK-SENT              |                |  |\r
2789                           |                v  |\r
2790                           |             +-----------+\r
2791                           |             | SHUTDOWN- | (7)\r
2792                           |             | ACK-SENT  |\r
2793                           |             +----------+-\r
2794                           |                   | (C)rcv SHUTDOWN COMPLETE\r
2795                           |                   |-----------------\r
2796                           |                   | stop shutdown timer\r
2797                           |                   | delete TCB\r
2798                           |                   |\r
2799 \r
2800 \r
2801 \r
2802 Stewart, et al.             Standards Track                    [Page 50]\r
2803 \f\r
2804 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2805 \r
2806 \r
2807                           |                   | (D)rcv SHUTDOWN ACK\r
2808                           |                   |--------------\r
2809                           |                   | stop shutdown timer\r
2810                           |                   | send SHUTDOWN COMPLETE\r
2811                           |                   | delete TCB\r
2812                           |                   |\r
2813                           \    +---------+    /\r
2814                            \-->| CLOSED  |<--/\r
2815                                +---------+\r
2816 \r
2817               Figure 3: State Transition Diagram of SCTP\r
2818 \r
2819    Notes:\r
2820 \r
2821    1) If the State Cookie in the received COOKIE ECHO is invalid (i.e.,\r
2822       failed to pass the integrity check), the receiver MUST silently\r
2823       discard the packet.  Or, if the received State Cookie is expired\r
2824       (see Section 5.1.5), the receiver MUST send back an ERROR chunk.\r
2825       In either case, the receiver stays in the CLOSED state.\r
2826 \r
2827    2) If the T1-init timer expires, the endpoint MUST retransmit INIT\r
2828       and re-start the T1-init timer without changing state.  This MUST\r
2829       be repeated up to 'Max.Init.Retransmits' times.  After that, the\r
2830       endpoint MUST abort the initialization process and report the\r
2831       error to SCTP user.\r
2832 \r
2833    3) If the T1-cookie timer expires, the endpoint MUST retransmit\r
2834       COOKIE ECHO and re-start the T1-cookie timer without changing\r
2835       state.  This MUST be repeated up to 'Max.Init.Retransmits' times.\r
2836       After that, the endpoint MUST abort the initialization process and\r
2837       report the error to SCTP user.\r
2838 \r
2839    4) In SHUTDOWN-SENT state the endpoint MUST acknowledge any received\r
2840       DATA chunks without delay.\r
2841 \r
2842    5) In SHUTDOWN-RECEIVED state, the endpoint MUST NOT accept any new\r
2843       send request from its SCTP user.\r
2844 \r
2845    6) In SHUTDOWN-RECEIVED state, the endpoint MUST transmit or\r
2846       retransmit data and leave this state when all data in queue is\r
2847       transmitted.\r
2848 \r
2849    7) In SHUTDOWN-ACK-SENT state, the endpoint MUST NOT accept any new\r
2850       send request from its SCTP user.\r
2851 \r
2852    The CLOSED state is used to indicate that an association is not\r
2853    created (i.e., doesn't exist).\r
2854 \r
2855 \r
2856 \r
2857 \r
2858 Stewart, et al.             Standards Track                    [Page 51]\r
2859 \f\r
2860 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2861 \r
2862 \r
2863 5. Association Initialization\r
2864 \r
2865    Before the first data transmission can take place from one SCTP\r
2866    endpoint ("A") to another SCTP endpoint ("Z"), the two endpoints must\r
2867    complete an initialization process in order to set up an SCTP\r
2868    association between them.\r
2869 \r
2870    The SCTP user at an endpoint should use the ASSOCIATE primitive to\r
2871    initialize an SCTP association to another SCTP endpoint.\r
2872 \r
2873    IMPLEMENTATION NOTE: From an SCTP-user's point of view, an\r
2874    association may be implicitly opened, without an ASSOCIATE primitive\r
2875    (see 10.1 B) being invoked, by the initiating endpoint's sending of\r
2876    the first user data to the destination endpoint.  The initiating SCTP\r
2877    will assume default values for all mandatory and optional parameters\r
2878    for the INIT/INIT ACK.\r
2879 \r
2880    Once the association is established, unidirectional streams are open\r
2881    for data transfer on both ends (see Section 5.1.1).\r
2882 \r
2883 5.1 Normal Establishment of an Association\r
2884 \r
2885    The initialization process consists of the following steps (assuming\r
2886    that SCTP endpoint "A" tries to set up an association with SCTP\r
2887    endpoint "Z" and "Z" accepts the new association):\r
2888 \r
2889    A) "A" first sends an INIT chunk to "Z".  In the INIT, "A" must\r
2890       provide its Verification Tag (Tag_A) in the Initiate Tag field.\r
2891       Tag_A SHOULD be a random number in the range of 1 to 4294967295\r
2892       (see 5.3.1 for Tag value selection).  After sending the INIT, "A"\r
2893       starts the T1-init timer and enters the COOKIE-WAIT state.\r
2894 \r
2895    B) "Z" shall respond immediately with an INIT ACK chunk.  The\r
2896       destination IP address of the INIT ACK MUST be set to the source\r
2897       IP address of the INIT to which this INIT ACK is responding.  In\r
2898       the response, besides filling in other parameters, "Z" must set\r
2899       the Verification Tag field to Tag_A, and also provide its own\r
2900       Verification Tag (Tag_Z) in the Initiate Tag field.\r
2901 \r
2902       Moreover, "Z" MUST generate and send along with the INIT ACK a\r
2903       State Cookie.  See Section 5.1.3 for State Cookie generation.\r
2904 \r
2905       Note: After sending out INIT ACK with the State Cookie parameter,\r
2906       "Z" MUST NOT allocate any resources, nor keep any states for the\r
2907       new association.  Otherwise, "Z" will be vulnerable to resource\r
2908       attacks.\r
2909 \r
2910 \r
2911 \r
2912 \r
2913 \r
2914 Stewart, et al.             Standards Track                    [Page 52]\r
2915 \f\r
2916 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2917 \r
2918 \r
2919    C) Upon reception of the INIT ACK from "Z", "A" shall stop the T1-\r
2920       init timer and leave COOKIE-WAIT state.  "A" shall then send the\r
2921       State Cookie received in the INIT ACK chunk in a COOKIE ECHO\r
2922       chunk, start the T1-cookie timer, and enter the COOKIE-ECHOED\r
2923       state.\r
2924 \r
2925       Note: The COOKIE ECHO chunk can be bundled with any pending\r
2926       outbound DATA chunks, but it MUST be the first chunk in the packet\r
2927       and until the COOKIE ACK is returned the sender MUST NOT send any\r
2928       other packets to the peer.\r
2929 \r
2930    D) Upon reception of the COOKIE ECHO chunk, Endpoint "Z" will reply\r
2931       with a COOKIE ACK chunk after building a TCB and moving to the\r
2932       ESTABLISHED state.  A COOKIE ACK chunk may be bundled with any\r
2933       pending DATA chunks (and/or SACK chunks), but the COOKIE ACK chunk\r
2934       MUST be the first chunk in the packet.\r
2935 \r
2936       IMPLEMENTATION NOTE: An implementation may choose to send the\r
2937       Communication Up notification to the SCTP user upon reception of a\r
2938       valid COOKIE ECHO chunk.\r
2939 \r
2940    E) Upon reception of the COOKIE ACK, endpoint "A" will move from the\r
2941       COOKIE-ECHOED state to the ESTABLISHED state, stopping the T1-\r
2942       cookie timer.  It may also notify its ULP about the successful\r
2943       establishment of the association with a Communication Up\r
2944       notification (see Section 10).\r
2945 \r
2946    An INIT or INIT ACK chunk MUST NOT be bundled with any other chunk.\r
2947    They MUST be the only chunks present in the SCTP packets that carry\r
2948    them.\r
2949 \r
2950    An endpoint MUST send the INIT ACK to the IP address from which it\r
2951    received the INIT.\r
2952 \r
2953    Note: T1-init timer and T1-cookie timer shall follow the same rules\r
2954    given in Section 6.3.\r
2955 \r
2956    If an endpoint receives an INIT, INIT ACK, or COOKIE ECHO chunk but\r
2957    decides not to establish the new association due to missing mandatory\r
2958    parameters in the received INIT or INIT ACK, invalid parameter\r
2959    values, or lack of local resources, it MUST respond with an ABORT\r
2960    chunk.  It SHOULD also specify the cause of abort, such as the type\r
2961    of the missing mandatory parameters, etc., by including the error\r
2962    cause parameters with the ABORT chunk.  The Verification Tag field in\r
2963    the common header of the outbound SCTP packet containing the ABORT\r
2964    chunk MUST be set to the Initiate Tag value of the peer.\r
2965 \r
2966 \r
2967 \r
2968 \r
2969 \r
2970 Stewart, et al.             Standards Track                    [Page 53]\r
2971 \f\r
2972 RFC 2960          Stream Control Transmission Protocol      October 2000\r
2973 \r
2974 \r
2975    After the reception of the first DATA chunk in an association the\r
2976    endpoint MUST immediately respond with a SACK to acknowledge the DATA\r
2977    chunk.  Subsequent acknowledgements should be done as described in\r
2978    Section 6.2.\r
2979 \r
2980    When the TCB is created, each endpoint MUST set its internal\r
2981    Cumulative TSN Ack Point to the value of its transmitted Initial TSN\r
2982    minus one.\r
2983 \r
2984    IMPLEMENTATION NOTE:  The IP addresses and SCTP port are generally\r
2985    used as the key to find the TCB within an SCTP instance.\r
2986 \r
2987 5.1.1 Handle Stream Parameters\r
2988 \r
2989    In the INIT and INIT ACK chunks, the sender of the chunk shall\r
2990    indicate the number of outbound streams (OS) it wishes to have in the\r
2991    association, as well as the maximum inbound streams (MIS) it will\r
2992    accept from the other endpoint.\r
2993 \r
2994    After receiving the stream configuration information from the other\r
2995    side, each endpoint shall perform the following check:  If the peer's\r
2996    MIS is less than the endpoint's OS, meaning that the peer is\r
2997    incapable of supporting all the outbound streams the endpoint wants\r
2998    to configure, the endpoint MUST either use MIS outbound streams, or\r
2999    abort the association and report to its upper layer the resources\r
3000    shortage at its peer.\r
3001 \r
3002    After the association is initialized, the valid outbound stream\r
3003    identifier range for either endpoint shall be 0 to min(local OS,\r
3004    remote MIS)-1.\r
3005 \r
3006 5.1.2 Handle Address Parameters\r
3007 \r
3008    During the association initialization, an endpoint shall use the\r
3009    following rules to discover and collect the destination transport\r
3010    address(es) of its peer.\r
3011 \r
3012    A) If there are no address parameters present in the received INIT or\r
3013       INIT ACK chunk, the endpoint shall take the source IP address from\r
3014       which the chunk arrives and record it, in combination with the\r
3015       SCTP source port number, as the only destination transport address\r
3016       for this peer.\r
3017 \r
3018    B) If there is a Host Name parameter present in the received INIT or\r
3019       INIT ACK chunk, the endpoint shall resolve that host name to a\r
3020       list of IP address(es) and derive the transport address(es) of\r
3021       this peer by combining the resolved IP address(es) with the SCTP\r
3022       source port.\r
3023 \r
3024 \r
3025 \r
3026 Stewart, et al.             Standards Track                    [Page 54]\r
3027 \f\r
3028 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3029 \r
3030 \r
3031       The endpoint MUST ignore any other IP address parameters if they\r
3032       are also present in the received INIT or INIT ACK chunk.\r
3033 \r
3034       The time at which the receiver of an INIT resolves the host name\r
3035       has potential security implications to SCTP.  If the receiver of\r
3036       an INIT resolves the host name upon the reception of the chunk,\r
3037       and the mechanism the receiver uses to resolve the host name\r
3038       involves potential long delay (e.g. DNS query), the receiver may\r
3039       open itself up to resource attacks for the period of time while it\r
3040       is waiting for the name resolution results before it can build the\r
3041       State Cookie and release local resources.\r
3042 \r
3043       Therefore, in cases where the name translation involves potential\r
3044       long delay, the receiver of the INIT MUST postpone the name\r
3045       resolution till the reception of the COOKIE ECHO chunk from the\r
3046       peer.  In such a case, the receiver of the INIT SHOULD build the\r
3047       State Cookie using the received Host Name (instead of destination\r
3048       transport addresses) and send the INIT ACK to the source IP\r
3049       address from which the INIT was received.\r
3050 \r
3051       The receiver of an INIT ACK shall always immediately attempt to\r
3052       resolve the name upon the reception of the chunk.\r
3053 \r
3054       The receiver of the INIT or INIT ACK MUST NOT send user data\r
3055       (piggy-backed or stand-alone) to its peer until the host name is\r
3056       successfully resolved.\r
3057 \r
3058       If the name resolution is not successful, the endpoint MUST\r
3059       immediately send an ABORT with "Unresolvable Address" error cause\r
3060       to its peer.  The ABORT shall be sent to the source IP address\r
3061       from which the last peer packet was received.\r
3062 \r
3063    C) If there are only IPv4/IPv6 addresses present in the received INIT\r
3064       or INIT ACK chunk, the receiver shall derive and record all the\r
3065       transport address(es) from the received chunk AND the source IP\r
3066       address that sent the INIT or INIT ACK.  The transport address(es)\r
3067       are derived by the combination of SCTP source port (from the\r
3068       common header) and the IP address parameter(s) carried in the INIT\r
3069       or INIT ACK chunk and the source IP address of the IP datagram.\r
3070       The receiver should use only these transport addresses as\r
3071       destination transport addresses when sending subsequent packets to\r
3072       its peer.\r
3073 \r
3074       IMPLEMENTATION NOTE: In some cases (e.g., when the implementation\r
3075       doesn't control the source IP address that is used for\r
3076       transmitting), an endpoint might need to include in its INIT or\r
3077       INIT ACK all possible IP addresses from which packets to the peer\r
3078       could be transmitted.\r
3079 \r
3080 \r
3081 \r
3082 Stewart, et al.             Standards Track                    [Page 55]\r
3083 \f\r
3084 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3085 \r
3086 \r
3087    After all transport addresses are derived from the INIT or INIT ACK\r
3088    chunk using the above rules, the endpoint shall select one of the\r
3089    transport addresses as the initial primary path.\r
3090 \r
3091    Note: The INIT-ACK MUST be sent to the source address of the INIT.\r
3092 \r
3093    The sender of INIT may include a 'Supported Address Types' parameter\r
3094    in the INIT to indicate what types of address are acceptable.  When\r
3095    this parameter is present, the receiver of INIT (initiatee) MUST\r
3096    either use one of the address types indicated in the Supported\r
3097    Address Types parameter when responding to the INIT, or abort the\r
3098    association with an "Unresolvable Address" error cause if it is\r
3099    unwilling or incapable of using any of the address types indicated by\r
3100    its peer.\r
3101 \r
3102    IMPLEMENTATION NOTE: In the case that the receiver of an INIT ACK\r
3103    fails to resolve the address parameter due to an unsupported type, it\r
3104    can abort the initiation process and then attempt a re-initiation by\r
3105    using a 'Supported Address Types' parameter in the new INIT to\r
3106    indicate what types of address it prefers.\r
3107 \r
3108 5.1.3 Generating State Cookie\r
3109 \r
3110    When sending an INIT ACK as a response to an INIT chunk, the sender\r
3111    of INIT ACK creates a State Cookie and sends it in the State Cookie\r
3112    parameter of the INIT ACK.  Inside this State Cookie, the sender\r
3113    should include a MAC (see [RFC2104] for an example), a time stamp on\r
3114    when the State Cookie is created, and the lifespan of the State\r
3115    Cookie, along with all the information necessary for it to establish\r
3116    the association.\r
3117 \r
3118    The following steps SHOULD be taken to generate the State Cookie:\r
3119 \r
3120    1) Create an association TCB using information from both the received\r
3121       INIT and the outgoing INIT ACK chunk,\r
3122 \r
3123    2) In the TCB, set the creation time to the current time of day, and\r
3124       the lifespan to the protocol parameter 'Valid.Cookie.Life',\r
3125 \r
3126    3) From the TCB, identify and collect the minimal subset of\r
3127       information needed to re-create the TCB, and generate a MAC using\r
3128       this subset of information and a secret key (see [RFC2104] for an\r
3129       example of generating a MAC), and\r
3130 \r
3131    4) Generate the State Cookie by combining this subset of information\r
3132       and the resultant MAC.\r
3133 \r
3134 \r
3135 \r
3136 \r
3137 \r
3138 Stewart, et al.             Standards Track                    [Page 56]\r
3139 \f\r
3140 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3141 \r
3142 \r
3143    After sending the INIT ACK with the State Cookie parameter, the\r
3144    sender SHOULD delete the TCB and any other local resource related to\r
3145    the new association, so as to prevent resource attacks.\r
3146 \r
3147    The hashing method used to generate the MAC is strictly a private\r
3148    matter for the receiver of the INIT chunk.  The use of a MAC is\r
3149    mandatory to prevent denial of service attacks.  The secret key\r
3150    SHOULD be random ([RFC1750] provides some information on randomness\r
3151    guidelines); it SHOULD be changed reasonably frequently, and the\r
3152    timestamp in the State Cookie MAY be used to determine which key\r
3153    should be used to verify the MAC.\r
3154 \r
3155    An implementation SHOULD make the cookie as small as possible to\r
3156    insure interoperability.\r
3157 \r
3158 5.1.4 State Cookie Processing\r
3159 \r
3160    When an endpoint (in the COOKIE WAIT state) receives an INIT ACK\r
3161    chunk with a State Cookie parameter, it MUST immediately send a\r
3162    COOKIE ECHO chunk to its peer with the received State Cookie.  The\r
3163    sender MAY also add any pending DATA chunks to the packet after the\r
3164    COOKIE ECHO chunk.\r
3165 \r
3166    The endpoint shall also start the T1-cookie timer after sending out\r
3167    the COOKIE ECHO chunk.  If the timer expires, the endpoint shall\r
3168    retransmit the COOKIE ECHO chunk and restart the T1-cookie timer.\r
3169    This is repeated until either a COOKIE ACK is received or '\r
3170    Max.Init.Retransmits' is reached causing the peer endpoint to be\r
3171    marked unreachable (and thus the association enters the CLOSED\r
3172    state).\r
3173 \r
3174 5.1.5 State Cookie Authentication\r
3175 \r
3176    When an endpoint receives a COOKIE ECHO chunk from another endpoint\r
3177    with which it has no association, it shall take the following\r
3178    actions:\r
3179 \r
3180    1) Compute a MAC using the TCB data carried in the State Cookie and\r
3181       the secret key (note the timestamp in the State Cookie MAY be used\r
3182       to determine which secret key to use).  Reference [RFC2104] can be\r
3183       used as a guideline for generating the MAC,\r
3184 \r
3185    2) Authenticate the State Cookie as one that it previously generated\r
3186       by comparing the computed MAC against the one carried in the State\r
3187       Cookie.  If this comparison fails, the SCTP packet, including the\r
3188       COOKIE ECHO and any DATA chunks, should be silently discarded,\r
3189 \r
3190 \r
3191 \r
3192 \r
3193 \r
3194 Stewart, et al.             Standards Track                    [Page 57]\r
3195 \f\r
3196 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3197 \r
3198 \r
3199    3) Compare the creation timestamp in the State Cookie to the current\r
3200       local time.  If the elapsed time is longer than the lifespan\r
3201       carried in the State Cookie, then the packet, including the COOKIE\r
3202       ECHO and any attached DATA chunks, SHOULD be discarded and the\r
3203       endpoint MUST transmit an ERROR chunk with a "Stale Cookie" error\r
3204       cause to the peer endpoint,\r
3205 \r
3206    4) If the State Cookie is valid, create an association to the sender\r
3207       of the COOKIE ECHO chunk with the information in the TCB data\r
3208       carried in the COOKIE ECHO, and enter the ESTABLISHED state,\r
3209 \r
3210    5) Send a COOKIE ACK chunk to the peer acknowledging reception of the\r
3211       COOKIE ECHO.  The COOKIE ACK MAY be bundled with an outbound DATA\r
3212       chunk or SACK chunk; however, the COOKIE ACK MUST be the first\r
3213       chunk in the SCTP packet.\r
3214 \r
3215    6) Immediately acknowledge any DATA chunk bundled with the COOKIE\r
3216       ECHO with a SACK (subsequent DATA chunk acknowledgement should\r
3217       follow the rules defined in Section 6.2).  As mentioned in step\r
3218       5), if the SACK is bundled with the COOKIE ACK, the COOKIE ACK\r
3219       MUST appear first in the SCTP packet.\r
3220 \r
3221    If a COOKIE ECHO is received from an endpoint with which the receiver\r
3222    of the COOKIE ECHO has an existing association, the procedures in\r
3223    Section 5.2 should be followed.\r
3224 \r
3225 5.1.6 An Example of Normal Association Establishment\r
3226 \r
3227    In the following example, "A" initiates the association and then\r
3228    sends a user message to "Z", then "Z" sends two user messages to "A"\r
3229    later (assuming no bundling or fragmentation occurs):\r
3230 \r
3231 \r
3232 \r
3233 \r
3234 \r
3235 \r
3236 \r
3237 \r
3238 \r
3239 \r
3240 \r
3241 \r
3242 \r
3243 \r
3244 \r
3245 \r
3246 \r
3247 \r
3248 \r
3249 \r
3250 Stewart, et al.             Standards Track                    [Page 58]\r
3251 \f\r
3252 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3253 \r
3254 \r
3255    Endpoint A                                          Endpoint Z\r
3256    {app sets association with Z}\r
3257    (build TCB)\r
3258    INIT [I-Tag=Tag_A\r
3259          & other info]  --------\\r
3260    (Start T1-init timer)         \\r
3261    (Enter COOKIE-WAIT state)      \---> (compose temp TCB and Cookie_Z)\r
3262 \r
3263                                    /--- INIT ACK [Veri Tag=Tag_A,\r
3264                                   /              I-Tag=Tag_Z,\r
3265    (Cancel T1-init timer) <------/               Cookie_Z, & other info]\r
3266                                         (destroy temp TCB)\r
3267    COOKIE ECHO [Cookie_Z] ------\\r
3268    (Start T1-init timer)         \\r
3269    (Enter COOKIE-ECHOED state)    \---> (build TCB enter ESTABLISHED\r
3270                                          state)\r
3271 \r
3272 \r
3273                                   /---- COOKIE-ACK\r
3274                                  /\r
3275    (Cancel T1-init timer, <-----/\r
3276     Enter ESTABLISHED state)\r
3277    {app sends 1st user data; strm 0}\r
3278    DATA [TSN=initial TSN_A\r
3279        Strm=0,Seq=1 & user data]--\\r
3280     (Start T3-rtx timer)            \\r
3281                                      \->\r
3282                                  /----- SACK [TSN Ack=init\r
3283                                              TSN_A,Block=0]\r
3284    (Cancel T3-rtx timer) <------/\r
3285 \r
3286                                         ...\r
3287                                         {app sends 2 messages;strm 0}\r
3288                                   /---- DATA\r
3289                                  /        [TSN=init TSN_Z\r
3290                              <--/          Strm=0,Seq=1 & user data 1]\r
3291    SACK [TSN Ack=init TSN_Z,      /---- DATA\r
3292          Block=0]     --------\  /        [TSN=init TSN_Z +1,\r
3293                                \/          Strm=0,Seq=2 & user data 2]\r
3294                         <------/\\r
3295                                  \\r
3296                                   \------>\r
3297 \r
3298                      Figure 4: INITiation Example\r
3299 \r
3300    If the T1-init timer expires at "A" after the INIT or COOKIE ECHO\r
3301    chunks are sent, the same INIT or COOKIE ECHO chunk with the same\r
3302    Initiate Tag (i.e., Tag_A) or State Cookie shall be retransmitted and\r
3303 \r
3304 \r
3305 \r
3306 Stewart, et al.             Standards Track                    [Page 59]\r
3307 \f\r
3308 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3309 \r
3310 \r
3311    the timer restarted.  This shall be repeated Max.Init.Retransmits\r
3312    times before "A" considers "Z" unreachable and reports the failure to\r
3313    its upper layer (and thus the association enters the CLOSED state).\r
3314    When retransmitting the INIT, the endpoint MUST follow the rules\r
3315    defined in 6.3 to determine the proper timer value.\r
3316 \r
3317 5.2 Handle Duplicate or Unexpected INIT, INIT ACK, COOKIE ECHO, and\r
3318    COOKIE ACK\r
3319 \r
3320    During the lifetime of an association (in one of the possible\r
3321    states), an endpoint may receive from its peer endpoint one of the\r
3322    setup chunks (INIT, INIT ACK, COOKIE ECHO, and COOKIE ACK).  The\r
3323    receiver shall treat such a setup chunk as a duplicate and process it\r
3324    as described in this section.\r
3325 \r
3326    Note:  An endpoint will not receive the chunk unless the chunk was\r
3327    sent to a SCTP transport address and is from a SCTP transport address\r
3328    associated with this endpoint.  Therefore, the endpoint processes\r
3329    such a chunk as part of its current association.\r
3330 \r
3331    The following scenarios can cause duplicated or unexpected chunks:\r
3332 \r
3333    A) The peer has crashed without being detected, re-started itself and\r
3334       sent out a new INIT chunk trying to restore the association,\r
3335 \r
3336    B) Both sides are trying to initialize the association at about the\r
3337       same time,\r
3338 \r
3339    C) The chunk is from a stale packet that was used to establish the\r
3340       present association or a past association that is no longer in\r
3341       existence,\r
3342 \r
3343    D) The chunk is a false packet generated by an attacker, or\r
3344 \r
3345    E) The peer never received the COOKIE ACK and is retransmitting its\r
3346       COOKIE ECHO.\r
3347 \r
3348    The rules in the following sections shall be applied in order to\r
3349    identify and correctly handle these cases.\r
3350 \r
3351 5.2.1 INIT received in COOKIE-WAIT or COOKIE-ECHOED State (Item B)\r
3352 \r
3353    This usually indicates an initialization collision, i.e., each\r
3354    endpoint is attempting, at about the same time, to establish an\r
3355    association with the other endpoint.\r
3356 \r
3357    Upon receipt of an INIT in the COOKIE-WAIT or COOKIE-ECHOED state, an\r
3358    endpoint MUST respond with an INIT ACK using the same parameters it\r
3359 \r
3360 \r
3361 \r
3362 Stewart, et al.             Standards Track                    [Page 60]\r
3363 \f\r
3364 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3365 \r
3366 \r
3367    sent in its original INIT chunk (including its Initiation Tag,\r
3368    unchanged).  These original parameters are combined with those from\r
3369    the newly received INIT chunk.  The endpoint shall also generate a\r
3370    State Cookie with the INIT ACK.  The endpoint uses the parameters\r
3371    sent in its INIT to calculate the State Cookie.\r
3372 \r
3373    After that, the endpoint MUST NOT change its state, the T1-init timer\r
3374    shall be left running and the corresponding TCB MUST NOT be\r
3375    destroyed.  The normal procedures for handling State Cookies when a\r
3376    TCB exists will resolve the duplicate INITs to a single association.\r
3377 \r
3378    For an endpoint that is in the COOKIE-ECHOED state it MUST populate\r
3379    its Tie-Tags with the Tag information of itself and its peer (see\r
3380    section 5.2.2 for a description of the Tie-Tags).\r
3381 \r
3382 5.2.2 Unexpected INIT in States Other than CLOSED, COOKIE-ECHOED,\r
3383          COOKIE-WAIT and SHUTDOWN-ACK-SENT\r
3384 \r
3385    Unless otherwise stated, upon reception of an unexpected INIT for\r
3386    this association, the endpoint shall generate an INIT ACK with a\r
3387    State Cookie.  In the outbound INIT ACK the endpoint MUST copy its\r
3388    current Verification Tag and peer's Verification Tag into a reserved\r
3389    place within the state cookie.  We shall refer to these locations as\r
3390    the Peer's-Tie-Tag and the Local-Tie-Tag.  The outbound SCTP packet\r
3391    containing this INIT ACK MUST carry a Verification Tag value equal to\r
3392    the Initiation Tag found in the unexpected INIT.  And the INIT ACK\r
3393    MUST contain a new Initiation Tag (randomly generated see Section\r
3394    5.3.1).  Other parameters for the endpoint SHOULD be copied from the\r
3395    existing parameters of the association (e.g. number of outbound\r
3396    streams) into the INIT ACK and cookie.\r
3397 \r
3398    After sending out the INIT ACK, the endpoint shall take no further\r
3399    actions, i.e., the existing association, including its current state,\r
3400    and the corresponding TCB MUST NOT be changed.\r
3401 \r
3402    Note: Only when a TCB exists and the association is not in a COOKIE-\r
3403    WAIT state are the Tie-Tags populated.  For a normal association INIT\r
3404    (i.e. the endpoint is in a COOKIE-WAIT state), the Tie-Tags MUST be\r
3405    set to 0 (indicating that no previous TCB existed).  The INIT ACK and\r
3406    State Cookie are populated as specified in section 5.2.1.\r
3407 \r
3408 5.2.3 Unexpected INIT ACK\r
3409 \r
3410    If an INIT ACK is received by an endpoint in any state other than the\r
3411    COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk.\r
3412    An unexpected INIT ACK usually indicates the processing of an old or\r
3413    duplicated INIT chunk.\r
3414 \r
3415 \r
3416 \r
3417 \r
3418 Stewart, et al.             Standards Track                    [Page 61]\r
3419 \f\r
3420 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3421 \r
3422 \r
3423 5.2.4 Handle a COOKIE ECHO when a TCB exists\r
3424 \r
3425    When a COOKIE ECHO chunk is received by an endpoint in any state for\r
3426    an existing association (i.e., not in the CLOSED state) the following\r
3427    rules shall be applied:\r
3428 \r
3429    1) Compute a MAC as described in Step 1 of Section 5.1.5,\r
3430 \r
3431    2) Authenticate the State Cookie as described in Step 2 of Section\r
3432       5.1.5 (this is case C or D above).\r
3433 \r
3434    3) Compare the timestamp in the State Cookie to the current time.  If\r
3435       the State Cookie is older than the lifespan carried in the State\r
3436       Cookie and the Verification Tags contained in the State Cookie do\r
3437       not match the current association's Verification Tags, the packet,\r
3438       including the COOKIE ECHO and any DATA chunks, should be\r
3439       discarded.  The endpoint also MUST transmit an ERROR chunk with a\r
3440       "Stale Cookie" error cause to the peer endpoint (this is case C or\r
3441       D in section 5.2).\r
3442 \r
3443       If both Verification Tags in the State Cookie match the\r
3444       Verification Tags of the current association, consider the State\r
3445       Cookie valid (this is case E of section 5.2) even if the lifespan\r
3446       is exceeded.\r
3447 \r
3448    4) If the State Cookie proves to be valid, unpack the TCB into a\r
3449       temporary TCB.\r
3450 \r
3451    5) Refer to Table 2 to determine the correct action to be taken.\r
3452 \r
3453 \r
3454 \r
3455 \r
3456 \r
3457 \r
3458 \r
3459 \r
3460 \r
3461 \r
3462 \r
3463 \r
3464 \r
3465 \r
3466 \r
3467 \r
3468 \r
3469 \r
3470 \r
3471 \r
3472 \r
3473 \r
3474 Stewart, et al.             Standards Track                    [Page 62]\r
3475 \f\r
3476 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3477 \r
3478 \r
3479 +------------+------------+---------------+--------------+-------------+\r
3480 |  Local Tag | Peer's Tag | Local-Tie-Tag |Peer's-Tie-Tag|   Action/   |\r
3481 |            |            |               |              | Description |\r
3482 +------------+------------+---------------+--------------+-------------+\r
3483 |    X       |     X      |      M        |      M       |     (A)     |\r
3484 +------------+------------+---------------+--------------+-------------+\r
3485 |    M       |     X      |      A        |      A       |     (B)     |\r
3486 +------------+------------+---------------+--------------+-------------+\r
3487 |    M       |     0      |      A        |      A       |     (B)     |\r
3488 +------------+------------+---------------+--------------+-------------+\r
3489 |    X       |     M      |      0        |      0       |     (C)     |\r
3490 +------------+------------+---------------+--------------+-------------+\r
3491 |    M       |     M      |      A        |      A       |     (D)     |\r
3492 +======================================================================+\r
3493 |       Table 2: Handling of a COOKIE ECHO when a TCB exists           |\r
3494 +======================================================================+\r
3495 \r
3496    Legend:\r
3497 \r
3498       X - Tag does not match the existing TCB\r
3499       M - Tag matches the existing TCB.\r
3500       0 - No Tie-Tag in Cookie (unknown).\r
3501       A - All cases, i.e. M, X or 0.\r
3502 \r
3503    Note: For any case not shown in Table 2, the cookie should be\r
3504    silently discarded.\r
3505 \r
3506    Action\r
3507 \r
3508    A) In this case, the peer may have restarted.  When the endpoint\r
3509       recognizes this potential 'restart', the existing session is\r
3510       treated the same as if it received an ABORT followed by a new\r
3511       COOKIE ECHO with the following exceptions:\r
3512 \r
3513       -  Any SCTP DATA Chunks MAY be retained (this is an implementation\r
3514          specific option).\r
3515 \r
3516       -  A notification of RESTART SHOULD be sent to the ULP instead of\r
3517          a "COMMUNICATION LOST" notification.\r
3518 \r
3519       All the congestion control parameters (e.g., cwnd, ssthresh)\r
3520       related to this peer MUST be reset to their initial values (see\r
3521       Section 6.2.1).\r
3522 \r
3523       After this the endpoint shall enter the ESTABLISHED state.\r
3524 \r
3525 \r
3526 \r
3527 \r
3528 \r
3529 \r
3530 Stewart, et al.             Standards Track                    [Page 63]\r
3531 \f\r
3532 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3533 \r
3534 \r
3535       If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes\r
3536       the peer has restarted (Action A), it MUST NOT setup a new\r
3537       association but instead resend the SHUTDOWN ACK and send an ERROR\r
3538       chunk with a "Cookie Received while Shutting Down" error cause to\r
3539       its peer.\r
3540 \r
3541    B) In this case, both sides may be attempting to start an association\r
3542       at about the same time but the peer endpoint started its INIT\r
3543       after responding to the local endpoint's INIT.  Thus it may have\r
3544       picked a new Verification Tag not being aware of the previous Tag\r
3545       it had sent this endpoint.  The endpoint should stay in or enter\r
3546       the ESTABLISHED state but it MUST update its peer's Verification\r
3547       Tag from the State Cookie, stop any init or cookie timers that may\r
3548       running and send a COOKIE ACK.\r
3549 \r
3550    C) In this case, the local endpoint's cookie has arrived late.\r
3551       Before it arrived, the local endpoint sent an INIT and received an\r
3552       INIT-ACK and finally sent a COOKIE ECHO with the peer's same tag\r
3553       but a new tag of its own.  The cookie should be silently\r
3554       discarded.  The endpoint SHOULD NOT change states and should leave\r
3555       any timers running.\r
3556 \r
3557    D) When both local and remote tags match the endpoint should always\r
3558       enter the ESTABLISHED state, if it has not already done so. It\r
3559       should stop any init or cookie timers that may be running and send\r
3560       a COOKIE ACK.\r
3561 \r
3562    Note: The "peer's Verification Tag" is the tag received in the\r
3563    Initiate Tag field of the INIT or INIT ACK chunk.\r
3564 \r
3565 5.2.4.1 An Example of a Association Restart\r
3566 \r
3567    In the following example, "A" initiates the association after a\r
3568    restart has occurred.  Endpoint "Z" had no knowledge of the restart\r
3569    until the exchange (i.e. Heartbeats had not yet detected the failure\r
3570    of "A").  (assuming no bundling or fragmentation occurs):\r
3571 \r
3572 \r
3573 \r
3574 \r
3575 \r
3576 \r
3577 \r
3578 \r
3579 \r
3580 \r
3581 \r
3582 \r
3583 \r
3584 \r
3585 \r
3586 Stewart, et al.             Standards Track                    [Page 64]\r
3587 \f\r
3588 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3589 \r
3590 \r
3591 Endpoint A                                          Endpoint Z\r
3592 <-------------- Association is established---------------------->\r
3593 Tag=Tag_A                                             Tag=Tag_Z\r
3594 <--------------------------------------------------------------->\r
3595 {A crashes and restarts}\r
3596 {app sets up a association with Z}\r
3597 (build TCB)\r
3598 INIT [I-Tag=Tag_A'\r
3599       & other info]  --------\\r
3600 (Start T1-init timer)         \\r
3601 (Enter COOKIE-WAIT state)      \---> (find a existing TCB\r
3602                                       compose temp TCB and Cookie_Z\r
3603                                       with Tie-Tags to previous\r
3604                                       association)\r
3605                                 /--- INIT ACK [Veri Tag=Tag_A',\r
3606                                /               I-Tag=Tag_Z',\r
3607 (Cancel T1-init timer) <------/                Cookie_Z[TieTags=\r
3608                                                Tag_A,Tag_Z\r
3609                                                 & other info]\r
3610                                      (destroy temp TCB,leave original\r
3611                                       in place)\r
3612 COOKIE ECHO [Veri=Tag_Z',\r
3613              Cookie_Z\r
3614              Tie=Tag_A,\r
3615              Tag_Z]----------\\r
3616 (Start T1-init timer)         \\r
3617 (Enter COOKIE-ECHOED state)    \---> (Find existing association,\r
3618                                       Tie-Tags match old tags,\r
3619                                       Tags do not match i.e.\r
3620                                       case X X M M above,\r
3621                                       Announce Restart to ULP\r
3622                                       and reset association).\r
3623                                /---- COOKIE-ACK\r
3624                               /\r
3625 (Cancel T1-init timer, <-----/\r
3626  Enter ESTABLISHED state)\r
3627 {app sends 1st user data; strm 0}\r
3628 DATA [TSN=initial TSN_A\r
3629      Strm=0,Seq=1 & user data]--\\r
3630 (Start T3-rtx timer)            \\r
3631                                  \->\r
3632                               /----- SACK [TSN Ack=init TSN_A,Block=0]\r
3633 (Cancel T3-rtx timer) <------/\r
3634 \r
3635                   Figure 5: A Restart Example\r
3636 \r
3637 \r
3638 \r
3639 \r
3640 \r
3641 \r
3642 Stewart, et al.             Standards Track                    [Page 65]\r
3643 \f\r
3644 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3645 \r
3646 \r
3647 5.2.5 Handle Duplicate COOKIE-ACK.\r
3648 \r
3649    At any state other than COOKIE-ECHOED, an endpoint should silently\r
3650    discard a received COOKIE ACK chunk.\r
3651 \r
3652 5.2.6 Handle Stale COOKIE Error\r
3653 \r
3654    Receipt of an ERROR chunk with a "Stale Cookie" error cause indicates\r
3655    one of a number of possible events:\r
3656 \r
3657    A) That the association failed to completely setup before the State\r
3658       Cookie issued by the sender was processed.\r
3659 \r
3660    B) An old State Cookie was processed after setup completed.\r
3661 \r
3662    C) An old State Cookie is received from someone that the receiver is\r
3663       not interested in having an association with and the ABORT chunk\r
3664       was lost.\r
3665 \r
3666    When processing an ERROR chunk with a "Stale Cookie" error cause an\r
3667    endpoint should first examine if an association is in the process of\r
3668    being setup, i.e. the association is in the COOKIE-ECHOED state.  In\r
3669    all cases if the association is not in the COOKIE-ECHOED state, the\r
3670    ERROR chunk should be silently discarded.\r
3671 \r
3672    If the association is in the COOKIE-ECHOED state, the endpoint may\r
3673    elect one of the following three alternatives.\r
3674 \r
3675    1) Send a new INIT chunk to the endpoint to generate a new State\r
3676       Cookie and re-attempt the setup procedure.\r
3677 \r
3678    2) Discard the TCB and report to the upper layer the inability to\r
3679       setup the association.\r
3680 \r
3681    3) Send a new INIT chunk to the endpoint, adding a Cookie\r
3682       Preservative parameter requesting an extension to the lifetime of\r
3683       the State Cookie.  When calculating the time extension, an\r
3684       implementation SHOULD use the RTT information measured based on\r
3685       the previous COOKIE ECHO / ERROR exchange, and should add no more\r
3686       than 1 second beyond the measured RTT, due to long State Cookie\r
3687       lifetimes making the endpoint more subject to a replay attack.\r
3688 \r
3689 \r
3690 \r
3691 \r
3692 \r
3693 \r
3694 \r
3695 \r
3696 \r
3697 \r
3698 Stewart, et al.             Standards Track                    [Page 66]\r
3699 \f\r
3700 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3701 \r
3702 \r
3703 5.3 Other Initialization Issues\r
3704 \r
3705 5.3.1 Selection of Tag Value\r
3706 \r
3707    Initiate Tag values should be selected from the range of 1 to 2**32 -\r
3708    1.  It is very important that the Initiate Tag value be randomized to\r
3709    help protect against "man in the middle" and "sequence number"\r
3710    attacks.  The methods described in [RFC1750] can be used for the\r
3711    Initiate Tag randomization.  Careful selection of Initiate Tags is\r
3712    also necessary to prevent old duplicate packets from previous\r
3713    associations being mistakenly processed as belonging to the current\r
3714    association.\r
3715 \r
3716    Moreover, the Verification Tag value used by either endpoint in a\r
3717    given association MUST NOT change during the lifetime of an\r
3718    association.  A new Verification Tag value MUST be used each time the\r
3719    endpoint tears-down and then re-establishes an association to the\r
3720    same peer.\r
3721 \r
3722 6. User Data Transfer\r
3723 \r
3724    Data transmission MUST only happen in the ESTABLISHED, SHUTDOWN-\r
3725    PENDING, and SHUTDOWN-RECEIVED states.  The only exception to this is\r
3726    that DATA chunks are allowed to be bundled with an outbound COOKIE\r
3727    ECHO chunk when in COOKIE-WAIT state.\r
3728 \r
3729    DATA chunks MUST only be received according to the rules below in\r
3730    ESTABLISHED, SHUTDOWN-PENDING, SHUTDOWN-SENT.  A DATA chunk received\r
3731    in CLOSED is out of the blue and SHOULD be handled per 8.4.  A DATA\r
3732    chunk received in any other state SHOULD be discarded.\r
3733 \r
3734    A SACK MUST be processed in ESTABLISHED, SHUTDOWN-PENDING, and\r
3735    SHUTDOWN-RECEIVED.  An incoming SACK MAY be processed in COOKIE-\r
3736    ECHOED.  A SACK in the CLOSED state is out of the blue and SHOULD be\r
3737    processed according to the rules in 8.4.  A SACK chunk received in\r
3738    any other state SHOULD be discarded.\r
3739 \r
3740 \r
3741    A SCTP receiver MUST be able to receive a minimum of 1500 bytes in\r
3742    one SCTP packet.  This means that a SCTP endpoint MUST NOT indicate\r
3743    less than 1500 bytes in its Initial a_rwnd sent in the INIT or INIT\r
3744    ACK.\r
3745 \r
3746    For transmission efficiency, SCTP defines mechanisms for bundling of\r
3747    small user messages and fragmentation of large user messages.  The\r
3748    following diagram depicts the flow of user messages through SCTP.\r
3749 \r
3750 \r
3751 \r
3752 \r
3753 \r
3754 Stewart, et al.             Standards Track                    [Page 67]\r
3755 \f\r
3756 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3757 \r
3758 \r
3759    In this section the term "data sender" refers to the endpoint that\r
3760    transmits a DATA chunk and the term "data receiver" refers to the\r
3761    endpoint that receives a DATA chunk.  A data receiver will transmit\r
3762    SACK chunks.\r
3763 \r
3764                  +--------------------------+\r
3765                  |      User Messages       |\r
3766                  +--------------------------+\r
3767        SCTP user        ^  |\r
3768       ==================|==|=======================================\r
3769                         |  v (1)\r
3770              +------------------+    +--------------------+\r
3771              | SCTP DATA Chunks |    |SCTP Control Chunks |\r
3772              +------------------+    +--------------------+\r
3773                         ^  |             ^  |\r
3774                         |  v (2)         |  v (2)\r
3775                      +--------------------------+\r
3776                      |      SCTP packets        |\r
3777                      +--------------------------+\r
3778        SCTP                      ^  |\r
3779       ===========================|==|===========================\r
3780                                  |  v\r
3781              Connectionless Packet Transfer Service (e.g., IP)\r
3782 \r
3783    Notes:\r
3784 \r
3785       1) When converting user messages into DATA chunks, an endpoint\r
3786          will fragment user messages larger than the current association\r
3787          path MTU into multiple DATA chunks.  The data receiver will\r
3788          normally reassemble the fragmented message from DATA chunks\r
3789          before delivery to the user (see Section 6.9 for details).\r
3790 \r
3791       2) Multiple DATA and control chunks may be bundled by the sender\r
3792          into a single SCTP packet for transmission, as long as the\r
3793          final size of the packet does not exceed the current path MTU.\r
3794          The receiver will unbundle the packet back into the original\r
3795          chunks.  Control chunks MUST come before DATA chunks in the\r
3796          packet.\r
3797 \r
3798                 Figure 6: Illustration of User Data Transfer\r
3799 \r
3800    The fragmentation and bundling mechanisms, as detailed in Sections\r
3801    6.9 and 6.10, are OPTIONAL to implement by the data sender, but they\r
3802    MUST be implemented by the data receiver, i.e., an endpoint MUST\r
3803    properly receive and process bundled or fragmented data.\r
3804 \r
3805 \r
3806 \r
3807 \r
3808 \r
3809 \r
3810 Stewart, et al.             Standards Track                    [Page 68]\r
3811 \f\r
3812 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3813 \r
3814 \r
3815 6.1  Transmission of DATA Chunks\r
3816 \r
3817    This document is specified as if there is a single retransmission\r
3818    timer per destination transport address, but implementations MAY have\r
3819    a retransmission timer for each DATA chunk.\r
3820 \r
3821    The following general rules MUST be applied by the data sender for\r
3822    transmission and/or retransmission of outbound DATA chunks:\r
3823 \r
3824    A) At any given time, the data sender MUST NOT transmit new data to\r
3825       any destination transport address if its peer's rwnd indicates\r
3826       that the peer has no buffer space (i.e. rwnd is 0, see Section\r
3827       6.2.1).  However, regardless of the value of rwnd (including if it\r
3828       is 0), the data sender can always have one DATA chunk in flight to\r
3829       the receiver if allowed by cwnd (see rule B below).  This rule\r
3830       allows the sender to probe for a change in rwnd that the sender\r
3831       missed due to the SACK having been lost in transit from the data\r
3832       receiver to the data sender.\r
3833 \r
3834    B) At any given time, the sender MUST NOT transmit new data to a\r
3835       given transport address if it has cwnd or more bytes of data\r
3836       outstanding to that transport address.\r
3837 \r
3838    C) When the time comes for the sender to transmit, before sending new\r
3839       DATA chunks, the sender MUST first transmit any outstanding DATA\r
3840       chunks which are marked for retransmission (limited by the current\r
3841       cwnd).\r
3842 \r
3843    D) Then, the sender can send out as many new DATA chunks as Rule A\r
3844       and Rule B above allow.\r
3845 \r
3846    Multiple DATA chunks committed for transmission MAY be bundled in a\r
3847    single packet.  Furthermore, DATA chunks being retransmitted MAY be\r
3848    bundled with new DATA chunks, as long as the resulting packet size\r
3849    does not exceed the path MTU.  A ULP may request that no bundling is\r
3850    performed but this should only turn off any delays that a SCTP\r
3851    implementation may be using to increase bundling efficiency.  It does\r
3852    not in itself stop all bundling from occurring (i.e. in case of\r
3853    congestion or retransmission).\r
3854 \r
3855    Before an endpoint transmits a DATA chunk, if any received DATA\r
3856    chunks have not been acknowledged (e.g., due to delayed ack), the\r
3857    sender should create a SACK and bundle it with the outbound DATA\r
3858    chunk, as long as the size of the final SCTP packet does not exceed\r
3859    the current MTU.  See Section 6.2.\r
3860 \r
3861 \r
3862 \r
3863 \r
3864 \r
3865 \r
3866 Stewart, et al.             Standards Track                    [Page 69]\r
3867 \f\r
3868 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3869 \r
3870 \r
3871    IMPLEMENTATION NOTE: When the window is full (i.e., transmission is\r
3872    disallowed by Rule A and/or Rule B), the sender MAY still accept send\r
3873    requests from its upper layer, but MUST transmit no more DATA chunks\r
3874    until some or all of the outstanding DATA chunks are acknowledged and\r
3875    transmission is allowed by Rule A and Rule B again.\r
3876 \r
3877    Whenever a transmission or retransmission is made to any address, if\r
3878    the T3-rtx timer of that address is not currently running, the sender\r
3879    MUST start that timer.  If the timer for that address is already\r
3880    running, the sender MUST restart the timer if the earliest (i.e.,\r
3881    lowest TSN) outstanding DATA chunk sent to that address is being\r
3882    retransmitted.  Otherwise, the data sender MUST NOT restart the\r
3883    timer.\r
3884 \r
3885    When starting or restarting the T3-rtx timer, the timer value must be\r
3886    adjusted according to the timer rules defined in Sections 6.3.2, and\r
3887    6.3.3.\r
3888 \r
3889    Note: The data sender SHOULD NOT use a TSN that is more than 2**31 -\r
3890    1 above the beginning TSN of the current send window.\r
3891 \r
3892 6.2  Acknowledgement on Reception of DATA Chunks\r
3893 \r
3894    The SCTP endpoint MUST always acknowledge the reception of each valid\r
3895    DATA chunk.\r
3896 \r
3897    The guidelines on delayed acknowledgement algorithm specified in\r
3898    Section 4.2 of [RFC2581] SHOULD be followed.  Specifically, an\r
3899    acknowledgement SHOULD be generated for at least every second packet\r
3900    (not every second DATA chunk) received, and SHOULD be generated\r
3901    within 200 ms of the arrival of any unacknowledged DATA chunk.  In\r
3902    some situations it may be beneficial for an SCTP transmitter to be\r
3903    more conservative than the algorithms detailed in this document\r
3904    allow. However, an SCTP transmitter MUST NOT be more aggressive than\r
3905    the following algorithms allow.\r
3906 \r
3907    A SCTP receiver MUST NOT generate more than one SACK for every\r
3908    incoming packet, other than to update the offered window as the\r
3909    receiving application consumes new data.\r
3910 \r
3911    IMPLEMENTATION NOTE: The maximum delay for generating an\r
3912    acknowledgement may be configured by the SCTP administrator, either\r
3913    statically or dynamically, in order to meet the specific timing\r
3914    requirement of the protocol being carried.\r
3915 \r
3916    An implementation MUST NOT allow the maximum delay to be configured\r
3917    to be more than 500 ms.  In other words an implementation MAY lower\r
3918    this value below 500ms but MUST NOT raise it above 500ms.\r
3919 \r
3920 \r
3921 \r
3922 Stewart, et al.             Standards Track                    [Page 70]\r
3923 \f\r
3924 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3925 \r
3926 \r
3927    Acknowledgements MUST be sent in SACK chunks unless shutdown was\r
3928    requested by the ULP in which case an endpoint MAY send an\r
3929    acknowledgement in the SHUTDOWN chunk.  A SACK chunk can acknowledge\r
3930    the reception of multiple DATA chunks.  See Section 3.3.4 for SACK\r
3931    chunk format.  In particular, the SCTP endpoint MUST fill in the\r
3932    Cumulative TSN Ack field to indicate the latest sequential TSN (of a\r
3933    valid DATA chunk) it has received.  Any received DATA chunks with TSN\r
3934    greater than the value in the Cumulative TSN Ack field SHOULD also be\r
3935    reported in the Gap Ack Block fields.\r
3936 \r
3937    Note:  The SHUTDOWN chunk does not contain Gap Ack Block fields.\r
3938    Therefore, the endpoint should use a SACK instead of the SHUTDOWN\r
3939    chunk to acknowledge DATA chunks received out of order .\r
3940 \r
3941    When a packet arrives with duplicate DATA chunk(s) and with no new\r
3942    DATA chunk(s), the endpoint MUST immediately send a SACK with no\r
3943    delay.  If a packet arrives with duplicate DATA chunk(s) bundled with\r
3944    new DATA chunks, the endpoint MAY immediately send a SACK.  Normally\r
3945    receipt of duplicate DATA chunks will occur when the original SACK\r
3946    chunk was lost and the peer's RTO has expired.  The duplicate TSN\r
3947    number(s) SHOULD be reported in the SACK as duplicate.\r
3948 \r
3949    When an endpoint receives a SACK, it MAY use the Duplicate TSN\r
3950    information to determine if SACK loss is occurring.  Further use of\r
3951    this data is for future study.\r
3952 \r
3953    The data receiver is responsible for maintaining its receive buffers.\r
3954    The data receiver SHOULD notify the data sender in a timely manner of\r
3955    changes in its ability to receive data.  How an implementation\r
3956    manages its receive buffers is dependent on many factors (e.g.,\r
3957    Operating System, memory management system, amount of memory, etc.).\r
3958    However, the data sender strategy defined in Section 6.2.1 is based\r
3959    on the assumption of receiver operation similar to the following:\r
3960 \r
3961       A) At initialization of the association, the endpoint tells the\r
3962          peer how much receive buffer space it has allocated to the\r
3963          association in the INIT or INIT ACK.  The endpoint sets a_rwnd\r
3964          to this value.\r
3965 \r
3966       B) As DATA chunks are received and buffered, decrement a_rwnd by\r
3967          the number of bytes received and buffered.  This is, in effect,\r
3968          closing rwnd at the data sender and restricting the amount of\r
3969          data it can transmit.\r
3970 \r
3971       C) As DATA chunks are delivered to the ULP and released from the\r
3972          receive buffers, increment a_rwnd by the number of bytes\r
3973          delivered to the upper layer.  This is, in effect, opening up\r
3974          rwnd on the data sender and allowing it to send more data.  The\r
3975 \r
3976 \r
3977 \r
3978 Stewart, et al.             Standards Track                    [Page 71]\r
3979 \f\r
3980 RFC 2960          Stream Control Transmission Protocol      October 2000\r
3981 \r
3982 \r
3983          data receiver SHOULD NOT increment a_rwnd unless it has\r
3984          released bytes from its receive buffer.  For example, if the\r
3985          receiver is holding fragmented DATA chunks in a reassembly\r
3986          queue, it should not increment a_rwnd.\r
3987 \r
3988       D) When sending a SACK, the data receiver SHOULD place the current\r
3989          value of a_rwnd into the a_rwnd field.  The data receiver\r
3990          SHOULD take into account that the data sender will not\r
3991          retransmit DATA chunks that are acked via the Cumulative TSN\r
3992          Ack (i.e., will drop from its retransmit queue).\r
3993 \r
3994    Under certain circumstances, the data receiver may need to drop DATA\r
3995    chunks that it has received but hasn't released from its receive\r
3996    buffers (i.e., delivered to the ULP).  These DATA chunks may have\r
3997    been acked in Gap Ack Blocks.  For example, the data receiver may be\r
3998    holding data in its receive buffers while reassembling a fragmented\r
3999    user message from its peer when it runs out of receive buffer space.\r
4000    It may drop these DATA chunks even though it has acknowledged them in\r
4001    Gap Ack Blocks.  If a data receiver drops DATA chunks, it MUST NOT\r
4002    include them in Gap Ack Blocks in subsequent SACKs until they are\r
4003    received again via retransmission.  In addition, the endpoint should\r
4004    take into account the dropped data when calculating its a_rwnd.\r
4005 \r
4006    An endpoint SHOULD NOT revoke a SACK and discard data. Only in\r
4007    extreme circumstance should an endpoint use this procedure (such as\r
4008    out of buffer space).  The data receiver should take into account\r
4009    that dropping data that has been acked in Gap Ack Blocks can result\r
4010    in suboptimal retransmission strategies in the data sender and thus\r
4011    in suboptimal performance.\r
4012 \r
4013    The following example illustrates the use of delayed\r
4014    acknowledgements:\r
4015 \r
4016 \r
4017 \r
4018 \r
4019 \r
4020 \r
4021 \r
4022 \r
4023 \r
4024 \r
4025 \r
4026 \r
4027 \r
4028 \r
4029 \r
4030 \r
4031 \r
4032 \r
4033 \r
4034 Stewart, et al.             Standards Track                    [Page 72]\r
4035 \f\r
4036 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4037 \r
4038 \r
4039    Endpoint A                                      Endpoint Z\r
4040 \r
4041    {App sends 3 messages; strm 0}\r
4042    DATA [TSN=7,Strm=0,Seq=3] ------------> (ack delayed)\r
4043    (Start T3-rtx timer)\r
4044 \r
4045    DATA [TSN=8,Strm=0,Seq=4] ------------> (send ack)\r
4046                                  /------- SACK [TSN Ack=8,block=0]\r
4047    (cancel T3-rtx timer)  <-----/\r
4048 \r
4049    DATA [TSN=9,Strm=0,Seq=5] ------------> (ack delayed)\r
4050    (Start T3-rtx timer)\r
4051                                           ...\r
4052                                           {App sends 1 message; strm 1}\r
4053                                           (bundle SACK with DATA)\r
4054                                    /----- SACK [TSN Ack=9,block=0] \\r
4055                                   /         DATA [TSN=6,Strm=1,Seq=2]\r
4056    (cancel T3-rtx timer)  <------/        (Start T3-rtx timer)\r
4057 \r
4058    (ack delayed)\r
4059    (send ack)\r
4060    SACK [TSN Ack=6,block=0] -------------> (cancel T3-rtx timer)\r
4061 \r
4062           Figure 7:  Delayed Acknowledgment Example\r
4063 \r
4064    If an endpoint receives a DATA chunk with no user data (i.e., the\r
4065    Length field is set to 16) it MUST send an ABORT with error cause set\r
4066    to "No User Data".\r
4067 \r
4068    An endpoint SHOULD NOT send a DATA chunk with no user data part.\r
4069 \r
4070 6.2.1  Processing a Received SACK\r
4071 \r
4072    Each SACK an endpoint receives contains an a_rwnd value.  This value\r
4073    represents the amount of buffer space the data receiver, at the time\r
4074    of transmitting the SACK, has left of its total receive buffer space\r
4075    (as specified in the INIT/INIT ACK).  Using a_rwnd, Cumulative TSN\r
4076    Ack and Gap Ack Blocks, the data sender can develop a representation\r
4077    of the peer's receive buffer space.\r
4078 \r
4079    One of the problems the data sender must take into account when\r
4080    processing a SACK is that a SACK can be received out of order.  That\r
4081    is, a SACK sent by the data receiver can pass an earlier SACK and be\r
4082    received first by the data sender.  If a SACK is received out of\r
4083    order, the data sender can develop an incorrect view of the peer's\r
4084    receive buffer space.\r
4085 \r
4086 \r
4087 \r
4088 \r
4089 \r
4090 Stewart, et al.             Standards Track                    [Page 73]\r
4091 \f\r
4092 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4093 \r
4094 \r
4095    Since there is no explicit identifier that can be used to detect\r
4096    out-of-order SACKs, the data sender must use heuristics to determine\r
4097    if a SACK is new.\r
4098 \r
4099    An endpoint SHOULD use the following rules to calculate the rwnd,\r
4100    using the a_rwnd value, the Cumulative TSN Ack and Gap Ack Blocks in\r
4101    a received SACK.\r
4102 \r
4103    A) At the establishment of the association, the endpoint initializes\r
4104       the rwnd to the Advertised Receiver Window Credit (a_rwnd) the\r
4105       peer specified in the INIT or INIT ACK.\r
4106 \r
4107    B) Any time a DATA chunk is transmitted (or retransmitted) to a peer,\r
4108       the endpoint subtracts the data size of the chunk from the rwnd of\r
4109       that peer.\r
4110 \r
4111    C) Any time a DATA chunk is marked for retransmission (via either\r
4112       T3-rtx timer expiration (Section 6.3.3)or via fast retransmit\r
4113       (Section 7.2.4)), add the data size of those chunks to the rwnd.\r
4114 \r
4115       Note: If the implementation is maintaining a timer on each DATA\r
4116       chunk then only DATA chunks whose timer expired would be marked\r
4117       for retransmission.\r
4118 \r
4119    D) Any time a SACK arrives, the endpoint performs the following:\r
4120 \r
4121          i) If Cumulative TSN Ack is less than the Cumulative TSN Ack\r
4122          Point, then drop the SACK.   Since Cumulative TSN Ack is\r
4123          monotonically increasing, a SACK whose Cumulative TSN Ack is\r
4124          less than the Cumulative TSN Ack Point indicates an out-of-\r
4125          order SACK.\r
4126 \r
4127          ii) Set rwnd equal to the newly received a_rwnd minus the\r
4128          number of bytes still outstanding after processing the\r
4129          Cumulative TSN Ack and the Gap Ack Blocks.\r
4130 \r
4131          iii) If the SACK is missing a TSN that was previously\r
4132          acknowledged via a Gap Ack Block (e.g., the data receiver\r
4133          reneged on the data), then mark the corresponding DATA chunk as\r
4134          available for retransmit:  Mark it as missing for fast\r
4135          retransmit as described in Section 7.2.4 and if no retransmit\r
4136          timer is running for the destination address to which the DATA\r
4137          chunk was originally transmitted, then T3-rtx is started for\r
4138          that destination address.\r
4139 \r
4140 \r
4141 \r
4142 \r
4143 \r
4144 \r
4145 \r
4146 Stewart, et al.             Standards Track                    [Page 74]\r
4147 \f\r
4148 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4149 \r
4150 \r
4151 6.3 Management of Retransmission Timer\r
4152 \r
4153    An SCTP endpoint uses a retransmission timer T3-rtx to ensure data\r
4154    delivery in the absence of any feedback from its peer.  The duration\r
4155    of this timer is referred to as RTO (retransmission timeout).\r
4156 \r
4157    When an endpoint's peer is multi-homed, the endpoint will calculate a\r
4158    separate RTO for each different destination transport address of its\r
4159    peer endpoint.\r
4160 \r
4161    The computation and management of RTO in SCTP follows closely how TCP\r
4162    manages its retransmission timer.  To compute the current RTO, an\r
4163    endpoint maintains two state variables per destination transport\r
4164    address: SRTT (smoothed round-trip time) and RTTVAR (round-trip time\r
4165    variation).\r
4166 \r
4167 6.3.1 RTO Calculation\r
4168 \r
4169    The rules governing the computation of SRTT, RTTVAR, and RTO are as\r
4170    follows:\r
4171 \r
4172    C1) Until an RTT measurement has been made for a packet sent to the\r
4173        given destination transport address, set RTO to the protocol\r
4174        parameter 'RTO.Initial'.\r
4175 \r
4176    C2) When the first RTT measurement R is made, set SRTT <- R, RTTVAR\r
4177        <- R/2, and RTO <- SRTT + 4 * RTTVAR.\r
4178 \r
4179    C3) When a new RTT measurement R' is made, set\r
4180 \r
4181        RTTVAR <- (1 - RTO.Beta) * RTTVAR + RTO.Beta * |SRTT - R'| SRTT\r
4182        <- (1 - RTO.Alpha) * SRTT + RTO.Alpha * R'\r
4183 \r
4184        Note: The value of SRTT used in the update to RTTVAR is its value\r
4185        before updating SRTT itself using the second assignment.\r
4186 \r
4187        After the computation, update RTO <- SRTT + 4 * RTTVAR.\r
4188 \r
4189    C4) When data is in flight and when allowed by rule C5 below, a new\r
4190        RTT measurement MUST be made each round trip.  Furthermore, new\r
4191        RTT measurements SHOULD be made no more than once per round-trip\r
4192        for a given destination transport address.  There are two reasons\r
4193        for this recommendation:  First, it appears that measuring more\r
4194        frequently often does not in practice yield any significant\r
4195        benefit [ALLMAN99]; second, if measurements are made more often,\r
4196        then the values of RTO.Alpha and RTO.Beta in rule C3 above should\r
4197        be adjusted so that SRTT and RTTVAR still adjust to changes at\r
4198        roughly the same rate (in terms of how many round trips it takes\r
4199 \r
4200 \r
4201 \r
4202 Stewart, et al.             Standards Track                    [Page 75]\r
4203 \f\r
4204 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4205 \r
4206 \r
4207        them to reflect new values) as they would if making only one\r
4208        measurement per round-trip and using RTO.Alpha and RTO.Beta as\r
4209        given in rule C3.  However, the exact nature of these adjustments\r
4210        remains a research issue.\r
4211 \r
4212    C5) Karn's algorithm: RTT measurements MUST NOT be made using packets\r
4213        that were retransmitted (and thus for which it is ambiguous\r
4214        whether the reply was for the first instance of the packet or a\r
4215        later instance).\r
4216 \r
4217    C6) Whenever RTO is computed, if it is less than RTO.Min seconds then\r
4218        it is rounded up to RTO.Min seconds.  The reason for this rule is\r
4219        that RTOs that do not have a high minimum value are susceptible\r
4220        to unnecessary timeouts [ALLMAN99].\r
4221 \r
4222    C7) A maximum value may be placed on RTO provided it is at least\r
4223        RTO.max seconds.\r
4224 \r
4225    There is no requirement for the clock granularity G used for\r
4226    computing RTT measurements and the different state variables, other\r
4227    than:\r
4228 \r
4229    G1) Whenever RTTVAR is computed, if RTTVAR = 0, then adjust RTTVAR <-\r
4230        G.\r
4231 \r
4232    Experience [ALLMAN99] has shown that finer clock granularities (<=\r
4233    100 msec) perform somewhat better than more coarse granularities.\r
4234 \r
4235 6.3.2 Retransmission Timer Rules\r
4236 \r
4237    The rules for managing the retransmission timer are as follows:\r
4238 \r
4239    R1) Every time a DATA chunk is sent to any address (including a\r
4240        retransmission), if the T3-rtx timer of that address is not\r
4241        running, start it running so that it will expire after the RTO of\r
4242        that address.  The RTO used here is that obtained after any\r
4243        doubling due to previous T3-rtx timer expirations on the\r
4244        corresponding destination address as discussed in rule E2 below.\r
4245 \r
4246    R2) Whenever all outstanding data sent to an address have been\r
4247        acknowledged, turn off the T3-rtx timer of that address.\r
4248 \r
4249    R3) Whenever a SACK is received that acknowledges the DATA chunk with\r
4250        the earliest outstanding TSN for that address, restart T3-rtx\r
4251        timer for that address with its current RTO (if there is still\r
4252        outstanding data on that address).\r
4253 \r
4254 \r
4255 \r
4256 \r
4257 \r
4258 Stewart, et al.             Standards Track                    [Page 76]\r
4259 \f\r
4260 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4261 \r
4262 \r
4263    R4) Whenever a SACK is received missing a TSN that was previously\r
4264        acknowledged via a Gap Ack Block, start T3-rtx for the\r
4265        destination address to which the DATA chunk was originally\r
4266        transmitted if it is not already running.\r
4267 \r
4268    The following example shows the use of various timer rules (assuming\r
4269    the receiver uses delayed acks).\r
4270 \r
4271    Endpoint A                                         Endpoint Z\r
4272    {App begins to send}\r
4273    Data [TSN=7,Strm=0,Seq=3] ------------> (ack delayed)\r
4274    (Start T3-rtx timer)\r
4275                                            {App sends 1 message; strm 1}\r
4276                                            (bundle ack with data)\r
4277    DATA [TSN=8,Strm=0,Seq=4] ----\     /-- SACK [TSN Ack=7,Block=0]\r
4278                                   \   /      DATA [TSN=6,Strm=1,Seq=2]\r
4279                                    \ /     (Start T3-rtx timer)\r
4280                                     \\r
4281                                    / \\r
4282    (Re-start T3-rtx timer) <------/   \--> (ack delayed)\r
4283    (ack delayed)\r
4284    {send ack}\r
4285    SACK [TSN Ack=6,Block=0] --------------> (Cancel T3-rtx timer)\r
4286                                            ..\r
4287                                            (send ack)\r
4288    (Cancel T3-rtx timer)  <-------------- SACK [TSN Ack=8,Block=0]\r
4289 \r
4290                  Figure 8 - Timer Rule Examples\r
4291 \r
4292 6.3.3 Handle T3-rtx Expiration\r
4293 \r
4294    Whenever the retransmission timer T3-rtx expires for a destination\r
4295    address, do the following:\r
4296 \r
4297    E1) For the destination address for which the timer expires, adjust\r
4298        its ssthresh with rules defined in Section 7.2.3 and set the cwnd\r
4299        <- MTU.\r
4300 \r
4301    E2) For the destination address for which the timer expires, set RTO\r
4302        <- RTO * 2 ("back off the timer").  The maximum value discussed\r
4303        in rule C7 above (RTO.max) may be used to provide an upper bound\r
4304        to this doubling operation.\r
4305 \r
4306    E3) Determine how many of the earliest (i.e., lowest TSN) outstanding\r
4307        DATA chunks for the address for which the T3-rtx has expired will\r
4308        fit into a single packet, subject to the MTU constraint for the\r
4309        path corresponding to the destination transport address to which\r
4310        the retransmission is being sent (this may be different from the\r
4311 \r
4312 \r
4313 \r
4314 Stewart, et al.             Standards Track                    [Page 77]\r
4315 \f\r
4316 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4317 \r
4318 \r
4319        address for which the timer expires [see Section 6.4]).  Call\r
4320        this value K.  Bundle and retransmit those K DATA chunks in a\r
4321        single packet to the destination endpoint.\r
4322 \r
4323    E4) Start the retransmission timer T3-rtx on the destination address\r
4324        to which the retransmission is sent, if rule R1 above indicates\r
4325        to do so.  The RTO to be used for starting T3-rtx should be the\r
4326        one for the destination address to which the retransmission is\r
4327        sent, which, when the receiver is multi-homed, may be different\r
4328        from the destination address for which the timer expired (see\r
4329        Section 6.4 below).\r
4330 \r
4331    After retransmitting, once a new RTT measurement is obtained (which\r
4332    can happen only when new data has been sent and acknowledged, per\r
4333    rule C5, or for a measurement made from a HEARTBEAT [see Section\r
4334    8.3]), the computation in rule C3 is performed, including the\r
4335    computation of RTO, which may result in "collapsing" RTO back down\r
4336    after it has been subject to doubling (rule E2).\r
4337 \r
4338    Note: Any DATA chunks that were sent to the address for which the\r
4339    T3-rtx timer expired but did not fit in one MTU (rule E3 above),\r
4340    should be marked for retransmission and sent as soon as cwnd allows\r
4341    (normally when a SACK arrives).\r
4342 \r
4343    The final rule for managing the retransmission timer concerns\r
4344    failover (see Section 6.4.1):\r
4345 \r
4346    F1) Whenever an endpoint switches from the current destination\r
4347        transport address to a different one, the current retransmission\r
4348        timers are left running.  As soon as the endpoint transmits a\r
4349        packet containing DATA chunk(s) to the new transport address,\r
4350        start the timer on that transport address, using the RTO value of\r
4351        the destination address to which the data is being sent, if rule\r
4352        R1 indicates to do so.\r
4353 \r
4354 6.4 Multi-homed SCTP Endpoints\r
4355 \r
4356    An SCTP endpoint is considered multi-homed if there are more than one\r
4357    transport address that can be used as a destination address to reach\r
4358    that endpoint.\r
4359 \r
4360    Moreover, the ULP of an endpoint shall select one of the multiple\r
4361    destination addresses of a multi-homed peer endpoint as the primary\r
4362    path (see Sections 5.1.2 and 10.1 for details).\r
4363 \r
4364    By default, an endpoint SHOULD always transmit to the primary path,\r
4365    unless the SCTP user explicitly specifies the destination transport\r
4366    address (and possibly source transport address) to use.\r
4367 \r
4368 \r
4369 \r
4370 Stewart, et al.             Standards Track                    [Page 78]\r
4371 \f\r
4372 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4373 \r
4374 \r
4375    An endpoint SHOULD transmit reply chunks (e.g., SACK, HEARTBEAT ACK,\r
4376    etc.) to the same destination transport address from which it\r
4377    received the DATA or control chunk to which it is replying.  This\r
4378    rule should also be followed if the endpoint is bundling DATA chunks\r
4379    together with the reply chunk.\r
4380 \r
4381    However, when acknowledging multiple DATA chunks received in packets\r
4382    from different source addresses in a single SACK, the SACK chunk may\r
4383    be transmitted to one of the destination transport addresses from\r
4384    which the DATA or control chunks being acknowledged were received.\r
4385 \r
4386    When a receiver of a duplicate DATA chunk sends a SACK to a multi-\r
4387    homed endpoint it MAY be beneficial to vary the destination address\r
4388    and not use the source address of the DATA chunk.  The reason being\r
4389    that receiving a duplicate from a multi-homed endpoint might indicate\r
4390    that the return path (as specified in the source address of the DATA\r
4391    chunk) for the SACK is broken.\r
4392 \r
4393    Furthermore, when its peer is multi-homed, an endpoint SHOULD try to\r
4394    retransmit a chunk to an active destination transport address that is\r
4395    different from the last destination address to which the DATA chunk\r
4396    was sent.\r
4397 \r
4398    Retransmissions do not affect the total outstanding data count.\r
4399    However, if the DATA chunk is retransmitted onto a different\r
4400    destination address, both the outstanding data counts on the new\r
4401    destination address and the old destination address to which the data\r
4402    chunk was last sent shall be adjusted accordingly.\r
4403 \r
4404 6.4.1 Failover from Inactive Destination Address\r
4405 \r
4406    Some of the transport addresses of a multi-homed SCTP endpoint may\r
4407    become inactive due to either the occurrence of certain error\r
4408    conditions (see Section 8.2) or adjustments from SCTP user.\r
4409 \r
4410    When there is outbound data to send and the primary path becomes\r
4411    inactive (e.g., due to failures), or where the SCTP user explicitly\r
4412    requests to send data to an inactive destination transport address,\r
4413    before reporting an error to its ULP, the SCTP endpoint should try to\r
4414    send the data to an alternate active destination transport address if\r
4415    one exists.\r
4416 \r
4417    When retransmitting data, if the endpoint is multi-homed, it should\r
4418    consider each source-destination address pair in its retransmission\r
4419    selection policy.  When retransmitting the endpoint should attempt to\r
4420    pick the most divergent source-destination pair from the original\r
4421    source-destination pair to which the packet was transmitted.\r
4422 \r
4423 \r
4424 \r
4425 \r
4426 Stewart, et al.             Standards Track                    [Page 79]\r
4427 \f\r
4428 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4429 \r
4430 \r
4431    Note: Rules for picking the most divergent source-destination pair\r
4432    are an implementation decision and is not specified within this\r
4433    document.\r
4434 \r
4435 6.5 Stream Identifier and Stream Sequence Number\r
4436 \r
4437    Every DATA chunk MUST carry a valid stream identifier.  If an\r
4438    endpoint receives a DATA chunk with an invalid stream identifier, it\r
4439    shall acknowledge the reception of the DATA chunk following the\r
4440    normal procedure, immediately send an ERROR chunk with cause set to\r
4441    "Invalid Stream Identifier" (see Section 3.3.10) and discard the DATA\r
4442    chunk. The endpoint may bundle the ERROR chunk in the same packet as\r
4443    the SACK as long as the ERROR follows the SACK.\r
4444 \r
4445    The stream sequence number in all the streams shall start from 0 when\r
4446    the association is established.  Also, when the stream sequence\r
4447    number reaches the value 65535 the next stream sequence number shall\r
4448    be set to 0.\r
4449 \r
4450 6.6 Ordered and Unordered Delivery\r
4451 \r
4452    Within a stream, an endpoint MUST deliver DATA chunks received with\r
4453    the U flag set to 0 to the upper layer according to the order of\r
4454    their stream sequence number.  If DATA chunks arrive out of order of\r
4455    their stream sequence number, the endpoint MUST hold the received\r
4456    DATA chunks from delivery to the ULP until they are re-ordered.\r
4457 \r
4458    However, an SCTP endpoint can indicate that no ordered delivery is\r
4459    required for a particular DATA chunk transmitted within the stream by\r
4460    setting the U flag of the DATA chunk to 1.\r
4461 \r
4462    When an endpoint receives a DATA chunk with the U flag set to 1, it\r
4463    must bypass the ordering mechanism and immediately deliver the data\r
4464    to the upper layer (after re-assembly if the user data is fragmented\r
4465    by the data sender).\r
4466 \r
4467    This provides an effective way of transmitting "out-of-band" data in\r
4468    a given stream.  Also, a stream can be used as an "unordered" stream\r
4469    by simply setting the U flag to 1 in all DATA chunks sent through\r
4470    that stream.\r
4471 \r
4472    IMPLEMENTATION NOTE: When sending an unordered DATA chunk, an\r
4473    implementation may choose to place the DATA chunk in an outbound\r
4474    packet that is at the head of the outbound transmission queue if\r
4475    possible.\r
4476 \r
4477 \r
4478 \r
4479 \r
4480 \r
4481 \r
4482 Stewart, et al.             Standards Track                    [Page 80]\r
4483 \f\r
4484 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4485 \r
4486 \r
4487    The 'Stream Sequence Number' field in a DATA chunk with U flag set to\r
4488    1 has no significance.  The sender can fill it with arbitrary value,\r
4489    but the receiver MUST ignore the field.\r
4490 \r
4491    Note:  When transmitting ordered and unordered data, an endpoint does\r
4492    not increment its Stream Sequence Number when transmitting a DATA\r
4493    chunk with U flag set to 1.\r
4494 \r
4495 6.7 Report Gaps in Received DATA TSNs\r
4496 \r
4497    Upon the reception of a new DATA chunk, an endpoint shall examine the\r
4498    continuity of the TSNs received.  If the endpoint detects a gap in\r
4499    the received DATA chunk sequence, it SHOULD send a SACK with Gap Ack\r
4500    Blocks immediately.  The data receiver continues sending a SACK after\r
4501    receipt of each SCTP packet that doesn't fill the gap.\r
4502 \r
4503    Based on the Gap Ack Block from the received SACK, the endpoint can\r
4504    calculate the missing DATA chunks and make decisions on whether to\r
4505    retransmit them (see Section 6.2.1 for details).\r
4506 \r
4507    Multiple gaps can be reported in one single SACK (see Section 3.3.4).\r
4508 \r
4509    When its peer is multi-homed, the SCTP endpoint SHOULD always try to\r
4510    send the SACK to the same destination address from which the last\r
4511    DATA chunk was received.\r
4512 \r
4513    Upon the reception of a SACK, the endpoint MUST remove all DATA\r
4514    chunks which have been acknowledged by the SACK's Cumulative TSN Ack\r
4515    from its transmit queue.  The endpoint MUST also treat all the DATA\r
4516    chunks with TSNs not included in the Gap Ack Blocks reported by the\r
4517    SACK as "missing".  The number of "missing" reports for each\r
4518    outstanding DATA chunk MUST be recorded by the data sender in order\r
4519    to make retransmission decisions.  See Section 7.2.4 for details.\r
4520 \r
4521    The following example shows the use of SACK to report a gap.\r
4522 \r
4523 \r
4524 \r
4525 \r
4526 \r
4527 \r
4528 \r
4529 \r
4530 \r
4531 \r
4532 \r
4533 \r
4534 \r
4535 \r
4536 \r
4537 \r
4538 Stewart, et al.             Standards Track                    [Page 81]\r
4539 \f\r
4540 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4541 \r
4542 \r
4543       Endpoint A                                    Endpoint Z\r
4544       {App sends 3 messages; strm 0}\r
4545       DATA [TSN=6,Strm=0,Seq=2] ---------------> (ack delayed)\r
4546       (Start T3-rtx timer)\r
4547 \r
4548       DATA [TSN=7,Strm=0,Seq=3] --------> X (lost)\r
4549 \r
4550       DATA [TSN=8,Strm=0,Seq=4] ---------------> (gap detected,\r
4551                                                   immediately send ack)\r
4552                                       /----- SACK [TSN Ack=6,Block=1,\r
4553                                      /             Strt=2,End=2]\r
4554                               <-----/\r
4555       (remove 6 from out-queue,\r
4556        and mark 7 as "1" missing report)\r
4557 \r
4558                  Figure 9 - Reporting a Gap using SACK\r
4559 \r
4560    The maximum number of Gap Ack Blocks that can be reported within a\r
4561    single SACK chunk is limited by the current path MTU.  When a single\r
4562    SACK can not cover all the Gap Ack Blocks needed to be reported due\r
4563    to the MTU limitation, the endpoint MUST send only one SACK,\r
4564    reporting the Gap Ack Blocks from the lowest to highest TSNs, within\r
4565    the size limit set by the MTU, and leave the remaining highest TSN\r
4566    numbers unacknowledged.\r
4567 \r
4568 6.8 Adler-32 Checksum Calculation\r
4569 \r
4570    When sending an SCTP packet, the endpoint MUST strengthen the data\r
4571    integrity of the transmission by including the Adler-32 checksum\r
4572    value calculated on the packet, as described below.\r
4573 \r
4574    After the packet is constructed (containing the SCTP common header\r
4575    and one or more control or DATA chunks), the transmitter shall:\r
4576 \r
4577    1) Fill in the proper Verification Tag in the SCTP common header and\r
4578       initialize the checksum field to 0's.\r
4579 \r
4580    2) Calculate the Adler-32 checksum of the whole packet, including the\r
4581       SCTP common header and all the chunks.  Refer to appendix B for\r
4582       details of the Adler-32 algorithm.  And,\r
4583 \r
4584    3) Put the resultant value into the checksum field in the common\r
4585       header, and leave the rest of the bits unchanged.\r
4586 \r
4587    When an SCTP packet is received, the receiver MUST first check the\r
4588    Adler-32 checksum:\r
4589 \r
4590    1) Store the received Adler-32 checksum value aside,\r
4591 \r
4592 \r
4593 \r
4594 Stewart, et al.             Standards Track                    [Page 82]\r
4595 \f\r
4596 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4597 \r
4598 \r
4599    2) Replace the 32 bits of the checksum field in the received SCTP\r
4600       packet with all '0's and calculate an Adler-32 checksum value of\r
4601       the whole received packet.  And,\r
4602 \r
4603    3) Verify that the calculated Adler-32 checksum is the same as the\r
4604       received Adler-32 checksum.  If not, the receiver MUST treat the\r
4605       packet as an invalid SCTP packet.\r
4606 \r
4607    The default procedure for handling invalid SCTP packets is to\r
4608    silently discard them.\r
4609 \r
4610 6.9 Fragmentation and Reassembly\r
4611 \r
4612    An endpoint MAY support fragmentation when sending DATA chunks, but\r
4613    MUST support reassembly when receiving DATA chunks.  If an endpoint\r
4614    supports fragmentation, it MUST fragment a user message if the size\r
4615    of the user message to be sent causes the outbound SCTP packet size\r
4616    to exceed the current MTU.  If an implementation does not support\r
4617    fragmentation of outbound user messages, the endpoint must return an\r
4618    error to its upper layer and not attempt to send the user message.\r
4619 \r
4620    IMPLEMENTATION NOTE:  In this error case, the Send primitive\r
4621    discussed in Section 10.1 would need to return an error to the upper\r
4622    layer.\r
4623 \r
4624    If its peer is multi-homed, the endpoint shall choose a size no\r
4625    larger than the association Path MTU.  The association Path MTU is\r
4626    the smallest Path MTU of all destination addresses.\r
4627 \r
4628    Note: Once a message is fragmented it cannot be re-fragmented.\r
4629    Instead if the PMTU has been reduced, then IP fragmentation must be\r
4630    used.  Please see Section 7.3 for details of PMTU discovery.\r
4631 \r
4632    When determining when to fragment, the SCTP implementation MUST take\r
4633    into account the SCTP packet header as well as the DATA chunk\r
4634    header(s).  The implementation MUST also take into account the space\r
4635    required for a SACK chunk if bundling a SACK chunk with the DATA\r
4636    chunk.\r
4637 \r
4638    Fragmentation takes the following steps:\r
4639 \r
4640    1) The data sender MUST break the user message into a series of DATA\r
4641       chunks such that each chunk plus SCTP overhead fits into an IP\r
4642       datagram smaller than or equal to the association Path MTU.\r
4643 \r
4644    2) The transmitter MUST then assign, in sequence, a separate TSN to\r
4645       each of the DATA chunks in the series.  The transmitter assigns\r
4646       the same SSN to each of the DATA chunks.  If the user indicates\r
4647 \r
4648 \r
4649 \r
4650 Stewart, et al.             Standards Track                    [Page 83]\r
4651 \f\r
4652 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4653 \r
4654 \r
4655       that the user message is to be delivered using unordered delivery,\r
4656       then the U flag of each DATA chunk of the user message MUST be set\r
4657       to 1.\r
4658 \r
4659    3) The transmitter MUST also set the B/E bits of the first DATA chunk\r
4660       in the series to '10', the B/E bits of the last DATA chunk in the\r
4661       series to '01', and the B/E bits of all other DATA chunks in the\r
4662       series to '00'.\r
4663 \r
4664    An endpoint MUST recognize fragmented DATA chunks by examining the\r
4665    B/E bits in each of the received DATA chunks, and queue the\r
4666    fragmented DATA chunks for re-assembly.  Once the user message is\r
4667    reassembled, SCTP shall pass the re-assembled user message to the\r
4668    specific stream for possible re-ordering and final dispatching.\r
4669 \r
4670    Note: If the data receiver runs out of buffer space while still\r
4671    waiting for more fragments to complete the re-assembly of the\r
4672    message, it should dispatch part of its inbound message through a\r
4673    partial delivery API (see Section 10), freeing some of its receive\r
4674    buffer space so that the rest of the message may be received.\r
4675 \r
4676 6.10 Bundling\r
4677 \r
4678    An endpoint bundles chunks by simply including multiple chunks in one\r
4679    outbound SCTP packet.  The total size of the resultant IP datagram,\r
4680    including the SCTP packet and IP headers, MUST be less or equal to\r
4681    the current Path MTU.\r
4682 \r
4683    If its peer endpoint is multi-homed, the sending endpoint shall\r
4684    choose a size no larger than the latest MTU of the current primary\r
4685    path.\r
4686 \r
4687    When bundling control chunks with DATA chunks, an endpoint MUST place\r
4688    control chunks first in the outbound SCTP packet.  The transmitter\r
4689    MUST transmit DATA chunks within a SCTP packet in increasing order of\r
4690    TSN.\r
4691 \r
4692    Note:  Since control chunks must be placed first in a packet and\r
4693    since DATA chunks must be transmitted before SHUTDOWN or SHUTDOWN ACK\r
4694    chunks, DATA chunks cannot be bundled with SHUTDOWN or SHUTDOWN ACK\r
4695    chunks.\r
4696 \r
4697    Partial chunks MUST NOT be placed in an SCTP packet.\r
4698 \r
4699 \r
4700 \r
4701 \r
4702 \r
4703 \r
4704 \r
4705 \r
4706 Stewart, et al.             Standards Track                    [Page 84]\r
4707 \f\r
4708 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4709 \r
4710 \r
4711    An endpoint MUST process received chunks in their order in the\r
4712    packet. The receiver uses the chunk length field to determine the end\r
4713    of a chunk and beginning of the next chunk taking account of the fact\r
4714    that all chunks end on a 4 byte boundary.  If the receiver detects a\r
4715    partial chunk, it MUST drop the chunk.\r
4716 \r
4717    An endpoint MUST NOT bundle INIT, INIT ACK or SHUTDOWN COMPLETE with\r
4718    any other chunks.\r
4719 \r
4720 7. Congestion control\r
4721 \r
4722    Congestion control is one of the basic functions in SCTP.  For some\r
4723    applications, it may be likely that adequate resources will be\r
4724    allocated to SCTP traffic to assure prompt delivery of time-critical\r
4725    data - thus it would appear to be unlikely, during normal operations,\r
4726    that transmissions encounter severe congestion conditions.  However\r
4727    SCTP must operate under adverse operational conditions, which can\r
4728    develop upon partial network failures or unexpected traffic surges.\r
4729    In such situations SCTP must follow correct congestion control steps\r
4730    to recover from congestion quickly in order to get data delivered as\r
4731    soon as possible.  In the absence of network congestion, these\r
4732    preventive congestion control algorithms should show no impact on the\r
4733    protocol performance.\r
4734 \r
4735    IMPLEMENTATION NOTE: As far as its specific performance requirements\r
4736    are met, an implementation is always allowed to adopt a more\r
4737    conservative congestion control algorithm than the one defined below.\r
4738 \r
4739    The congestion control algorithms used by SCTP are based on\r
4740    [RFC2581].  This section describes how the algorithms defined in\r
4741    RFC2581 are adapted for use in SCTP.  We first list differences in\r
4742    protocol designs between TCP and SCTP, and then describe SCTP's\r
4743    congestion control scheme.  The description will use the same\r
4744    terminology as in TCP congestion control whenever appropriate.\r
4745 \r
4746    SCTP congestion control is always applied to the entire association,\r
4747    and not to individual streams.\r
4748 \r
4749 7.1 SCTP Differences from TCP Congestion control\r
4750 \r
4751    Gap Ack Blocks in the SCTP SACK carry the same semantic meaning as\r
4752    the TCP SACK.  TCP considers the information carried in the SACK as\r
4753    advisory information only.  SCTP considers the information carried in\r
4754    the Gap Ack Blocks in the SACK chunk as advisory.  In SCTP, any DATA\r
4755    chunk that has been acknowledged by SACK, including DATA that arrived\r
4756    at the receiving end out of order, are not considered fully delivered\r
4757    until the Cumulative TSN Ack Point passes the TSN of the DATA chunk\r
4758    (i.e., the DATA chunk has been acknowledged by the Cumulative TSN Ack\r
4759 \r
4760 \r
4761 \r
4762 Stewart, et al.             Standards Track                    [Page 85]\r
4763 \f\r
4764 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4765 \r
4766 \r
4767    field in the SACK).  Consequently, the value of cwnd controls the\r
4768    amount of outstanding data, rather than (as in the case of non-SACK\r
4769    TCP) the upper bound between the highest acknowledged sequence number\r
4770    and the latest DATA chunk that can be sent within the congestion\r
4771    window.  SCTP SACK leads to different implementations of fast-\r
4772    retransmit and fast-recovery than non-SACK TCP.  As an example see\r
4773    [FALL96].\r
4774 \r
4775    The biggest difference between SCTP and TCP, however, is multi-\r
4776    homing.  SCTP is designed to establish robust communication\r
4777    associations between two endpoints each of which may be reachable by\r
4778    more than one transport address.  Potentially different addresses may\r
4779    lead to different data paths between the two endpoints, thus ideally\r
4780    one may need a separate set of congestion control parameters for each\r
4781    of the paths.  The treatment here of congestion control for multi-\r
4782    homed receivers is new with SCTP and may require refinement in the\r
4783    future.  The current algorithms make the following assumptions:\r
4784 \r
4785    o  The sender usually uses the same destination address until being\r
4786       instructed by the upper layer otherwise; however, SCTP may change\r
4787       to an alternate destination in the event an address is marked\r
4788       inactive (see Section 8.2).  Also, SCTP may retransmit to a\r
4789       different transport address than the original transmission.\r
4790 \r
4791    o  The sender keeps a separate congestion control parameter set for\r
4792       each of the destination addresses it can send to (not each\r
4793       source-destination pair but for each destination).  The parameters\r
4794       should decay if the address is not used for a long enough time\r
4795       period.\r
4796 \r
4797    o  For each of the destination addresses, an endpoint does slow-start\r
4798       upon the first transmission to that address.\r
4799 \r
4800    Note:  TCP guarantees in-sequence delivery of data to its upper-layer\r
4801    protocol within a single TCP session.  This means that when TCP\r
4802    notices a gap in the received sequence number, it waits until the gap\r
4803    is filled before delivering the data that was received with sequence\r
4804    numbers higher than that of the missing data.  On the other hand,\r
4805    SCTP can deliver data to its upper-layer protocol even if there is a\r
4806    gap in TSN if the Stream Sequence Numbers are in sequence for a\r
4807    particular stream (i.e., the missing DATA chunks are for a different\r
4808    stream) or if unordered delivery is indicated.  Although this does\r
4809    not affect cwnd, it might affect rwnd calculation.\r
4810 \r
4811 \r
4812 \r
4813 \r
4814 \r
4815 \r
4816 \r
4817 \r
4818 Stewart, et al.             Standards Track                    [Page 86]\r
4819 \f\r
4820 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4821 \r
4822 \r
4823 7.2 SCTP Slow-Start and Congestion Avoidance\r
4824 \r
4825    The slow start and congestion avoidance algorithms MUST be used by an\r
4826    endpoint to control the amount of data being injected into the\r
4827    network. The congestion control in SCTP is employed in regard to the\r
4828    association, not to an individual stream.  In some situations it may\r
4829    be beneficial for an SCTP sender to be more conservative than the\r
4830    algorithms allow; however, an SCTP sender MUST NOT be more aggressive\r
4831    than the following algorithms allow.\r
4832 \r
4833    Like TCP, an SCTP endpoint uses the following three control variables\r
4834    to regulate its transmission rate.\r
4835 \r
4836    o  Receiver advertised window size (rwnd, in bytes), which is set by\r
4837       the receiver based on its available buffer space for incoming\r
4838       packets.\r
4839 \r
4840       Note: This variable is kept on the entire association.\r
4841 \r
4842    o  Congestion control window (cwnd, in bytes), which is adjusted by\r
4843       the sender based on observed network conditions.\r
4844 \r
4845       Note: This variable is maintained on a per-destination address\r
4846       basis.\r
4847 \r
4848    o  Slow-start threshold (ssthresh, in bytes), which is used by the\r
4849       sender to distinguish slow start and congestion avoidance phases.\r
4850 \r
4851       Note: This variable is maintained on a per-destination address\r
4852       basis.\r
4853 \r
4854    SCTP also requires one additional control variable,\r
4855    partial_bytes_acked, which is used during congestion avoidance phase\r
4856    to facilitate cwnd adjustment.\r
4857 \r
4858    Unlike TCP, an SCTP sender MUST keep a set of these control variables\r
4859    cwnd, ssthresh and partial_bytes_acked for EACH destination address\r
4860    of its peer (when its peer is multi-homed).  Only one rwnd is kept\r
4861    for the whole association (no matter if the peer is multi-homed or\r
4862    has a single address).\r
4863 \r
4864 7.2.1 Slow-Start\r
4865 \r
4866    Beginning data transmission into a network with unknown conditions or\r
4867    after a sufficiently long idle period requires SCTP to probe the\r
4868    network to determine the available capacity.  The slow start\r
4869    algorithm is used for this purpose at the beginning of a transfer, or\r
4870    after repairing loss detected by the retransmission timer.\r
4871 \r
4872 \r
4873 \r
4874 Stewart, et al.             Standards Track                    [Page 87]\r
4875 \f\r
4876 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4877 \r
4878 \r
4879    o  The initial cwnd before DATA transmission or after a sufficiently\r
4880       long idle period MUST be <= 2*MTU.\r
4881 \r
4882    o  The initial cwnd after a retransmission timeout MUST be no more\r
4883       than 1*MTU.\r
4884 \r
4885    o  The initial value of ssthresh MAY be arbitrarily high (for\r
4886       example, implementations MAY use the size of the receiver\r
4887       advertised window).\r
4888 \r
4889    o  Whenever cwnd is greater than zero, the endpoint is allowed to\r
4890       have cwnd bytes of data outstanding on that transport address.\r
4891 \r
4892    o  When cwnd is less than or equal to ssthresh an SCTP endpoint MUST\r
4893       use the slow start algorithm to increase cwnd (assuming the\r
4894       current congestion window is being fully utilized).  If an\r
4895       incoming SACK advances the Cumulative TSN Ack Point, cwnd MUST be\r
4896       increased by at most the lesser of 1) the total size of the\r
4897       previously outstanding DATA chunk(s) acknowledged, and 2) the\r
4898       destination's path MTU. This protects against the ACK-Splitting\r
4899       attack outlined in [SAVAGE99].\r
4900 \r
4901    In instances where its peer endpoint is multi-homed, if an endpoint\r
4902    receives a SACK that advances its Cumulative TSN Ack Point, then it\r
4903    should update its cwnd (or cwnds) apportioned to the destination\r
4904    addresses to which it transmitted the acknowledged data.  However if\r
4905    the received SACK does not advance the Cumulative TSN Ack Point, the\r
4906    endpoint MUST NOT adjust the cwnd of any of the destination\r
4907    addresses.\r
4908 \r
4909    Because an endpoint's cwnd is not tied to its Cumulative TSN Ack\r
4910    Point, as duplicate SACKs come in, even though they may not advance\r
4911    the Cumulative TSN Ack Point an endpoint can still use them to clock\r
4912    out new data.  That is, the data newly acknowledged by the SACK\r
4913    diminishes the amount of data now in flight to less than cwnd; and so\r
4914    the current, unchanged value of cwnd now allows new data to be sent.\r
4915    On the other hand, the increase of cwnd must be tied to the\r
4916    Cumulative TSN Ack Point advancement as specified above.  Otherwise\r
4917    the duplicate SACKs will not only clock out new data, but also will\r
4918    adversely clock out more new data than what has just left the\r
4919    network, during a time of possible congestion.\r
4920 \r
4921    o  When the endpoint does not transmit data on a given transport\r
4922       address, the cwnd of the transport address should be adjusted to\r
4923       max(cwnd/2, 2*MTU) per RTO.\r
4924 \r
4925 \r
4926 \r
4927 \r
4928 \r
4929 \r
4930 Stewart, et al.             Standards Track                    [Page 88]\r
4931 \f\r
4932 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4933 \r
4934 \r
4935 7.2.2 Congestion Avoidance\r
4936 \r
4937    When cwnd is greater than ssthresh, cwnd should be incremented by\r
4938    1*MTU per RTT if the sender has cwnd or more bytes of data\r
4939    outstanding for the corresponding transport address.\r
4940 \r
4941    In practice an implementation can achieve this goal in the following\r
4942    way:\r
4943 \r
4944    o  partial_bytes_acked is initialized to 0.\r
4945 \r
4946    o  Whenever cwnd is greater than ssthresh, upon each SACK arrival\r
4947       that advances the Cumulative TSN Ack Point, increase\r
4948       partial_bytes_acked by the total number of bytes of all new chunks\r
4949       acknowledged in that SACK including chunks acknowledged by the new\r
4950       Cumulative TSN Ack and by Gap Ack Blocks.\r
4951 \r
4952    o  When partial_bytes_acked is equal to or greater than cwnd and\r
4953       before the arrival of the SACK the sender had cwnd or more bytes\r
4954       of data outstanding (i.e., before arrival of the SACK, flightsize\r
4955       was greater than or equal to cwnd), increase cwnd by MTU, and\r
4956       reset partial_bytes_acked to (partial_bytes_acked - cwnd).\r
4957 \r
4958    o  Same as in the slow start, when the sender does not transmit DATA\r
4959       on a given transport address, the cwnd of the transport address\r
4960       should be adjusted to max(cwnd / 2, 2*MTU) per RTO.\r
4961 \r
4962    o  When all of the data transmitted by the sender has been\r
4963       acknowledged by the receiver, partial_bytes_acked is initialized\r
4964       to 0.\r
4965 \r
4966 7.2.3 Congestion Control\r
4967 \r
4968    Upon detection of packet losses from SACK  (see Section 7.2.4), An\r
4969    endpoint should do the following:\r
4970 \r
4971       ssthresh = max(cwnd/2, 2*MTU)\r
4972       cwnd = ssthresh\r
4973 \r
4974    Basically, a packet loss causes cwnd to be cut in half.\r
4975 \r
4976    When the T3-rtx timer expires on an address, SCTP should perform slow\r
4977    start by:\r
4978 \r
4979       ssthresh = max(cwnd/2, 2*MTU)\r
4980       cwnd = 1*MTU\r
4981 \r
4982 \r
4983 \r
4984 \r
4985 \r
4986 Stewart, et al.             Standards Track                    [Page 89]\r
4987 \f\r
4988 RFC 2960          Stream Control Transmission Protocol      October 2000\r
4989 \r
4990 \r
4991    and assure that no more than one SCTP packet will be in flight for\r
4992    that address until the endpoint receives acknowledgement for\r
4993    successful delivery of data to that address.\r
4994 \r
4995 7.2.4 Fast Retransmit on Gap Reports\r
4996 \r
4997    In the absence of data loss, an endpoint performs delayed\r
4998    acknowledgement.  However, whenever an endpoint notices a hole in the\r
4999    arriving TSN sequence, it SHOULD start sending a SACK back every time\r
5000    a packet arrives carrying data until the hole is filled.\r
5001 \r
5002    Whenever an endpoint receives a SACK that indicates some TSN(s)\r
5003    missing, it SHOULD wait for 3 further miss indications (via\r
5004    subsequent SACK's) on the same TSN(s) before taking action with\r
5005    regard to Fast Retransmit.\r
5006 \r
5007    When the TSN(s) is reported as missing in the fourth consecutive\r
5008    SACK, the data sender shall:\r
5009 \r
5010    1) Mark the missing DATA chunk(s) for retransmission,\r
5011 \r
5012    2) Adjust the ssthresh and cwnd of the destination address(es) to\r
5013       which the missing DATA chunks were last sent, according to the\r
5014       formula described in Section 7.2.3.\r
5015 \r
5016    3) Determine how many of the earliest (i.e., lowest TSN) DATA chunks\r
5017       marked for retransmission will fit into a single packet, subject\r
5018       to constraint of the path MTU of the destination transport address\r
5019       to which the packet is being sent.  Call this value K. Retransmit\r
5020       those K DATA chunks in a single packet.\r
5021 \r
5022    4) Restart T3-rtx timer only if the last SACK acknowledged the lowest\r
5023       outstanding TSN number sent to that address, or the endpoint is\r
5024       retransmitting the first outstanding DATA chunk sent to that\r
5025       address.\r
5026 \r
5027    Note: Before the above adjustments, if the received SACK also\r
5028    acknowledges new DATA chunks and advances the Cumulative TSN Ack\r
5029    Point, the cwnd adjustment rules defined in Sections 7.2.1 and 7.2.2\r
5030    must be applied first.\r
5031 \r
5032    A straightforward implementation of the above keeps a counter for\r
5033    each TSN hole reported by a SACK. The counter increments for each\r
5034    consecutive SACK reporting the TSN hole.  After reaching 4 and\r
5035    starting the fast retransmit procedure, the counter resets to 0.\r
5036 \r
5037 \r
5038 \r
5039 \r
5040 \r
5041 \r
5042 Stewart, et al.             Standards Track                    [Page 90]\r
5043 \f\r
5044 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5045 \r
5046 \r
5047    Because cwnd in SCTP indirectly bounds the number of outstanding\r
5048    TSN's, the effect of TCP fast-recovery is achieved automatically with\r
5049    no adjustment to the congestion control window size.\r
5050 \r
5051 7.3 Path MTU Discovery\r
5052 \r
5053    [RFC1191] specifies "Path MTU Discovery", whereby an endpoint\r
5054    maintains an estimate of the maximum transmission unit (MTU) along a\r
5055    given Internet path and refrains from sending packets along that path\r
5056    which exceed the MTU, other than occasional attempts to probe for a\r
5057    change in the Path MTU (PMTU).  RFC 1191 is thorough in its\r
5058    discussion of the MTU discovery mechanism and strategies for\r
5059    determining the current end-to-end MTU setting as well as detecting\r
5060    changes in this value.  [RFC1981] specifies the same mechanisms for\r
5061    IPv6.  An SCTP sender using IPv6 MUST use Path MTU Discovery unless\r
5062    all packets are less than the minimum IPv6 MTU [RFC2460].\r
5063 \r
5064    An endpoint SHOULD apply these techniques, and SHOULD do so on a\r
5065    per-destination-address basis.\r
5066 \r
5067    There are 4 ways in which SCTP differs from the description in RFC\r
5068    1191 of applying MTU discovery to TCP:\r
5069 \r
5070    1) SCTP associations can span multiple addresses.  An endpoint MUST\r
5071       maintain separate MTU estimates for each destination address of\r
5072       its peer.\r
5073 \r
5074    2) Elsewhere in this document, when the term "MTU" is discussed, it\r
5075       refers to the MTU associated with the destination address\r
5076       corresponding to the context of the discussion.\r
5077 \r
5078    3) Unlike TCP, SCTP does not have a notion of "Maximum Segment Size".\r
5079       Accordingly, the MTU for each destination address SHOULD be\r
5080       initialized to a value no larger than the link MTU for the local\r
5081       interface to which packets for that remote destination address\r
5082       will be routed.\r
5083 \r
5084    4) Since data transmission in SCTP is naturally structured in terms\r
5085       of TSNs rather than bytes (as is the case for TCP), the discussion\r
5086       in Section 6.5 of RFC 1191 applies: When retransmitting an IP\r
5087       datagram to a remote address for which the IP datagram appears too\r
5088       large for the path MTU to that address, the IP datagram SHOULD be\r
5089       retransmitted without the DF bit set, allowing it to possibly be\r
5090       fragmented.  Transmissions of new IP datagrams MUST have DF set.\r
5091 \r
5092 \r
5093 \r
5094 \r
5095 \r
5096 \r
5097 \r
5098 Stewart, et al.             Standards Track                    [Page 91]\r
5099 \f\r
5100 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5101 \r
5102 \r
5103    5) The sender should track an association PMTU which will be the\r
5104       smallest PMTU discovered for all of the peer's destination\r
5105       addresses.  When fragmenting messages into multiple parts this\r
5106       association PMTU should be used to calculate the size of each\r
5107       fragment.  This will allow retransmissions to be seamlessly sent\r
5108       to an alternate address without encountering IP fragmentation.\r
5109 \r
5110    Other than these differences, the discussion of TCP's use of MTU\r
5111    discovery in RFCs 1191 and 1981 applies to SCTP on a per-\r
5112    destination-address basis.\r
5113 \r
5114    Note: For IPv6 destination addresses the DF bit does not exist,\r
5115    instead the IP datagram must be fragmented as described in [RFC2460].\r
5116 \r
5117 8.  Fault Management\r
5118 \r
5119 8.1 Endpoint Failure Detection\r
5120 \r
5121    An endpoint shall keep a counter on the total number of consecutive\r
5122    retransmissions to its peer (including retransmissions to all the\r
5123    destination transport addresses of the peer if it is multi-homed).\r
5124    If the value of this counter exceeds the limit indicated in the\r
5125    protocol parameter 'Association.Max.Retrans', the endpoint shall\r
5126    consider the peer endpoint unreachable and shall stop transmitting\r
5127    any more data to it (and thus the association enters the CLOSED\r
5128    state).  In addition, the endpoint shall report the failure to the\r
5129    upper layer, and optionally report back all outstanding user data\r
5130    remaining in its outbound queue. The association is automatically\r
5131    closed when the peer endpoint becomes unreachable.\r
5132 \r
5133    The counter shall be reset each time a DATA chunk sent to that peer\r
5134    endpoint is acknowledged (by the reception of a SACK), or a\r
5135    HEARTBEAT-ACK is received from the peer endpoint.\r
5136 \r
5137 8.2 Path Failure Detection\r
5138 \r
5139    When its peer endpoint is multi-homed, an endpoint should keep a\r
5140    error counter for each of the destination transport addresses of the\r
5141    peer endpoint.\r
5142 \r
5143    Each time the T3-rtx timer expires on any address, or when a\r
5144    HEARTBEAT sent to an idle address is not acknowledged within a RTO,\r
5145    the error counter of that destination address will be incremented.\r
5146    When the value in the error counter exceeds the protocol parameter\r
5147    'Path.Max.Retrans' of that destination address, the endpoint should\r
5148    mark the destination transport address as inactive, and a\r
5149    notification SHOULD be sent to the upper layer.\r
5150 \r
5151 \r
5152 \r
5153 \r
5154 Stewart, et al.             Standards Track                    [Page 92]\r
5155 \f\r
5156 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5157 \r
5158 \r
5159    When an outstanding TSN is acknowledged or a HEARTBEAT sent to that\r
5160    address is acknowledged with a HEARTBEAT ACK, the endpoint shall\r
5161    clear the error counter of the destination transport address to which\r
5162    the DATA chunk was last sent (or HEARTBEAT was sent).  When the peer\r
5163    endpoint is multi-homed and the last chunk sent to it was a\r
5164    retransmission to an alternate address, there exists an ambiguity as\r
5165    to whether or not the acknowledgement should be credited to the\r
5166    address of the last chunk sent.  However, this ambiguity does not\r
5167    seem to bear any significant consequence to SCTP behavior.  If this\r
5168    ambiguity is undesirable, the transmitter may choose not to clear the\r
5169    error counter if the last chunk sent was a retransmission.\r
5170 \r
5171    Note: When configuring the SCTP endpoint, the user should avoid\r
5172    having the value of 'Association.Max.Retrans' larger than the\r
5173    summation of the 'Path.Max.Retrans' of all the destination addresses\r
5174    for the remote endpoint.  Otherwise, all the destination addresses\r
5175    may become inactive while the endpoint still considers the peer\r
5176    endpoint reachable.  When this condition occurs, how the SCTP chooses\r
5177    to function is implementation specific.\r
5178 \r
5179    When the primary path is marked inactive (due to excessive\r
5180    retransmissions, for instance), the sender MAY automatically transmit\r
5181    new packets to an alternate destination address if one exists and is\r
5182    active.  If more than one alternate address is active when the\r
5183    primary path is marked inactive only ONE transport address SHOULD be\r
5184    chosen and used as the new destination transport address.\r
5185 \r
5186 8.3 Path Heartbeat\r
5187 \r
5188    By default, an SCTP endpoint shall monitor the reachability of the\r
5189    idle destination transport address(es) of its peer by sending a\r
5190    HEARTBEAT chunk periodically to the destination transport\r
5191    address(es).\r
5192 \r
5193    A destination transport address is considered "idle" if no new chunk\r
5194    which can be used for updating path RTT (usually including first\r
5195    transmission DATA, INIT, COOKIE ECHO, HEARTBEAT etc.) and no\r
5196    HEARTBEAT has been sent to it within the current heartbeat period of\r
5197    that address.  This applies to both active and inactive destination\r
5198    addresses.\r
5199 \r
5200    The upper layer can optionally initiate the following functions:\r
5201 \r
5202    A) Disable heartbeat on a specific destination transport address of a\r
5203       given association,\r
5204 \r
5205    B) Change the HB.interval,\r
5206 \r
5207 \r
5208 \r
5209 \r
5210 Stewart, et al.             Standards Track                    [Page 93]\r
5211 \f\r
5212 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5213 \r
5214 \r
5215    C) Re-enable heartbeat on a specific destination transport address of\r
5216       a given association, and,\r
5217 \r
5218    D) Request an on-demand HEARTBEAT on a specific destination transport\r
5219       address of a given association.\r
5220 \r
5221    The endpoint should increment the respective error counter of the\r
5222    destination transport address each time a HEARTBEAT is sent to that\r
5223    address and not acknowledged within one RTO.\r
5224 \r
5225    When the value of this counter reaches the protocol parameter '\r
5226    Path.Max.Retrans', the endpoint should mark the corresponding\r
5227    destination address as inactive if it is not so marked, and may also\r
5228    optionally report to the upper layer the change of reachability of\r
5229    this destination address.  After this, the endpoint should continue\r
5230    HEARTBEAT on this destination address but should stop increasing the\r
5231    counter.\r
5232 \r
5233    The sender of the HEARTBEAT chunk should include in the Heartbeat\r
5234    Information field of the chunk the current time when the packet is\r
5235    sent out and the destination address to which the packet is sent.\r
5236 \r
5237    IMPLEMENTATION NOTE: An alternative implementation of the heartbeat\r
5238    mechanism that can be used is to increment the error counter variable\r
5239    every time a HEARTBEAT is sent to a destination.  Whenever a\r
5240    HEARTBEAT ACK arrives, the sender SHOULD clear the error counter of\r
5241    the destination that the HEARTBEAT was sent to.  This in effect would\r
5242    clear the previously stroked error (and any other error counts as\r
5243    well).\r
5244 \r
5245    The receiver of the HEARTBEAT should immediately respond with a\r
5246    HEARTBEAT ACK that contains the Heartbeat Information field copied\r
5247    from the received HEARTBEAT chunk.\r
5248 \r
5249    Upon the receipt of the HEARTBEAT ACK, the sender of the HEARTBEAT\r
5250    should clear the error counter of the destination transport address\r
5251    to which the HEARTBEAT was sent, and mark the destination transport\r
5252    address as active if it is not so marked.  The endpoint may\r
5253    optionally report to the upper layer when an inactive destination\r
5254    address is marked as active due to the reception of the latest\r
5255    HEARTBEAT ACK.  The receiver of the HEARTBEAT ACK must also clear the\r
5256    association overall error count as well (as defined in section 8.1).\r
5257 \r
5258    The receiver of the HEARTBEAT ACK should also perform an RTT\r
5259    measurement for that destination transport address using the time\r
5260    value carried in the HEARTBEAT ACK chunk.\r
5261 \r
5262 \r
5263 \r
5264 \r
5265 \r
5266 Stewart, et al.             Standards Track                    [Page 94]\r
5267 \f\r
5268 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5269 \r
5270 \r
5271    On an idle destination address that is allowed to heartbeat, a\r
5272    HEARTBEAT chunk is RECOMMENDED to be sent once per RTO of that\r
5273    destination address plus the protocol parameter 'HB.interval' , with\r
5274    jittering of +/- 50%, and exponential back-off of the RTO if the\r
5275    previous HEARTBEAT is unanswered.\r
5276 \r
5277    A primitive is provided for the SCTP user to change the HB.interval\r
5278    and turn on or off the heartbeat on a given destination address.  The\r
5279    heartbeat interval set by the SCTP user is added to the RTO of that\r
5280    destination (including any exponential backoff).  Only one heartbeat\r
5281    should be sent each time the heartbeat timer expires (if multiple\r
5282    destinations are idle).  It is a implementation decision on how to\r
5283    choose which of the candidate idle destinations to heartbeat to (if\r
5284    more than one destination is idle).\r
5285 \r
5286    Note: When tuning the heartbeat interval, there is a side effect that\r
5287    SHOULD be taken into account.  When this value is increased, i.e.\r
5288    the HEARTBEAT takes longer, the detection of lost ABORT messages\r
5289    takes longer as well.  If a peer endpoint ABORTs the association for\r
5290    any reason and the ABORT chunk is lost, the local endpoint will only\r
5291    discover the lost ABORT by sending a DATA chunk or HEARTBEAT chunk\r
5292    (thus causing the peer to send another ABORT).  This must be\r
5293    considered when tuning the HEARTBEAT timer.  If the HEARTBEAT is\r
5294    disabled only sending DATA to the association will discover a lost\r
5295    ABORT from the peer.\r
5296 \r
5297 8.4 Handle "Out of the blue" Packets\r
5298 \r
5299    An SCTP packet is called an "out of the blue" (OOTB) packet if it is\r
5300    correctly formed, i.e., passed the receiver's Adler-32 check (see\r
5301    Section 6.8), but the receiver is not able to identify the\r
5302    association to which this packet belongs.\r
5303 \r
5304    The receiver of an OOTB packet MUST do the following:\r
5305 \r
5306    1) If the OOTB packet is to or from a non-unicast address, silently\r
5307       discard the packet.  Otherwise,\r
5308 \r
5309    2) If the OOTB packet contains an ABORT chunk, the receiver MUST\r
5310       silently discard the OOTB packet and take no further action.\r
5311       Otherwise,\r
5312 \r
5313    3) If the packet contains an INIT chunk with a Verification Tag set\r
5314       to '0', process it as described in Section 5.1.  Otherwise,\r
5315 \r
5316    4) If the packet contains a COOKIE ECHO in the first chunk, process\r
5317       it as described in Section 5.1.  Otherwise,\r
5318 \r
5319 \r
5320 \r
5321 \r
5322 Stewart, et al.             Standards Track                    [Page 95]\r
5323 \f\r
5324 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5325 \r
5326 \r
5327    5) If the packet contains a SHUTDOWN ACK chunk, the receiver should\r
5328       respond to the sender of the OOTB packet with a SHUTDOWN COMPLETE.\r
5329       When sending the SHUTDOWN COMPLETE, the receiver of the OOTB\r
5330       packet must fill in the Verification Tag field of the outbound\r
5331       packet with the Verification Tag received in the SHUTDOWN ACK and\r
5332       set the T-bit in the Chunk Flags to indicate that no TCB was\r
5333       found. Otherwise,\r
5334 \r
5335    6) If the packet contains a SHUTDOWN COMPLETE chunk, the receiver\r
5336       should silently discard the packet and take no further action.\r
5337       Otherwise,\r
5338 \r
5339    7) If the packet contains a "Stale cookie" ERROR or a COOKIE ACK the\r
5340       SCTP Packet should be silently discarded.  Otherwise,\r
5341 \r
5342    8) The receiver should respond to the sender of the OOTB packet with\r
5343       an ABORT.  When sending the ABORT, the receiver of the OOTB packet\r
5344       MUST fill in the Verification Tag field of the outbound packet\r
5345       with the value found in the Verification Tag field of the OOTB\r
5346       packet and set the T-bit in the Chunk Flags to indicate that no\r
5347       TCB was found.  After sending this ABORT, the receiver of the OOTB\r
5348       packet shall discard the OOTB packet and take no further action.\r
5349 \r
5350 8.5 Verification Tag\r
5351 \r
5352    The Verification Tag rules defined in this section apply when sending\r
5353    or receiving SCTP packets which do not contain an INIT, SHUTDOWN\r
5354    COMPLETE, COOKIE ECHO (see Section 5.1), ABORT or SHUTDOWN ACK chunk.\r
5355    The rules for sending and receiving SCTP packets containing one of\r
5356    these chunk types are discussed separately in Section 8.5.1.\r
5357 \r
5358    When sending an SCTP packet, the endpoint MUST fill in the\r
5359    Verification Tag field of the outbound packet with the tag value in\r
5360    the Initiate Tag parameter of the INIT or INIT ACK received from its\r
5361    peer.\r
5362 \r
5363    When receiving an SCTP packet, the endpoint MUST ensure that the\r
5364    value in the Verification Tag field of the received SCTP packet\r
5365    matches its own Tag.  If the received Verification Tag value does not\r
5366    match the receiver's own tag value, the receiver shall silently\r
5367    discard the packet and shall not process it any further except for\r
5368    those cases listed in Section 8.5.1 below.\r
5369 \r
5370 \r
5371 \r
5372 \r
5373 \r
5374 \r
5375 \r
5376 \r
5377 \r
5378 Stewart, et al.             Standards Track                    [Page 96]\r
5379 \f\r
5380 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5381 \r
5382 \r
5383 8.5.1 Exceptions in Verification Tag Rules\r
5384 \r
5385    A) Rules for packet carrying INIT:\r
5386 \r
5387       -  The sender MUST set the Verification Tag of the packet to 0.\r
5388 \r
5389       -  When an endpoint receives an SCTP packet with the Verification\r
5390          Tag set to 0, it should verify that the packet contains only an\r
5391          INIT chunk.  Otherwise, the receiver MUST silently discard the\r
5392          packet.\r
5393 \r
5394    B) Rules for packet carrying ABORT:\r
5395 \r
5396       -  The endpoint shall always fill in the Verification Tag field of\r
5397          the outbound packet with the destination endpoint's tag value\r
5398          if it is known.\r
5399 \r
5400       -  If the ABORT is sent in response to an OOTB packet, the\r
5401          endpoint MUST follow the procedure described in Section 8.4.\r
5402 \r
5403       -  The receiver MUST accept the packet if the Verification Tag\r
5404          matches either its own tag, OR the tag of its peer.  Otherwise,\r
5405          the receiver MUST silently discard the packet and take no\r
5406          further action.\r
5407 \r
5408    C) Rules for packet carrying SHUTDOWN COMPLETE:\r
5409 \r
5410       -  When sending a SHUTDOWN COMPLETE, if the receiver of the\r
5411          SHUTDOWN ACK has a TCB then the destination endpoint's tag MUST\r
5412          be used.  Only where no TCB exists should the sender use the\r
5413          Verification Tag from the SHUTDOWN ACK.\r
5414 \r
5415       -  The receiver of a SHUTDOWN COMPLETE shall accept the packet if\r
5416          the Verification Tag field of the packet matches its own tag OR\r
5417          it is set to its peer's tag and the T bit is set in the Chunk\r
5418          Flags. Otherwise, the receiver MUST silently discard the packet\r
5419          and take no further action.  An endpoint MUST ignore the\r
5420          SHUTDOWN COMPLETE if it is not in the SHUTDOWN-ACK-SENT state.\r
5421 \r
5422    D) Rules for packet carrying a COOKIE ECHO\r
5423 \r
5424       -  When sending a COOKIE ECHO, the endpoint MUST use the value of\r
5425          the Initial Tag received in the INIT ACK.\r
5426 \r
5427       -  The receiver of a COOKIE ECHO follows the procedures in Section\r
5428          5.\r
5429 \r
5430 \r
5431 \r
5432 \r
5433 \r
5434 Stewart, et al.             Standards Track                    [Page 97]\r
5435 \f\r
5436 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5437 \r
5438 \r
5439    E) Rules for packet carrying a SHUTDOWN ACK\r
5440 \r
5441       -  If the receiver is in COOKIE-ECHOED or COOKIE-WAIT state the\r
5442          procedures in section 8.4 SHOULD be followed, in other words it\r
5443          should be treated as an Out Of The Blue packet.\r
5444 \r
5445 9. Termination of Association\r
5446 \r
5447    An endpoint should terminate its association when it exits from\r
5448    service.  An association can be terminated by either abort or\r
5449    shutdown.  An abort of an association is abortive by definition in\r
5450    that any data pending on either end of the association is discarded\r
5451    and not delivered to the peer.  A shutdown of an association is\r
5452    considered a graceful close where all data in queue by either\r
5453    endpoint is delivered to the respective peers.  However, in the case\r
5454    of a shutdown, SCTP does not support a half-open state (like TCP)\r
5455    wherein one side may continue sending data while the other end is\r
5456    closed.  When either endpoint performs a shutdown, the association on\r
5457    each peer will stop accepting new data from its user and only deliver\r
5458    data in queue at the time of sending or receiving the SHUTDOWN chunk.\r
5459 \r
5460 9.1 Abort of an Association\r
5461 \r
5462    When an endpoint decides to abort an existing association, it shall\r
5463    send an ABORT chunk to its peer endpoint.  The sender MUST fill in\r
5464    the peer's Verification Tag in the outbound packet and MUST NOT\r
5465    bundle any DATA chunk with the ABORT.\r
5466 \r
5467    An endpoint MUST NOT respond to any received packet that contains an\r
5468    ABORT chunk (also see Section 8.4).\r
5469 \r
5470    An endpoint receiving an ABORT shall apply the special Verification\r
5471    Tag check rules described in Section 8.5.1.\r
5472 \r
5473    After checking the Verification Tag, the receiving endpoint shall\r
5474    remove the association from its record, and shall report the\r
5475    termination to its upper layer.\r
5476 \r
5477 9.2 Shutdown of an Association\r
5478 \r
5479    Using the SHUTDOWN primitive (see Section 10.1), the upper layer of\r
5480    an endpoint in an association can gracefully close the association.\r
5481    This will allow all outstanding DATA chunks from the peer of the\r
5482    shutdown initiator to be delivered before the association terminates.\r
5483 \r
5484    Upon receipt of the SHUTDOWN primitive from its upper layer, the\r
5485    endpoint enters SHUTDOWN-PENDING state and remains there until all\r
5486    outstanding data has been acknowledged by its peer.  The endpoint\r
5487 \r
5488 \r
5489 \r
5490 Stewart, et al.             Standards Track                    [Page 98]\r
5491 \f\r
5492 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5493 \r
5494 \r
5495    accepts no new data from its upper layer, but retransmits data to the\r
5496    far end if necessary to fill gaps.\r
5497 \r
5498    Once all its outstanding data has been acknowledged, the endpoint\r
5499    shall send a SHUTDOWN chunk to its peer including in the Cumulative\r
5500    TSN Ack field the last sequential TSN it has received from the peer.\r
5501    It shall then start the T2-shutdown timer and enter the SHUTDOWN-SENT\r
5502    state.  If the timer expires, the endpoint must re-send the SHUTDOWN\r
5503    with the updated last sequential TSN received from its peer.\r
5504 \r
5505    The rules in Section 6.3 MUST be followed to determine the proper\r
5506    timer value for T2-shutdown.  To indicate any gaps in TSN, the\r
5507    endpoint may also bundle a SACK with the SHUTDOWN chunk in the same\r
5508    SCTP packet.\r
5509 \r
5510    An endpoint should limit the number of retransmissions of the\r
5511    SHUTDOWN chunk to the protocol parameter 'Association.Max.Retrans'.\r
5512    If this threshold is exceeded the endpoint should destroy the TCB and\r
5513    MUST report the peer endpoint unreachable to the upper layer (and\r
5514    thus the association enters the CLOSED state).  The reception of any\r
5515    packet from its peer (i.e. as the peer sends all of its queued DATA\r
5516    chunks) should clear the endpoint's retransmission count and restart\r
5517    the T2-Shutdown timer,  giving its peer ample opportunity to transmit\r
5518    all of its queued DATA chunks that have not yet been sent.\r
5519 \r
5520    Upon the reception of the SHUTDOWN, the peer endpoint shall\r
5521 \r
5522    -  enter the SHUTDOWN-RECEIVED state,\r
5523 \r
5524    -  stop accepting new data from its SCTP user\r
5525 \r
5526    -  verify, by checking the Cumulative TSN Ack field of the chunk,\r
5527       that all its outstanding DATA chunks have been received by the\r
5528       SHUTDOWN sender.\r
5529 \r
5530    Once an endpoint as reached the SHUTDOWN-RECEIVED state it MUST NOT\r
5531    send a SHUTDOWN in response to a ULP request, and should discard\r
5532    subsequent SHUTDOWN chunks.\r
5533 \r
5534    If there are still outstanding DATA chunks left, the SHUTDOWN\r
5535    receiver shall continue to follow normal data transmission procedures\r
5536    defined in Section 6 until all outstanding DATA chunks are\r
5537    acknowledged; however, the SHUTDOWN receiver MUST NOT accept new data\r
5538    from its SCTP user.\r
5539 \r
5540    While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately\r
5541    respond to each received packet containing one or more DATA chunk(s)\r
5542    with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer. If\r
5543 \r
5544 \r
5545 \r
5546 Stewart, et al.             Standards Track                    [Page 99]\r
5547 \f\r
5548 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5549 \r
5550 \r
5551    it has no more outstanding DATA chunks, the SHUTDOWN receiver shall\r
5552    send a SHUTDOWN ACK and start a T2-shutdown timer of its own,\r
5553    entering the SHUTDOWN-ACK-SENT state.  If the timer expires, the\r
5554    endpoint must re-send the SHUTDOWN ACK.\r
5555 \r
5556    The sender of the SHUTDOWN ACK should limit the number of\r
5557    retransmissions of the SHUTDOWN ACK chunk to the protocol parameter '\r
5558    Association.Max.Retrans'.  If this threshold is exceeded the endpoint\r
5559    should destroy the TCB and may report the peer endpoint unreachable\r
5560    to the upper layer (and thus the association enters the CLOSED\r
5561    state).\r
5562 \r
5563    Upon the receipt of the SHUTDOWN ACK, the SHUTDOWN sender shall stop\r
5564    the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its peer,\r
5565    and remove all record of the association.\r
5566 \r
5567    Upon reception of the SHUTDOWN COMPLETE chunk the endpoint will\r
5568    verify that it is in SHUTDOWN-ACK-SENT state, if it is not the chunk\r
5569    should be discarded.  If the endpoint is in the SHUTDOWN-ACK-SENT\r
5570    state the endpoint should stop the T2-shutdown timer and remove all\r
5571    knowledge of the association (and thus the association enters the\r
5572    CLOSED state).\r
5573 \r
5574    An endpoint SHOULD assure that all its outstanding DATA chunks have\r
5575    been acknowledged before initiating the shutdown procedure.\r
5576 \r
5577    An endpoint should reject any new data request from its upper layer\r
5578    if it is in SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED, or\r
5579    SHUTDOWN-ACK-SENT state.\r
5580 \r
5581    If an endpoint is in SHUTDOWN-ACK-SENT state and receives an INIT\r
5582    chunk (e.g., if the SHUTDOWN COMPLETE was lost) with source and\r
5583    destination transport addresses (either in the IP addresses or in the\r
5584    INIT chunk) that belong to this association, it should discard the\r
5585    INIT chunk and retransmit the SHUTDOWN ACK chunk.\r
5586 \r
5587    Note: Receipt of an INIT with the same source and destination IP\r
5588    addresses as used in transport addresses assigned to an endpoint but\r
5589    with a different port number indicates the initialization of a\r
5590    separate association.\r
5591 \r
5592    The sender of the INIT or COOKIE ECHO should respond to the receipt\r
5593    of a SHUTDOWN-ACK with a stand-alone SHUTDOWN COMPLETE in an SCTP\r
5594    packet with the Verification Tag field of its common header set to\r
5595    the same tag that was received in the SHUTDOWN ACK packet.  This is\r
5596    considered an Out of the Blue packet as defined in Section 8.4.  The\r
5597    sender of the INIT lets T1-init continue running and remains in the\r
5598 \r
5599 \r
5600 \r
5601 \r
5602 Stewart, et al.             Standards Track                   [Page 100]\r
5603 \f\r
5604 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5605 \r
5606 \r
5607    COOKIE-WAIT or COOKIE-ECHOED state.  Normal T1-init timer expiration\r
5608    will cause the INIT or COOKIE chunk to be retransmitted and thus\r
5609    start a new association.\r
5610 \r
5611    If a SHUTDOWN is received in COOKIE WAIT or COOKIE ECHOED states the\r
5612    SHUTDOWN chunk SHOULD be silently discarded.\r
5613 \r
5614    If an endpoint is in SHUTDOWN-SENT state and receives a SHUTDOWN\r
5615    chunk from its peer, the endpoint shall respond immediately with a\r
5616    SHUTDOWN ACK to its peer, and move into a SHUTDOWN-ACK-SENT state\r
5617    restarting its T2-shutdown timer.\r
5618 \r
5619    If an endpoint is in the SHUTDOWN-ACK-SENT state and receives a\r
5620    SHUTDOWN ACK, it shall stop the T2-shutdown timer, send a SHUTDOWN\r
5621    COMPLETE chunk to its peer, and remove all record of the association.\r
5622 \r
5623 10. Interface with Upper Layer\r
5624 \r
5625    The Upper Layer Protocols (ULP) shall request for services by passing\r
5626    primitives to SCTP and shall receive notifications from SCTP for\r
5627    various events.\r
5628 \r
5629    The primitives and notifications described in this section should be\r
5630    used as a guideline for implementing SCTP.  The following functional\r
5631    description of ULP interface primitives is shown for illustrative\r
5632    purposes.  Different SCTP implementations may have different ULP\r
5633    interfaces.  However, all SCTPs must provide a certain minimum set of\r
5634    services to guarantee that all SCTP implementations can support the\r
5635    same protocol hierarchy.\r
5636 \r
5637 10.1 ULP-to-SCTP\r
5638 \r
5639    The following sections functionally characterize a ULP/SCTP\r
5640    interface.  The notation used is similar to most procedure or\r
5641    function calls in high level languages.\r
5642 \r
5643    The ULP primitives described below specify the basic functions the\r
5644    SCTP must perform to support inter-process communication.  Individual\r
5645    implementations must define their own exact format, and may provide\r
5646    combinations or subsets of the basic functions in single calls.\r
5647 \r
5648    A) Initialize\r
5649 \r
5650    Format: INITIALIZE ([local port], [local eligible address list]) ->\r
5651    local SCTP instance name\r
5652 \r
5653 \r
5654 \r
5655 \r
5656 \r
5657 \r
5658 Stewart, et al.             Standards Track                   [Page 101]\r
5659 \f\r
5660 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5661 \r
5662 \r
5663    This primitive allows SCTP to initialize its internal data structures\r
5664    and allocate necessary resources for setting up its operation\r
5665    environment.  Once SCTP is initialized, ULP can communicate directly\r
5666    with other endpoints without re-invoking this primitive.\r
5667 \r
5668    SCTP will return a local SCTP instance name to the ULP.\r
5669 \r
5670    Mandatory attributes:\r
5671 \r
5672    None.\r
5673 \r
5674    Optional attributes:\r
5675 \r
5676    The following types of attributes may be passed along with the\r
5677    primitive:\r
5678 \r
5679    o  local port - SCTP port number, if ULP wants it to be specified;\r
5680 \r
5681    o  local eligible address list - An address list that the local SCTP\r
5682       endpoint should bind.  By default, if an address list is not\r
5683       included, all IP addresses assigned to the host should be used by\r
5684       the local endpoint.\r
5685 \r
5686    IMPLEMENTATION NOTE: If this optional attribute is supported by an\r
5687    implementation, it will be the responsibility of the implementation\r
5688    to enforce that the IP source address field of any SCTP packets sent\r
5689    out by this endpoint contains one of the IP addresses indicated in\r
5690    the local eligible address list.\r
5691 \r
5692    B) Associate\r
5693 \r
5694    Format: ASSOCIATE(local SCTP instance name, destination transport addr,\r
5695            outbound stream count)\r
5696    -> association id [,destination transport addr list] [,outbound stream\r
5697       count]\r
5698 \r
5699    This primitive allows the upper layer to initiate an association to a\r
5700    specific peer endpoint.\r
5701 \r
5702    The peer endpoint shall be specified by one of the transport\r
5703    addresses which defines the endpoint (see Section 1.4).  If the local\r
5704    SCTP instance has not been initialized, the ASSOCIATE is considered\r
5705    an error.\r
5706 \r
5707    An association id, which is a local handle to the SCTP association,\r
5708    will be returned on successful establishment of the association.  If\r
5709    SCTP is not able to open an SCTP association with the peer endpoint,\r
5710    an error is returned.\r
5711 \r
5712 \r
5713 \r
5714 Stewart, et al.             Standards Track                   [Page 102]\r
5715 \f\r
5716 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5717 \r
5718 \r
5719    Other association parameters may be returned, including the complete\r
5720    destination transport addresses of the peer as well as the outbound\r
5721    stream count of the local endpoint.  One of the transport address\r
5722    from the returned destination addresses will be selected by the local\r
5723    endpoint as default primary path for sending SCTP packets to this\r
5724    peer.  The returned "destination transport addr list" can be used by\r
5725    the ULP to change the default primary path or to force sending a\r
5726    packet to a specific transport address.\r
5727 \r
5728    IMPLEMENTATION NOTE: If ASSOCIATE primitive is implemented as a\r
5729    blocking function call, the ASSOCIATE primitive can return\r
5730    association parameters in addition to the association id upon\r
5731    successful establishment.  If ASSOCIATE primitive is implemented as a\r
5732    non-blocking call, only the association id shall be returned and\r
5733    association parameters shall be passed using the COMMUNICATION UP\r
5734    notification.\r
5735 \r
5736    Mandatory attributes:\r
5737 \r
5738    o  local SCTP instance name - obtained from the INITIALIZE operation.\r
5739 \r
5740    o  destination transport addr - specified as one of the transport\r
5741       addresses of the peer endpoint with which the association is to be\r
5742       established.\r
5743 \r
5744    o  outbound stream count - the number of outbound streams the ULP\r
5745       would like to open towards this peer endpoint.\r
5746 \r
5747    Optional attributes:\r
5748 \r
5749    None.\r
5750 \r
5751    C) Shutdown\r
5752 \r
5753    Format: SHUTDOWN(association id)\r
5754    -> result\r
5755 \r
5756    Gracefully closes an association.  Any locally queued user data will\r
5757    be delivered to the peer.  The association will be terminated only\r
5758    after the peer acknowledges all the SCTP packets sent.  A success\r
5759    code will be returned on successful termination of the association.\r
5760    If attempting to terminate the association results in a failure, an\r
5761    error code shall be returned.\r
5762 \r
5763    Mandatory attributes:\r
5764 \r
5765    o  association id - local handle to the SCTP association\r
5766 \r
5767 \r
5768 \r
5769 \r
5770 Stewart, et al.             Standards Track                   [Page 103]\r
5771 \f\r
5772 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5773 \r
5774 \r
5775    Optional attributes:\r
5776 \r
5777    None.\r
5778 \r
5779    D) Abort\r
5780 \r
5781    Format: ABORT(association id [, cause code])\r
5782    -> result\r
5783 \r
5784    Ungracefully closes an association.  Any locally queued user data\r
5785    will be discarded and an ABORT chunk is sent to the peer.  A success\r
5786    code will be returned on successful abortion of the association.  If\r
5787    attempting to abort the association results in a failure, an error\r
5788    code shall be returned.\r
5789 \r
5790    Mandatory attributes:\r
5791 \r
5792    o  association id - local handle to the SCTP association\r
5793 \r
5794    Optional attributes:\r
5795 \r
5796    o  cause code - reason of the abort to be passed to the peer.\r
5797 \r
5798    None.\r
5799 \r
5800    E) Send\r
5801 \r
5802    Format: SEND(association id, buffer address, byte count [,context]\r
5803            [,stream id] [,life time] [,destination transport address]\r
5804            [,unorder flag] [,no-bundle flag] [,payload protocol-id] )\r
5805    -> result\r
5806 \r
5807    This is the main method to send user data via SCTP.\r
5808 \r
5809    Mandatory attributes:\r
5810 \r
5811    o  association id - local handle to the SCTP association\r
5812 \r
5813    o  buffer address - the location where the user message to be\r
5814       transmitted is stored;\r
5815 \r
5816    o  byte count - The size of the user data in number of bytes;\r
5817 \r
5818    Optional attributes:\r
5819 \r
5820    o  context - an optional 32 bit integer that will be carried in the\r
5821       sending failure notification to the ULP if the transportation of\r
5822       this User Message fails.\r
5823 \r
5824 \r
5825 \r
5826 Stewart, et al.             Standards Track                   [Page 104]\r
5827 \f\r
5828 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5829 \r
5830 \r
5831    o  stream id - to indicate which stream to send the data on.  If not\r
5832       specified, stream 0 will be used.\r
5833 \r
5834    o  life time - specifies the life time of the user data.  The user\r
5835       data will not be sent by SCTP after the life time expires.  This\r
5836       parameter can be used to avoid efforts to transmit stale user\r
5837       messages.  SCTP notifies the ULP if the data cannot be initiated\r
5838       to transport (i.e. sent to the destination via SCTP's send\r
5839       primitive) within the life time variable.  However, the user data\r
5840       will be transmitted if SCTP has attempted to transmit a chunk\r
5841       before the life time expired.\r
5842 \r
5843    IMPLEMENTATION NOTE: In order to better support the data lifetime\r
5844    option, the transmitter may hold back the assigning of the TSN number\r
5845    to an outbound DATA chunk to the last moment.  And, for\r
5846    implementation simplicity, once a TSN number has been assigned the\r
5847    sender should consider the send of this DATA chunk as committed,\r
5848    overriding any lifetime option attached to the DATA chunk.\r
5849 \r
5850    o  destination transport address - specified as one of the\r
5851       destination transport addresses of the peer endpoint to which this\r
5852       packet should be sent.  Whenever possible, SCTP should use this\r
5853       destination transport address for sending the packets, instead of\r
5854       the current primary path.\r
5855 \r
5856    o  unorder flag - this flag, if present, indicates that the user\r
5857       would like the data delivered in an unordered fashion to the peer\r
5858       (i.e., the U flag is set to 1 on all DATA chunks carrying this\r
5859       message).\r
5860 \r
5861    o  no-bundle flag - instructs SCTP not to bundle this user data with\r
5862       other outbound DATA chunks.  SCTP MAY still bundle even when this\r
5863       flag is present, when faced with network congestion.\r
5864 \r
5865    o  payload protocol-id - A 32 bit unsigned integer that is to be\r
5866       passed to the peer indicating the type of payload protocol data\r
5867       being transmitted.  This value is passed as opaque data by SCTP.\r
5868 \r
5869    F) Set Primary\r
5870 \r
5871    Format: SETPRIMARY(association id, destination transport address,\r
5872                       [source transport address] )\r
5873    -> result\r
5874 \r
5875    Instructs the local SCTP to use the specified destination transport\r
5876    address as primary path for sending packets.\r
5877 \r
5878 \r
5879 \r
5880 \r
5881 \r
5882 Stewart, et al.             Standards Track                   [Page 105]\r
5883 \f\r
5884 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5885 \r
5886 \r
5887    The result of attempting this operation shall be returned.  If the\r
5888    specified destination transport address is not present in the\r
5889    "destination transport address list" returned earlier in an associate\r
5890    command or communication up notification, an error shall be returned.\r
5891 \r
5892    Mandatory attributes:\r
5893 \r
5894    o  association id - local handle to the SCTP association\r
5895 \r
5896    o  destination transport address - specified as one of the transport\r
5897       addresses of the peer endpoint, which should be used as primary\r
5898       address for sending packets.  This overrides the current primary\r
5899       address information maintained by the local SCTP endpoint.\r
5900 \r
5901    Optional attributes:\r
5902 \r
5903    o  source transport address - optionally, some implementations may\r
5904       allow you to set the default source address placed in all outgoing\r
5905       IP datagrams.\r
5906 \r
5907    G) Receive\r
5908 \r
5909    Format: RECEIVE(association id, buffer address, buffer size\r
5910            [,stream id])\r
5911    -> byte count [,transport address] [,stream id] [,stream sequence\r
5912       number] [,partial flag] [,delivery number] [,payload protocol-id]\r
5913 \r
5914    This primitive shall read the first user message in the SCTP in-queue\r
5915    into the buffer specified by ULP, if there is one available.  The\r
5916    size of the message read, in bytes, will be returned.  It may,\r
5917    depending on the specific implementation, also return other\r
5918    information such as the sender's address, the stream id on which it\r
5919    is received, whether there are more messages available for retrieval,\r
5920    etc.  For ordered messages, their stream sequence number may also be\r
5921    returned.\r
5922 \r
5923    Depending upon the implementation, if this primitive is invoked when\r
5924    no message is available the implementation should return an\r
5925    indication of this condition or should block the invoking process\r
5926    until data does become available.\r
5927 \r
5928    Mandatory attributes:\r
5929 \r
5930    o  association id - local handle to the SCTP association\r
5931 \r
5932    o  buffer address - the memory location indicated by the ULP to store\r
5933       the received message.\r
5934 \r
5935 \r
5936 \r
5937 \r
5938 Stewart, et al.             Standards Track                   [Page 106]\r
5939 \f\r
5940 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5941 \r
5942 \r
5943    o  buffer size - the maximum size of data to be received, in bytes.\r
5944 \r
5945    Optional attributes:\r
5946 \r
5947    o  stream id - to indicate which stream to receive the data on.\r
5948 \r
5949    o  stream sequence number - the stream sequence number assigned by\r
5950       the sending SCTP peer.\r
5951 \r
5952    o  partial flag - if this returned flag is set to 1, then this\r
5953       Receive contains  a partial delivery of the whole message.  When\r
5954       this flag is set, the stream id and stream sequence number MUST\r
5955       accompany this receive.  When this flag is set to 0, it indicates\r
5956       that no more deliveries will be received for this stream sequence\r
5957       number.\r
5958 \r
5959    o  payload protocol-id - A 32 bit unsigned integer that is received\r
5960       from the peer indicating the type of payload protocol of the\r
5961       received data.  This value is passed as opaque data by SCTP.\r
5962 \r
5963    H) Status\r
5964 \r
5965    Format: STATUS(association id)\r
5966    -> status data\r
5967 \r
5968    This primitive should return a data block containing the following\r
5969    information:\r
5970      association connection state,\r
5971      destination transport address list,\r
5972      destination transport address reachability states,\r
5973      current receiver window size,\r
5974      current congestion window sizes,\r
5975      number of  unacknowledged DATA chunks,\r
5976      number of DATA chunks pending receipt,\r
5977      primary path,\r
5978      most recent SRTT on primary path,\r
5979      RTO on primary path,\r
5980      SRTT and RTO on other destination addresses, etc.\r
5981 \r
5982    Mandatory attributes:\r
5983 \r
5984    o association id - local handle to the SCTP association\r
5985 \r
5986    Optional attributes:\r
5987 \r
5988     None.\r
5989 \r
5990 \r
5991 \r
5992 \r
5993 \r
5994 Stewart, et al.             Standards Track                   [Page 107]\r
5995 \f\r
5996 RFC 2960          Stream Control Transmission Protocol      October 2000\r
5997 \r
5998 \r
5999    I) Change Heartbeat\r
6000 \r
6001    Format: CHANGEHEARTBEAT(association id, destination transport address,\r
6002            new state [,interval])\r
6003    -> result\r
6004 \r
6005    Instructs the local endpoint to enable or disable heartbeat on the\r
6006    specified destination transport address.\r
6007 \r
6008    The result of attempting this operation shall be returned.\r
6009 \r
6010    Note: Even when enabled, heartbeat will not take place if the\r
6011    destination transport address is not idle.\r
6012 \r
6013    Mandatory attributes:\r
6014 \r
6015    o  association id - local handle to the SCTP association\r
6016 \r
6017    o  destination transport address - specified as one of the transport\r
6018       addresses of the peer endpoint.\r
6019 \r
6020    o  new state - the new state of heartbeat for this destination\r
6021       transport address (either enabled or disabled).\r
6022 \r
6023    Optional attributes:\r
6024 \r
6025    o  interval - if present, indicates the frequency of the heartbeat if\r
6026       this is to enable heartbeat on a destination transport address.\r
6027       This value is added to the RTO of the destination transport\r
6028       address. This value, if present, effects all destinations.\r
6029 \r
6030    J) Request HeartBeat\r
6031 \r
6032    Format: REQUESTHEARTBEAT(association id, destination transport\r
6033            address)\r
6034    -> result\r
6035 \r
6036    Instructs the local endpoint to perform a HeartBeat on the specified\r
6037    destination transport address of the given association.  The returned\r
6038    result should indicate whether the transmission of the HEARTBEAT\r
6039    chunk to the destination address is successful.\r
6040 \r
6041    Mandatory attributes:\r
6042 \r
6043    o  association id - local handle to the SCTP association\r
6044 \r
6045    o  destination transport address - the transport address of the\r
6046       association on which a heartbeat should be issued.\r
6047 \r
6048 \r
6049 \r
6050 Stewart, et al.             Standards Track                   [Page 108]\r
6051 \f\r
6052 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6053 \r
6054 \r
6055    K) Get SRTT Report\r
6056 \r
6057    Format: GETSRTTREPORT(association id, destination transport address)\r
6058    -> srtt result\r
6059 \r
6060    Instructs the local SCTP to report the current SRTT measurement on\r
6061    the specified destination transport address of the given association.\r
6062    The returned result can be an integer containing the most recent SRTT\r
6063    in milliseconds.\r
6064 \r
6065    Mandatory attributes:\r
6066 \r
6067    o  association id - local handle to the SCTP association\r
6068 \r
6069    o  destination transport address - the transport address of the\r
6070       association on which the SRTT measurement is to be reported.\r
6071 \r
6072    L) Set Failure Threshold\r
6073 \r
6074    Format: SETFAILURETHRESHOLD(association id, destination transport\r
6075            address, failure threshold)\r
6076    -> result\r
6077 \r
6078    This primitive allows the local SCTP to customize the reachability\r
6079    failure detection threshold 'Path.Max.Retrans' for the specified\r
6080    destination address.\r
6081 \r
6082    Mandatory attributes:\r
6083 \r
6084    o  association id - local handle to the SCTP association\r
6085 \r
6086    o  destination transport address - the transport address of the\r
6087       association on which the failure detection threshold is to be set.\r
6088 \r
6089    o  failure threshold - the new value of 'Path.Max.Retrans' for the\r
6090       destination address.\r
6091 \r
6092    M) Set Protocol Parameters\r
6093 \r
6094    Format: SETPROTOCOLPARAMETERS(association id, [,destination transport\r
6095            address,] protocol parameter list)\r
6096    -> result\r
6097 \r
6098    This primitive allows the local SCTP to customize the protocol\r
6099    parameters.\r
6100 \r
6101 \r
6102 \r
6103 \r
6104 \r
6105 \r
6106 Stewart, et al.             Standards Track                   [Page 109]\r
6107 \f\r
6108 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6109 \r
6110 \r
6111    Mandatory attributes:\r
6112 \r
6113    o  association id - local handle to the SCTP association\r
6114 \r
6115    o  protocol parameter list - The specific names and values of the\r
6116       protocol parameters (e.g., Association.Max.Retrans [see Section\r
6117       14]) that the SCTP user wishes to customize.\r
6118 \r
6119    Optional attributes:\r
6120 \r
6121    o  destination transport address - some of the protocol parameters\r
6122       may be set on a per destination transport address basis.\r
6123 \r
6124    N) Receive unsent message\r
6125 \r
6126    Format: RECEIVE_UNSENT(data retrieval id, buffer address, buffer size\r
6127            [,stream id] [, stream sequence number] [,partial flag]\r
6128            [,payload protocol-id])\r
6129 \r
6130    o  data retrieval id - The identification passed to the ULP in the\r
6131       failure notification.\r
6132 \r
6133    o  buffer address - the memory location indicated by the ULP to store\r
6134       the received message.\r
6135 \r
6136    o  buffer size - the maximum size of data to be received, in bytes.\r
6137 \r
6138    Optional attributes:\r
6139 \r
6140    o  stream id - this is a return value that is set to  indicate\r
6141       which stream the data was sent to.\r
6142 \r
6143    o  stream sequence number - this value is returned indicating\r
6144       the stream sequence number that was associated with the message.\r
6145 \r
6146    o  partial flag - if this returned flag is set to 1, then this\r
6147       message is a partial delivery of the whole message.  When\r
6148       this flag is set, the stream id and stream sequence number MUST\r
6149       accompany this receive.  When this flag is set to 0, it indicates\r
6150       that no more deliveries will be received for this stream sequence\r
6151       number.\r
6152 \r
6153    o  payload protocol-id - The 32 bit unsigned integer that was sent to\r
6154       be sent to the peer indicating the type of payload protocol of the\r
6155       received data.\r
6156 \r
6157 \r
6158 \r
6159 \r
6160 \r
6161 \r
6162 Stewart, et al.             Standards Track                   [Page 110]\r
6163 \f\r
6164 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6165 \r
6166 \r
6167    O)  Receive unacknowledged message\r
6168 \r
6169    Format: RECEIVE_UNACKED(data retrieval id, buffer address, buffer size,\r
6170            [,stream id] [, stream sequence number] [,partial flag]\r
6171            [,payload protocol-id])\r
6172 \r
6173    o  data retrieval id - The identification passed to the ULP in the\r
6174       failure notification.\r
6175 \r
6176    o  buffer address - the memory location indicated by the ULP to store\r
6177       the received message.\r
6178 \r
6179    o  buffer size - the maximum size of data to be received, in bytes.\r
6180 \r
6181    Optional attributes:\r
6182 \r
6183    o  stream id - this is a return value that is set to  indicate which\r
6184       stream the data was sent to.\r
6185 \r
6186    o  stream sequence number - this value is returned indicating the\r
6187       stream sequence number that was associated with the message.\r
6188 \r
6189    o  partial flag - if this returned flag is set to 1, then this\r
6190       message is a partial delivery of the whole message.  When this\r
6191       flag is set, the stream id and stream sequence number MUST\r
6192       accompany this receive.  When this flag is set to 0, it indicates\r
6193       that no more deliveries will be received for this stream sequence\r
6194       number.\r
6195 \r
6196    o  payload protocol-id - The 32 bit unsigned integer that was sent to\r
6197       be sent to the peer indicating the type of payload protocol of the\r
6198       received data.\r
6199 \r
6200    P) Destroy SCTP instance\r
6201 \r
6202    Format: DESTROY(local SCTP instance name)\r
6203 \r
6204    o  local SCTP instance name - this is the value that was passed to\r
6205       the application in the initialize primitive and it indicates which\r
6206       SCTP instance to be destroyed.\r
6207 \r
6208 10.2 SCTP-to-ULP\r
6209 \r
6210    It is assumed that the operating system or application environment\r
6211    provides a means for the SCTP to asynchronously signal the ULP\r
6212    process.  When SCTP does signal an ULP process, certain information\r
6213    is passed to the ULP.\r
6214 \r
6215 \r
6216 \r
6217 \r
6218 Stewart, et al.             Standards Track                   [Page 111]\r
6219 \f\r
6220 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6221 \r
6222 \r
6223    IMPLEMENTATION NOTE: In some cases this may be done through a\r
6224    separate socket or error channel.\r
6225 \r
6226    A) DATA ARRIVE notification\r
6227 \r
6228    SCTP shall invoke this notification on the ULP when a user message is\r
6229    successfully received and ready for retrieval.\r
6230 \r
6231    The following may be optionally be passed with the notification:\r
6232 \r
6233    o  association id - local handle to the SCTP association\r
6234 \r
6235    o  stream id - to indicate which stream the data is received on.\r
6236 \r
6237    B) SEND FAILURE notification\r
6238 \r
6239    If a message can not be delivered SCTP shall invoke this notification\r
6240    on the ULP.\r
6241 \r
6242    The following may be optionally be passed with the notification:\r
6243 \r
6244    o  association id - local handle to the SCTP association\r
6245 \r
6246    o  data retrieval id - an identification used to retrieve unsent and\r
6247       unacknowledged data.\r
6248 \r
6249    o  cause code - indicating the reason of the failure, e.g., size too\r
6250       large, message life-time expiration, etc.\r
6251 \r
6252    o  context - optional information associated with this message (see D\r
6253       in Section 10.1).\r
6254 \r
6255    C) NETWORK STATUS CHANGE notification\r
6256 \r
6257    When a destination transport address is marked inactive (e.g., when\r
6258    SCTP detects a failure), or marked active (e.g., when SCTP detects a\r
6259    recovery), SCTP shall invoke this notification on the ULP.\r
6260 \r
6261    The following shall be passed with the notification:\r
6262 \r
6263    o  association id - local handle to the SCTP association\r
6264 \r
6265    o  destination transport address - This indicates the destination\r
6266       transport address of the peer endpoint affected by the change;\r
6267 \r
6268    o  new-status - This indicates the new status.\r
6269 \r
6270 \r
6271 \r
6272 \r
6273 \r
6274 Stewart, et al.             Standards Track                   [Page 112]\r
6275 \f\r
6276 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6277 \r
6278 \r
6279    D) COMMUNICATION UP notification\r
6280 \r
6281    This notification is used when SCTP becomes ready to send or receive\r
6282    user messages, or when a lost communication to an endpoint is\r
6283    restored.\r
6284 \r
6285    IMPLEMENTATION NOTE: If ASSOCIATE primitive is implemented as a\r
6286    blocking function call, the association parameters are returned as a\r
6287    result of the ASSOCIATE primitive itself.  In that case,\r
6288    COMMUNICATION UP notification is optional at the association\r
6289    initiator's side.\r
6290 \r
6291    The following shall be passed with the notification:\r
6292 \r
6293    o  association id - local handle to the SCTP association\r
6294 \r
6295    o  status - This indicates what type of event has occurred\r
6296 \r
6297    o  destination transport address list - the complete set of transport\r
6298       addresses of the peer\r
6299 \r
6300    o  outbound stream count - the maximum number of streams allowed to\r
6301       be used in this association by the ULP\r
6302 \r
6303    o  inbound stream count - the number of streams the peer endpoint has\r
6304       requested with this association (this may not be the same number\r
6305       as 'outbound stream count').\r
6306 \r
6307    E) COMMUNICATION LOST notification\r
6308 \r
6309    When SCTP loses communication to an endpoint completely (e.g., via\r
6310    Heartbeats) or detects that the endpoint has performed an abort\r
6311    operation, it shall invoke this notification on the ULP.\r
6312 \r
6313    The following shall be passed with the notification:\r
6314 \r
6315    o  association id - local handle to the SCTP association\r
6316 \r
6317    o status - This indicates what type of event has occurred; The status\r
6318               may indicate a failure OR a normal termination event\r
6319               occurred in response to a shutdown or abort request.\r
6320 \r
6321    The following may be passed with the notification:\r
6322 \r
6323    o  data retrieval id - an identification used to retrieve unsent and\r
6324       unacknowledged data.\r
6325 \r
6326    o  last-acked - the TSN last acked by that peer endpoint;\r
6327 \r
6328 \r
6329 \r
6330 Stewart, et al.             Standards Track                   [Page 113]\r
6331 \f\r
6332 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6333 \r
6334 \r
6335    o  last-sent - the TSN last sent to that peer endpoint;\r
6336 \r
6337    F) COMMUNICATION ERROR notification\r
6338 \r
6339    When SCTP receives an ERROR chunk from its peer and decides to notify\r
6340    its ULP, it can invoke this notification on the ULP.\r
6341 \r
6342    The following can be passed with the notification:\r
6343 \r
6344    o  association id - local handle to the SCTP association\r
6345 \r
6346    o  error info - this indicates the type of error and optionally some\r
6347       additional information received through the ERROR chunk.\r
6348 \r
6349    G) RESTART notification\r
6350 \r
6351    When SCTP detects that the peer has restarted, it may send this\r
6352    notification to its ULP.\r
6353 \r
6354    The following can be passed with the notification:\r
6355 \r
6356    o  association id - local handle to the SCTP association\r
6357 \r
6358    H) SHUTDOWN COMPLETE notification\r
6359 \r
6360    When SCTP completes the shutdown procedures (section 9.2) this\r
6361    notification is passed to the upper layer.\r
6362 \r
6363    The following can be passed with the notification:\r
6364 \r
6365    o  association id - local handle to the SCTP association\r
6366 \r
6367 11. Security Considerations\r
6368 \r
6369 11.1 Security Objectives\r
6370 \r
6371    As a common transport protocol designed to reliably carry time-\r
6372    sensitive user messages, such as billing or signaling messages for\r
6373    telephony services, between two networked endpoints, SCTP has the\r
6374    following security objectives.\r
6375 \r
6376    -  availability of reliable and timely data transport services\r
6377    -  integrity of the user-to-user information carried by SCTP\r
6378 \r
6379 \r
6380 \r
6381 \r
6382 \r
6383 \r
6384 \r
6385 \r
6386 Stewart, et al.             Standards Track                   [Page 114]\r
6387 \f\r
6388 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6389 \r
6390 \r
6391 11.2 SCTP Responses To Potential Threats\r
6392 \r
6393    SCTP may potentially be used in a wide variety of risk situations.\r
6394    It is important for operator(s) of systems running SCTP to analyze\r
6395    their particular situations and decide on the appropriate counter-\r
6396    measures.\r
6397 \r
6398    Operators of systems running SCTP should consult [RFC2196] for\r
6399    guidance in securing their site.\r
6400 \r
6401 11.2.1 Countering Insider Attacks\r
6402 \r
6403    The principles of [RFC2196] should be applied to minimize the risk of\r
6404    theft of information or sabotage by insiders.  Such procedures\r
6405    include publication of security policies, control of access at the\r
6406    physical, software, and network levels, and separation of services.\r
6407 \r
6408 11.2.2 Protecting against Data Corruption in the Network\r
6409 \r
6410    Where the risk of undetected errors in datagrams delivered by the\r
6411    lower layer transport services is considered to be too great,\r
6412    additional integrity protection is required.  If this additional\r
6413    protection were provided in the application-layer, the SCTP header\r
6414    would remain vulnerable to deliberate integrity attacks.  While the\r
6415    existing SCTP mechanisms for detection of packet replays are\r
6416    considered sufficient for normal operation, stronger protections are\r
6417    needed to protect SCTP when the operating environment contains\r
6418    significant risk of deliberate attacks from a sophisticated\r
6419    adversary.\r
6420 \r
6421    In order to promote software code-reuse, to avoid re-inventing the\r
6422    wheel, and to avoid gratuitous complexity to SCTP, the IP\r
6423    Authentication Header [RFC2402] SHOULD be used when the threat\r
6424    environment requires stronger integrity protections, but does not\r
6425    require confidentiality.\r
6426 \r
6427    A widely implemented BSD Sockets API extension exists for\r
6428    applications to request IP security services, such as AH or ESP from\r
6429    an operating system kernel.  Applications can use such an API to\r
6430    request AH whenever AH use is appropriate.\r
6431 \r
6432 11.2.3 Protecting Confidentiality\r
6433 \r
6434    In most cases, the risk of breach of confidentiality applies to the\r
6435    signaling data payload, not to the SCTP or lower-layer protocol\r
6436    overheads.  If that is true, encryption of the SCTP user data only\r
6437    might be considered.  As with the supplementary checksum service,\r
6438    user data encryption MAY be performed by the SCTP user application.\r
6439 \r
6440 \r
6441 \r
6442 Stewart, et al.             Standards Track                   [Page 115]\r
6443 \f\r
6444 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6445 \r
6446 \r
6447    Alternately, the user application MAY use an implementation-specific\r
6448    API to request that the IP Encapsulating Security Payload (ESP)\r
6449    [RFC2406] be used to provide confidentiality and integrity.\r
6450 \r
6451    Particularly for mobile users, the requirement for confidentiality\r
6452    might include the masking of IP addresses and ports.  In this case\r
6453    ESP SHOULD be used instead of application-level confidentiality.  If\r
6454    ESP is used to protect confidentiality of SCTP traffic, an ESP\r
6455    cryptographic transform that includes cryptographic integrity\r
6456    protection MUST be used, because if there is a confidentiality threat\r
6457    there will also be a strong integrity threat.\r
6458 \r
6459    Whenever ESP is in use, application-level encryption is not generally\r
6460    required.\r
6461 \r
6462    Regardless of where confidentiality is provided, the ISAKMP [RFC2408]\r
6463    and the Internet Key Exchange (IKE) [RFC2409] SHOULD be used for key\r
6464    management.\r
6465 \r
6466    Operators should consult [RFC2401] for more information on the\r
6467    security services available at and immediately above the Internet\r
6468    Protocol layer.\r
6469 \r
6470 11.2.4 Protecting against Blind Denial of Service Attacks\r
6471 \r
6472    A blind attack is one where the attacker is unable to intercept or\r
6473    otherwise see the content of data flows passing to and from the\r
6474    target SCTP node.  Blind denial of service attacks may take the form\r
6475    of flooding, masquerade, or improper monopolization of services.\r
6476 \r
6477 11.2.4.1 Flooding\r
6478 \r
6479    The objective of flooding is to cause loss of service and incorrect\r
6480    behavior at target systems through resource exhaustion, interference\r
6481    with legitimate transactions, and exploitation of buffer-related\r
6482    software bugs.  Flooding may be directed either at the SCTP node or\r
6483    at resources in the intervening IP Access Links or the Internet.\r
6484    Where the latter entities are the target, flooding will manifest\r
6485    itself as loss of network services, including potentially the breach\r
6486    of any firewalls in place.\r
6487 \r
6488    In general, protection against flooding begins at the equipment\r
6489    design level, where it includes measures such as:\r
6490 \r
6491    -  avoiding commitment of limited resources before determining that\r
6492       the request for service is legitimate\r
6493 \r
6494 \r
6495 \r
6496 \r
6497 \r
6498 Stewart, et al.             Standards Track                   [Page 116]\r
6499 \f\r
6500 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6501 \r
6502 \r
6503    -  giving priority to completion of processing in progress over the\r
6504       acceptance of new work\r
6505 \r
6506    -  identification and removal of duplicate or stale queued requests\r
6507       for service.\r
6508 \r
6509    -  not responding to unexpected packets sent to non-unicast\r
6510       addresses.\r
6511 \r
6512    Network equipment should be capable of generating an alarm and log if\r
6513    a suspicious increase in traffic occurs.  The log should provide\r
6514    information such as the identity of the incoming link and source\r
6515    address(es) used which will help the network or SCTP system operator\r
6516    to take protective measures.  Procedures should be in place for the\r
6517    operator to act on such alarms if a clear pattern of abuse emerges.\r
6518 \r
6519    The design of SCTP is resistant to flooding attacks, particularly in\r
6520    its use of a four-way start-up handshake, its use of a cookie to\r
6521    defer commitment of resources at the responding SCTP node until the\r
6522    handshake is completed, and its use of a Verification Tag to prevent\r
6523    insertion of extraneous packets into the flow of an established\r
6524    association.\r
6525 \r
6526    The IP Authentication Header and Encapsulating Security Payload might\r
6527    be useful in reducing the risk of certain kinds of denial of service\r
6528    attacks."\r
6529 \r
6530    The use of the Host Name feature in the INIT chunk could be used to\r
6531    flood a target DNS server.  A large backlog of DNS queries, resolving\r
6532    the Host Name received in the INIT chunk to IP addresses, could be\r
6533    accomplished by sending INIT's to multiple hosts in a given domain.\r
6534    In addition, an attacker could use the Host Name feature in an\r
6535    indirect attack on a third party by sending large numbers of INITs to\r
6536    random hosts containing the host name of the target.  In addition to\r
6537    the strain on DNS resources, this could also result in large numbers\r
6538    of INIT ACKs being sent to the target.  One method to protect against\r
6539    this type of attack is to verify that the IP addresses received from\r
6540    DNS include the source IP address of the original INIT.  If the list\r
6541    of IP addresses received from DNS does not include the source IP\r
6542    address of the INIT, the endpoint MAY silently discard the INIT.\r
6543    This last option will not protect against the attack against the DNS.\r
6544 \r
6545 \r
6546 \r
6547 \r
6548 \r
6549 \r
6550 \r
6551 \r
6552 \r
6553 \r
6554 Stewart, et al.             Standards Track                   [Page 117]\r
6555 \f\r
6556 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6557 \r
6558 \r
6559 11.2.4.2 Blind Masquerade\r
6560 \r
6561    Masquerade can be used to deny service in several ways:\r
6562 \r
6563    -  by tying up resources at the target SCTP node to which the\r
6564       impersonated node has limited access.  For example, the target\r
6565       node may by policy permit a maximum of one SCTP association with\r
6566       the impersonated SCTP node.  The masquerading attacker may attempt\r
6567       to establish an association purporting to come from the\r
6568       impersonated node so that the latter cannot do so when it requires\r
6569       it.\r
6570 \r
6571    -  by deliberately allowing the impersonation to be detected, thereby\r
6572       provoking counter-measures which cause the impersonated node to be\r
6573       locked out of the target SCTP node.\r
6574 \r
6575    -  by interfering with an established association by inserting\r
6576       extraneous content such as a SHUTDOWN request.\r
6577 \r
6578    SCTP reduces the risk of blind masquerade attacks through IP spoofing\r
6579    by use of the four-way startup handshake.  Man-in-the-middle\r
6580    masquerade attacks are discussed in Section 11.3 below.  Because the\r
6581    initial exchange is memoryless, no lockout mechanism is triggered by\r
6582    blind masquerade attacks.  In addition, the INIT ACK containing the\r
6583    State Cookie is transmitted back to the IP address from which it\r
6584    received the INIT.  Thus the attacker would not receive the INIT ACK\r
6585    containing the State Cookie.  SCTP protects against insertion of\r
6586    extraneous packets into the flow of an established association by use\r
6587    of the Verification Tag.\r
6588 \r
6589    Logging of received INIT requests and abnormalities such as\r
6590    unexpected INIT ACKs might be considered as a way to detect patterns\r
6591    of hostile activity.  However, the potential usefulness of such\r
6592    logging must be weighed against the increased SCTP startup processing\r
6593    it implies, rendering the SCTP node more vulnerable to flooding\r
6594    attacks.  Logging is pointless without the establishment of operating\r
6595    procedures to review and analyze the logs on a routine basis.\r
6596 \r
6597 11.2.4.3 Improper Monopolization of Services\r
6598 \r
6599    Attacks under this heading are performed openly and legitimately by\r
6600    the attacker.  They are directed against fellow users of the target\r
6601    SCTP node or of the shared resources between the attacker and the\r
6602    target node.  Possible attacks include the opening of a large number\r
6603    of associations between the attacker's node and the target, or\r
6604    transfer of large volumes of information within a legitimately-\r
6605    established association.\r
6606 \r
6607 \r
6608 \r
6609 \r
6610 Stewart, et al.             Standards Track                   [Page 118]\r
6611 \f\r
6612 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6613 \r
6614 \r
6615    Policy limits should be placed on the number of associations per\r
6616    adjoining SCTP node.  SCTP user applications should be capable of\r
6617    detecting large volumes of illegitimate or "no-op" messages within a\r
6618    given association and either logging or terminating the association\r
6619    as a result, based on local policy.\r
6620 \r
6621 11.3 Protection against Fraud and Repudiation\r
6622 \r
6623    The objective of fraud is to obtain services without authorization\r
6624    and specifically without paying for them.  In order to achieve this\r
6625    objective, the attacker must induce the SCTP user application at the\r
6626    target SCTP node to provide the desired service while accepting\r
6627    invalid billing data or failing to collect it.  Repudiation is a\r
6628    related problem, since it may occur as a deliberate act of fraud or\r
6629    simply because the repudiating party kept inadequate records of\r
6630    service received.\r
6631 \r
6632    Potential fraudulent attacks include interception and misuse of\r
6633    authorizing information such as credit card numbers, blind masquerade\r
6634    and replay, and man-in-the middle attacks which modify the packets\r
6635    passing through a target SCTP association in real time.\r
6636 \r
6637    The interception attack is countered by the confidentiality measures\r
6638    discussed in Section 11.2.3 above.\r
6639 \r
6640    Section 11.2.4.2 describes how SCTP is resistant to blind masquerade\r
6641    attacks, as a result of the four-way startup handshake and the\r
6642    Verification Tag.  The Verification Tag and TSN together are\r
6643    protections against blind replay attacks, where the replay is into an\r
6644    existing association.\r
6645 \r
6646    However, SCTP does not protect against man-in-the-middle attacks\r
6647    where the attacker is able to intercept and alter the packets sent\r
6648    and received in an association.  For example, the INIT ACK will have\r
6649    sufficient information sent on the wire for an adversary in the\r
6650    middle to hijack an existing SCTP association.  Where a significant\r
6651    possibility of such attacks is seen to exist, or where possible\r
6652    repudiation is an issue, the use of the IPSEC AH service is\r
6653    recommended to ensure both the integrity and the authenticity of the\r
6654    SCTP packets passed.\r
6655 \r
6656    SCTP also provides no protection against attacks originating at or\r
6657    beyond the SCTP node and taking place within the context of an\r
6658    existing association.  Prevention of such attacks should be covered\r
6659    by appropriate security policies at the host site, as discussed in\r
6660    Section 11.2.1.\r
6661 \r
6662 \r
6663 \r
6664 \r
6665 \r
6666 Stewart, et al.             Standards Track                   [Page 119]\r
6667 \f\r
6668 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6669 \r
6670 \r
6671 12. Recommended Transmission Control Block (TCB) Parameters\r
6672 \r
6673    This section details a recommended set of parameters that should be\r
6674    contained within the TCB for an implementation.  This section is for\r
6675    illustrative purposes and should not be deemed as requirements on an\r
6676    implementation or as an exhaustive list of all parameters inside an\r
6677    SCTP TCB.  Each implementation may need its own additional parameters\r
6678    for optimization.\r
6679 \r
6680 12.1 Parameters necessary for the SCTP instance\r
6681 \r
6682    Associations: A list of current associations and mappings to the data\r
6683                  consumers for each association.  This may be in the\r
6684                  form of a hash table or other implementation dependent\r
6685                  structure.  The data consumers may be process\r
6686                  identification information such as file descriptors,\r
6687                  named pipe pointer, or table pointers dependent on how\r
6688                  SCTP is implemented.\r
6689 \r
6690    Secret Key:   A secret key used by this endpoint to compute the MAC.\r
6691                  This SHOULD be a cryptographic quality random number\r
6692                  with a sufficient length.  Discussion in [RFC1750] can\r
6693                  be helpful in selection of the key.\r
6694 \r
6695    Address List: The list of IP addresses that this instance has bound.\r
6696                  This information is passed to one's peer(s) in INIT and\r
6697                  INIT ACK chunks.\r
6698 \r
6699    SCTP Port:    The local SCTP port number the endpoint is bound to.\r
6700 \r
6701 12.2 Parameters necessary per association (i.e. the TCB)\r
6702 \r
6703    Peer        : Tag value to be sent in every packet and is received\r
6704    Verification: in the INIT or INIT ACK chunk.\r
6705    Tag         :\r
6706 \r
6707    My          : Tag expected in every inbound packet and sent in the\r
6708    Verification: INIT or INIT ACK chunk.\r
6709    Tag         :\r
6710 \r
6711    State       : A state variable indicating what state the association\r
6712                : is in, i.e. COOKIE-WAIT, COOKIE-ECHOED, ESTABLISHED,\r
6713                : SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED,\r
6714                : SHUTDOWN-ACK-SENT.\r
6715 \r
6716                  Note: No "CLOSED" state is illustrated since if a\r
6717                  association is "CLOSED" its TCB SHOULD be removed.\r
6718 \r
6719 \r
6720 \r
6721 \r
6722 Stewart, et al.             Standards Track                   [Page 120]\r
6723 \f\r
6724 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6725 \r
6726 \r
6727    Peer        : A list of SCTP transport addresses that the peer is\r
6728    Transport   : bound to.  This information is derived from the INIT or\r
6729    Address     : INIT ACK and is used to associate an inbound packet\r
6730    List        : with a given association.  Normally this information is\r
6731                : hashed or keyed for quick lookup and access of the TCB.\r
6732 \r
6733    Primary     : This is the current primary destination transport\r
6734    Path        : address of the peer endpoint.  It may also specify a\r
6735                : source transport address on this endpoint.\r
6736 \r
6737    Overall     : The overall association error count.\r
6738    Error Count :\r
6739 \r
6740    Overall     : The threshold for this association that if the Overall\r
6741    Error       : Error Count reaches will cause this association to be\r
6742    Threshold   : torn down.\r
6743 \r
6744    Peer Rwnd   : Current calculated value of the peer's rwnd.\r
6745 \r
6746    Next TSN    : The next TSN number to be assigned to a new DATA chunk.\r
6747                : This is sent in the INIT or INIT ACK chunk to the peer\r
6748                : and incremented each time a DATA chunk is assigned a\r
6749                : TSN (normally just prior to transmit or during\r
6750                : fragmentation).\r
6751 \r
6752    Last Rcvd   : This is the last TSN received in sequence.  This value\r
6753    TSN         : is set initially by taking the peer's Initial TSN,\r
6754                : received in the INIT or INIT ACK chunk, and\r
6755                : subtracting one from it.\r
6756 \r
6757    Mapping     : An array of bits or bytes indicating which out of\r
6758    Array       : order TSN's have been received (relative to the\r
6759                : Last Rcvd TSN).  If no gaps exist, i.e. no out of order\r
6760                : packets have been received, this array will be set to\r
6761                : all zero.  This structure may be in the form of a\r
6762                : circular buffer or bit array.\r
6763 \r
6764    Ack State   : This flag indicates if the next received packet\r
6765                : is to be responded to with a SACK.  This is initialized\r
6766                : to 0.  When a packet is received it is incremented.\r
6767                : If this value reaches 2 or more, a SACK is sent and the\r
6768                : value is reset to 0.  Note: This is used only when no\r
6769                : DATA chunks are received out of order.  When DATA chunks\r
6770                : are out of order, SACK's are not delayed (see Section\r
6771                : 6).\r
6772 \r
6773 \r
6774 \r
6775 \r
6776 \r
6777 \r
6778 Stewart, et al.             Standards Track                   [Page 121]\r
6779 \f\r
6780 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6781 \r
6782 \r
6783    Inbound     : An array of structures to track the inbound streams.\r
6784    Streams     : Normally including the next sequence number expected\r
6785                : and possibly the stream number.\r
6786 \r
6787    Outbound    : An array of structures to track the outbound streams.\r
6788    Streams     : Normally including the next sequence number to\r
6789                : be sent on the stream.\r
6790 \r
6791    Reasm Queue : A re-assembly queue.\r
6792 \r
6793    Local       : The list of local IP addresses bound in to this\r
6794    Transport   : association.\r
6795    Address     :\r
6796    List        :\r
6797 \r
6798    Association : The smallest PMTU discovered for all of the\r
6799    PMTU        : peer's transport addresses.\r
6800 \r
6801 12.3 Per Transport Address Data\r
6802 \r
6803    For each destination transport address in the peer's address list\r
6804    derived from the INIT or INIT ACK chunk, a number of data elements\r
6805    needs to be maintained including:\r
6806 \r
6807    Error count : The current error count for this destination.\r
6808 \r
6809    Error       : Current error threshold for this destination i.e.\r
6810    Threshold   : what value marks the destination down if Error count\r
6811                : reaches this value.\r
6812 \r
6813    cwnd        : The current congestion window.\r
6814 \r
6815    ssthresh    : The current ssthresh value.\r
6816 \r
6817    RTO         : The current retransmission timeout value.\r
6818 \r
6819    SRTT        : The current smoothed round trip time.\r
6820 \r
6821    RTTVAR      : The current RTT variation.\r
6822 \r
6823    partial     : The tracking method for increase of cwnd when in\r
6824    bytes acked : congestion avoidance mode (see Section 6.2.2)\r
6825 \r
6826    state       : The current state of this destination, i.e. DOWN, UP,\r
6827                : ALLOW-HB, NO-HEARTBEAT, etc.\r
6828 \r
6829    PMTU        : The current known path MTU.\r
6830 \r
6831 \r
6832 \r
6833 \r
6834 Stewart, et al.             Standards Track                   [Page 122]\r
6835 \f\r
6836 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6837 \r
6838 \r
6839    Per         : A timer used by each destination.\r
6840    Destination :\r
6841    Timer       :\r
6842 \r
6843    RTO-Pending : A flag used to track if one of the DATA chunks sent to\r
6844                  this address is currently being used to compute a\r
6845                  RTT.  If this flag is 0, the next DATA chunk sent to this\r
6846                  destination should be used to compute a RTT and this\r
6847                  flag should be set.  Every time the RTT calculation\r
6848                  completes (i.e. the DATA chunk is SACK'd) clear this\r
6849                  flag.\r
6850 \r
6851    last-time   : The time this destination was last sent to.  This can be\r
6852    used        : used to determine if a HEARTBEAT is needed.\r
6853 \r
6854 12.4 General Parameters Needed\r
6855 \r
6856    Out Queue   : A queue of outbound DATA chunks.\r
6857 \r
6858    In Queue    : A queue of inbound DATA chunks.\r
6859 \r
6860 13. IANA Considerations\r
6861 \r
6862    This protocol will require port reservation like TCP for the use of\r
6863    "well known" servers within the Internet.  All current TCP ports\r
6864    shall be automatically reserved in the SCTP port address space.  New\r
6865    requests should follow IANA's current mechanisms for TCP.\r
6866 \r
6867    This protocol may also be extended through IANA in three ways:\r
6868 \r
6869     -- through definition of additional chunk types,\r
6870     -- through definition of additional parameter types, or\r
6871     -- through definition of additional cause codes within\r
6872        ERROR chunks\r
6873 \r
6874    In the case where a particular ULP using SCTP desires to have its own\r
6875    ports, the ULP should be responsible for registering with IANA for\r
6876    getting its ports assigned.\r
6877 \r
6878 13.1 IETF-defined Chunk Extension\r
6879 \r
6880    The definition and use of new chunk types is an integral part of\r
6881    SCTP.  Thus, new chunk types are assigned by IANA through an IETF\r
6882    Consensus action as defined in [RFC2434].\r
6883 \r
6884    The documentation for a new chunk code type must include the\r
6885    following information:\r
6886 \r
6887 \r
6888 \r
6889 \r
6890 Stewart, et al.             Standards Track                   [Page 123]\r
6891 \f\r
6892 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6893 \r
6894 \r
6895    a) A long and short name for the new chunk type;\r
6896 \r
6897    b) A detailed description of the structure of the chunk, which MUST\r
6898       conform to the basic structure defined in Section 3.2;\r
6899 \r
6900    c) A detailed definition and description of intended use of each\r
6901       field within the chunk, including the chunk flags if any;\r
6902 \r
6903    d) A detailed procedural description of the use of the new chunk type\r
6904       within the operation of the protocol.\r
6905 \r
6906    The last chunk type (255) is reserved for future extension if\r
6907    necessary.\r
6908 \r
6909 13.2 IETF-defined Chunk Parameter Extension\r
6910 \r
6911    The assignment of new chunk parameter type codes is done through an\r
6912    IETF Consensus action as defined in [RFC2434].  Documentation of the\r
6913    chunk parameter MUST contain the following information:\r
6914 \r
6915    a) Name of the parameter type.\r
6916 \r
6917    b) Detailed description of the structure of the parameter field.\r
6918       This structure MUST conform to the general type-length-value\r
6919       format described in Section 3.2.1.\r
6920 \r
6921    c) Detailed definition of each component of the parameter value.\r
6922 \r
6923    d) Detailed description of the intended use of this parameter type,\r
6924       and an indication of whether and under what circumstances multiple\r
6925       instances of this parameter type may be found within the same\r
6926       chunk.\r
6927 \r
6928 13.3 IETF-defined Additional Error Causes\r
6929 \r
6930    Additional cause codes may be allocated in the range 11 to 65535\r
6931    through a Specification Required action as defined in [RFC2434].\r
6932    Provided documentation must include the following information:\r
6933 \r
6934    a) Name of the error condition.\r
6935 \r
6936    b) Detailed description of the conditions under which an SCTP\r
6937       endpoint should issue an ERROR (or ABORT) with this cause code.\r
6938 \r
6939    c) Expected action by the SCTP endpoint which receives an ERROR (or\r
6940       ABORT) chunk containing this cause code.\r
6941 \r
6942 \r
6943 \r
6944 \r
6945 \r
6946 Stewart, et al.             Standards Track                   [Page 124]\r
6947 \f\r
6948 RFC 2960          Stream Control Transmission Protocol      October 2000\r
6949 \r
6950 \r
6951    d) Detailed description of the structure and content of data fields\r
6952       which accompany this cause code.\r
6953 \r
6954    The initial word (32 bits) of a cause code parameter MUST conform to\r
6955    the format shown in Section 3.3.10, i.e.:\r
6956 \r
6957    -- first two bytes contain the cause code value\r
6958    -- last two bytes contain length of the Cause Parameter.\r
6959 \r
6960 13.4 Payload Protocol Identifiers\r
6961 \r
6962    Except for value 0 which is reserved by SCTP to indicate an\r
6963    unspecified payload protocol identifier in a DATA chunk, SCTP will\r
6964    not be responsible for standardizing or verifying any payload\r
6965    protocol identifiers; SCTP simply receives the identifier from the\r
6966    upper layer and carries it with the corresponding payload data.\r
6967 \r
6968    The upper layer, i.e., the SCTP user, SHOULD standardize any specific\r
6969    protocol identifier with IANA if it is so desired.  The use of any\r
6970    specific payload protocol identifier is out of the scope of SCTP.\r
6971 \r
6972 14. Suggested SCTP Protocol Parameter Values\r
6973 \r
6974    The following protocol parameters are RECOMMENDED:\r
6975 \r
6976    RTO.Initial              - 3  seconds\r
6977    RTO.Min                  - 1  second\r
6978    RTO.Max                 -  60 seconds\r
6979    RTO.Alpha                - 1/8\r
6980    RTO.Beta                 - 1/4\r
6981    Valid.Cookie.Life        - 60  seconds\r
6982    Association.Max.Retrans  - 10 attempts\r
6983    Path.Max.Retrans         - 5  attempts (per destination address)\r
6984    Max.Init.Retransmits     - 8  attempts\r
6985    HB.interval              - 30 seconds\r
6986 \r
6987    IMPLEMENTATION NOTE: The SCTP implementation may allow ULP to\r
6988    customize some of these protocol parameters (see Section 10).\r
6989 \r
6990    Note: RTO.Min SHOULD be set as recommended above.\r
6991 \r
6992 \r
6993 \r
6994 \r
6995 \r
6996 \r
6997 \r
6998 \r
6999 \r
7000 \r
7001 \r
7002 Stewart, et al.             Standards Track                   [Page 125]\r
7003 \f\r
7004 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7005 \r
7006 \r
7007 15. Acknowledgements\r
7008 \r
7009    The authors wish to thank Mark Allman, R.J. Atkinson, Richard Band,\r
7010    Scott Bradner, Steve Bellovin, Peter Butler, Ram Dantu, R.\r
7011    Ezhirpavai, Mike Fisk, Sally Floyd, Atsushi Fukumoto, Matt Holdrege,\r
7012    Henry Houh, Christian Huitema, Gary Lehecka, Jonathan Lee, David\r
7013    Lehmann, John Loughney, Daniel Luan, Barry Nagelberg, Thomas Narten,\r
7014    Erik Nordmark, Lyndon Ong, Shyamal Prasad, Kelvin Porter, Heinz\r
7015    Prantner, Jarno Rajahalme, Raymond E. Reeves, Renee Revis, Ivan Arias\r
7016    Rodriguez, A. Sankar, Greg Sidebottom, Brian Wyld, La Monte Yarroll,\r
7017    and many others for their invaluable comments.\r
7018 \r
7019 16.  Authors' Addresses\r
7020 \r
7021    Randall R. Stewart\r
7022    24 Burning Bush Trail.\r
7023    Crystal Lake, IL 60012\r
7024    USA\r
7025 \r
7026    Phone: +1-815-477-2127\r
7027    EMail: rrs@cisco.com\r
7028 \r
7029 \r
7030    Qiaobing Xie\r
7031    Motorola, Inc.\r
7032    1501 W. Shure Drive, #2309\r
7033    Arlington Heights, IL 60004\r
7034    USA\r
7035 \r
7036    Phone: +1-847-632-3028\r
7037    EMail: qxie1@email.mot.com\r
7038 \r
7039 \r
7040    Ken Morneault\r
7041    Cisco Systems Inc.\r
7042    13615 Dulles Technology Drive\r
7043    Herndon, VA. 20171\r
7044    USA\r
7045 \r
7046    Phone: +1-703-484-3323\r
7047    EMail: kmorneau@cisco.com\r
7048 \r
7049 \r
7050 \r
7051 \r
7052 \r
7053 \r
7054 \r
7055 \r
7056 \r
7057 \r
7058 Stewart, et al.             Standards Track                   [Page 126]\r
7059 \f\r
7060 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7061 \r
7062 \r
7063    Chip Sharp\r
7064    Cisco Systems Inc.\r
7065    7025 Kit Creek Road\r
7066    Research Triangle Park, NC  27709\r
7067    USA\r
7068 \r
7069    Phone: +1-919-392-3121\r
7070    EMail: chsharp@cisco.com\r
7071 \r
7072 \r
7073    Hanns Juergen Schwarzbauer\r
7074    SIEMENS AG\r
7075    Hofmannstr. 51\r
7076    81359 Munich\r
7077    Germany\r
7078 \r
7079    Phone: +49-89-722-24236\r
7080    EMail: HannsJuergen.Schwarzbauer@icn.siemens.de\r
7081 \r
7082 \r
7083    Tom Taylor\r
7084    Nortel Networks\r
7085    1852 Lorraine Ave.\r
7086    Ottawa, Ontario\r
7087    Canada K1H 6Z8\r
7088 \r
7089    Phone: +1-613-736-0961\r
7090    EMail: taylor@nortelnetworks.com\r
7091 \r
7092 \r
7093    Ian Rytina\r
7094    Ericsson Australia\r
7095    37/360 Elizabeth Street\r
7096    Melbourne, Victoria 3000\r
7097    Australia\r
7098 \r
7099    Phone: +61-3-9301-6164\r
7100    EMail: ian.rytina@ericsson.com\r
7101 \r
7102 \r
7103 \r
7104 \r
7105 \r
7106 \r
7107 \r
7108 \r
7109 \r
7110 \r
7111 \r
7112 \r
7113 \r
7114 Stewart, et al.             Standards Track                   [Page 127]\r
7115 \f\r
7116 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7117 \r
7118 \r
7119    Malleswar Kalla\r
7120    Telcordia Technologies\r
7121    3 Corporate Place\r
7122    PYA-2J-341\r
7123    Piscataway, NJ  08854\r
7124    USA\r
7125 \r
7126    Phone: +1-732-699-3728\r
7127    EMail: mkalla@telcordia.com\r
7128 \r
7129    Lixia Zhang\r
7130    UCLA Computer Science Department\r
7131    4531G Boelter Hall\r
7132    Los Angeles, CA 90095-1596\r
7133    USA\r
7134 \r
7135    Phone: +1-310-825-2695\r
7136    EMail: lixia@cs.ucla.edu\r
7137 \r
7138    Vern Paxson\r
7139    ACIRI\r
7140    1947 Center St., Suite 600,\r
7141    Berkeley, CA 94704-1198\r
7142    USA\r
7143 \r
7144    Phone: +1-510-666-2882\r
7145    EMail: vern@aciri.org\r
7146 \r
7147 17. References\r
7148 \r
7149    [RFC768]   Postel, J. (ed.), "User Datagram Protocol", STD 6, RFC\r
7150               768, August 1980.\r
7151 \r
7152    [RFC793]   Postel, J. (ed.), "Transmission Control Protocol", STD 7,\r
7153               RFC 793, September 1981.\r
7154 \r
7155    [RFC1123]  Braden, R., "Requirements for Internet hosts - application\r
7156               and support", STD 3, RFC 1123, October 1989.\r
7157 \r
7158    [RFC1191]  Mogul, J. and S. Deering, "Path MTU Discovery", RFC 1191,\r
7159               November 1990.\r
7160 \r
7161    [RFC1700]  Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, RFC\r
7162               1700, October 1994.\r
7163 \r
7164    [RFC1981]  McCann, J., Deering, S. and J. Mogul, "Path MTU Discovery\r
7165               for IP version 6", RFC 1981, August 1996.\r
7166 \r
7167 \r
7168 \r
7169 \r
7170 Stewart, et al.             Standards Track                   [Page 128]\r
7171 \f\r
7172 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7173 \r
7174 \r
7175    [RFC1982]  Elz, R. and R. Bush, "Serial Number Arithmetic", RFC 1982,\r
7176               August 1996.\r
7177 \r
7178    [RFC2026]  Bradner, S., "The Internet Standards Process -- Revision\r
7179               3", BCP 9, RFC 2026, October 1996.\r
7180 \r
7181    [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate\r
7182               Requirement Levels", BCP 14, RFC 2119, March 1997.\r
7183 \r
7184    [RFC2401]  Kent, S. and R. Atkinson, "Security Architecture for the\r
7185               Internet Protocol", RFC 2401,  November 1998.\r
7186 \r
7187    [RFC2402]  Kent, S. and R. Atkinson, "IP Authentication Header", RFC\r
7188               2402, November 1998.\r
7189 \r
7190    [RFC2406]  Kent, S. and R. Atkinson, "IP Encapsulating Security\r
7191               Payload (ESP)", RFC 2406, November 1998.\r
7192 \r
7193    [RFC2408]  Maughan, D., Schertler, M., Schneider, M. and J. Turner,\r
7194               "Internet Security Association and Key Management\r
7195               Protocol", RFC 2408, November 1998.\r
7196 \r
7197    [RFC2409]  Harkins, D. and D. Carrel, "The Internet Key Exchange\r
7198               (IKE)", RFC 2409, November 1998.\r
7199 \r
7200    [RFC2434]  Narten, T. and H. Alvestrand, "Guidelines for Writing an\r
7201               IANA Considerations Section in RFCs", BCP 26, RFC 2434,\r
7202               October 1998.\r
7203 \r
7204    [RFC2460]  Deering, S. and R. Hinden, "Internet Protocol, Version 6\r
7205               (IPv6) Specification", RFC 2460, December 1998.\r
7206 \r
7207    [RFC2581]  Allman, M., Paxson, V. and W. Stevens, "TCP Congestion\r
7208               Control", RFC 2581, April 1999.\r
7209 \r
7210 18. Bibliography\r
7211 \r
7212    [ALLMAN99] Allman, M. and Paxson, V., "On Estimating End-to-End\r
7213               Network Path Properties", Proc. SIGCOMM'99, 1999.\r
7214 \r
7215    [FALL96]   Fall, K. and Floyd, S., Simulation-based Comparisons of\r
7216               Tahoe, Reno, and SACK TCP, Computer Communications Review,\r
7217               V. 26 N. 3, July 1996, pp. 5-21.\r
7218 \r
7219    [RFC1750]  Eastlake, D. (ed.), "Randomness Recommendations for\r
7220               Security", RFC 1750, December 1994.\r
7221 \r
7222 \r
7223 \r
7224 \r
7225 \r
7226 Stewart, et al.             Standards Track                   [Page 129]\r
7227 \f\r
7228 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7229 \r
7230 \r
7231    [RFC1950]  Deutsch P. and J. Gailly, "ZLIB Compressed Data Format\r
7232               Specification version 3.3", RFC 1950, May 1996.\r
7233 \r
7234    [RFC2104]  Krawczyk, H., Bellare, M. and R. Canetti, "HMAC:  Keyed-\r
7235               Hashing for Message Authentication", RFC 2104, March 1997.\r
7236 \r
7237    [RFC2196]  Fraser, B., "Site Security Handbook", FYI 8, RFC 2196,\r
7238               September 1997.\r
7239 \r
7240    [RFC2522]  Karn, P. and W. Simpson, "Photuris: Session-Key Management\r
7241               Protocol", RFC 2522, March 1999.\r
7242 \r
7243    [SAVAGE99] Savage, S., Cardwell, N., Wetherall, D., and Anderson, T.,\r
7244               "TCP Congestion Control with a Misbehaving Receiver",  ACM\r
7245               Computer Communication Review, 29(5), October 1999.\r
7246 \r
7247 \r
7248 \r
7249 \r
7250 \r
7251 \r
7252 \r
7253 \r
7254 \r
7255 \r
7256 \r
7257 \r
7258 \r
7259 \r
7260 \r
7261 \r
7262 \r
7263 \r
7264 \r
7265 \r
7266 \r
7267 \r
7268 \r
7269 \r
7270 \r
7271 \r
7272 \r
7273 \r
7274 \r
7275 \r
7276 \r
7277 \r
7278 \r
7279 \r
7280 \r
7281 \r
7282 Stewart, et al.             Standards Track                   [Page 130]\r
7283 \f\r
7284 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7285 \r
7286 \r
7287 Appendix A: Explicit Congestion Notification\r
7288 \r
7289    ECN (Ramakrishnan, K., Floyd, S., "Explicit Congestion Notification",\r
7290    RFC 2481, January 1999) describes a proposed extension to IP that\r
7291    details a method to become aware of congestion outside of datagram\r
7292    loss.  This is an optional feature that an implementation MAY choose\r
7293    to add to SCTP.  This appendix details the minor differences\r
7294    implementers will need to be aware of if they choose to implement\r
7295    this feature.  In general RFC 2481 should be followed with the\r
7296    following exceptions.\r
7297 \r
7298    Negotiation:\r
7299 \r
7300    RFC2481 details negotiation of ECN during the SYN and SYN-ACK stages\r
7301    of a TCP connection.  The sender of the SYN sets two bits in the TCP\r
7302    flags, and the sender of the SYN-ACK sets only 1 bit.  The reasoning\r
7303    behind this is to assure both sides are truly ECN capable.  For SCTP\r
7304    this is not necessary.  To indicate that an endpoint is ECN capable\r
7305    an endpoint SHOULD add to the INIT and or INIT ACK chunk the TLV\r
7306    reserved for ECN.  This TLV contains no parameters, and thus has the\r
7307    following format:\r
7308 \r
7309        0                   1                   2                   3\r
7310        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
7311       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7312       |   Parameter Type = 32768      |     Parameter Length = 4      |\r
7313       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7314 \r
7315    ECN-Echo:\r
7316 \r
7317    RFC 2481 details a specific bit for a receiver to send back in its\r
7318    TCP acknowledgements to notify the sender of the Congestion\r
7319    Experienced (CE) bit having arrived from the network.  For SCTP this\r
7320    same indication is made by including the ECNE chunk.  This chunk\r
7321    contains one data element, i.e. the lowest TSN associated with the IP\r
7322    datagram marked with the CE bit, and looks as follows:\r
7323 \r
7324        0                   1                   2                   3\r
7325        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
7326       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7327       | Chunk Type=12 | Flags=00000000|    Chunk Length = 8           |\r
7328       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7329       |                      Lowest TSN Number                        |\r
7330       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7331 \r
7332       Note: The ECNE is considered a Control chunk.\r
7333 \r
7334 \r
7335 \r
7336 \r
7337 \r
7338 Stewart, et al.             Standards Track                   [Page 131]\r
7339 \f\r
7340 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7341 \r
7342 \r
7343    CWR:\r
7344 \r
7345    RFC 2481 details a specific bit for a sender to send in the header of\r
7346    its next outbound TCP segment to indicate to its peer that it has\r
7347    reduced its congestion window.  This is termed the CWR bit.  For\r
7348    SCTP the same indication is made by including the CWR chunk.\r
7349    This chunk contains one data element, i.e. the TSN number that\r
7350    was sent in the ECNE chunk.  This element represents the lowest\r
7351    TSN number in the datagram that was originally marked with the\r
7352    CE bit.\r
7353 \r
7354        0                   1                   2                   3\r
7355        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
7356       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7357       | Chunk Type=13 | Flags=00000000|    Chunk Length = 8           |\r
7358       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7359       |                      Lowest TSN Number                        |\r
7360       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
7361 \r
7362       Note: The CWR is considered a Control chunk.\r
7363 \r
7364 Appendix B Alder 32 bit checksum calculation\r
7365 \r
7366    The Adler-32 checksum calculation given in this appendix is copied from\r
7367    [RFC1950].\r
7368 \r
7369    Adler-32 is composed of two sums accumulated per byte: s1 is the sum\r
7370    of all bytes, s2 is the sum of all s1 values.  Both sums are done\r
7371    modulo 65521.  s1 is initialized to 1, s2 to zero.  The Adler-32\r
7372    checksum is stored as s2*65536 + s1 in network byte order.\r
7373 \r
7374    The following C code computes the Adler-32 checksum of a data buffer.\r
7375    It is written for clarity, not for speed.  The sample code is in the\r
7376    ANSI C programming language.  Non C users may find it easier to read\r
7377    with these hints:\r
7378 \r
7379 \r
7380 \r
7381 \r
7382 \r
7383 \r
7384 \r
7385 \r
7386 \r
7387 \r
7388 \r
7389 \r
7390 \r
7391 \r
7392 \r
7393 \r
7394 Stewart, et al.             Standards Track                   [Page 132]\r
7395 \f\r
7396 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7397 \r
7398 \r
7399    &      Bitwise AND operator.\r
7400    >>     Bitwise right shift operator.  When applied to an\r
7401           unsigned quantity, as here, right shift inserts zero bit(s)\r
7402           at the left.\r
7403    <<     Bitwise left shift operator.  Left shift inserts zero\r
7404           bit(s) at the right.\r
7405    ++     "n++" increments the variable n.\r
7406    %      modulo operator: a % b is the remainder of a divided by b.\r
7407     #define BASE 65521 /* largest prime smaller than 65536 */\r
7408     /*\r
7409       Update a running Adler-32 checksum with the bytes buf[0..len-1]\r
7410       and return the updated checksum.  The Adler-32 checksum should be\r
7411       initialized to 1.\r
7412 \r
7413        Usage example:\r
7414 \r
7415          unsigned long adler = 1L;\r
7416 \r
7417          while (read_buffer(buffer, length) != EOF) {\r
7418            adler = update_adler32(adler, buffer, length);\r
7419          }\r
7420          if (adler != original_adler) error();\r
7421       */\r
7422       unsigned long update_adler32(unsigned long adler,\r
7423          unsigned char *buf, int len)\r
7424       {\r
7425         unsigned long s1 = adler & 0xffff;\r
7426         unsigned long s2 = (adler >> 16) & 0xffff;\r
7427         int n;\r
7428 \r
7429         for (n = 0; n < len; n++) {\r
7430           s1 = (s1 + buf[n]) % BASE;\r
7431           s2 = (s2 + s1)     % BASE;\r
7432         }\r
7433         return (s2 << 16) + s1;\r
7434       }\r
7435 \r
7436       /* Return the adler32 of the bytes buf[0..len-1] */\r
7437       unsigned long adler32(unsigned char *buf, int len)\r
7438       {\r
7439         return update_adler32(1L, buf, len);\r
7440       }\r
7441 \r
7442 \r
7443 \r
7444 \r
7445 \r
7446 \r
7447 \r
7448 \r
7449 \r
7450 Stewart, et al.             Standards Track                   [Page 133]\r
7451 \f\r
7452 RFC 2960          Stream Control Transmission Protocol      October 2000\r
7453 \r
7454 \r
7455 Full Copyright Statement\r
7456 \r
7457    Copyright (C) The Internet Society (2000).  All Rights Reserved.\r
7458 \r
7459    This document and translations of it may be copied and furnished to\r
7460    others, and derivative works that comment on or otherwise explain it\r
7461    or assist in its implementation may be prepared, copied, published\r
7462    and distributed, in whole or in part, without restriction of any\r
7463    kind, provided that the above copyright notice and this paragraph are\r
7464    included on all such copies and derivative works.  However, this\r
7465    document itself may not be modified in any way, such as by removing\r
7466    the copyright notice or references to the Internet Society or other\r
7467    Internet organizations, except as needed for the purpose of\r
7468    developing Internet standards in which case the procedures for\r
7469    copyrights defined in the Internet Standards process must be\r
7470    followed, or as required to translate it into languages other than\r
7471    English.\r
7472 \r
7473    The limited permissions granted above are perpetual and will not be\r
7474    revoked by the Internet Society or its successors or assigns.\r
7475 \r
7476    This document and the information contained herein is provided on an\r
7477    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING\r
7478    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING\r
7479    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION\r
7480    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF\r
7481    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\r
7482 \r
7483 Acknowledgement\r
7484 \r
7485    Funding for the RFC Editor function is currently provided by the\r
7486    Internet Society.\r
7487 \r
7488 \r
7489 \r
7490 \r
7491 \r
7492 \r
7493 \r
7494 \r
7495 \r
7496 \r
7497 \r
7498 \r
7499 \r
7500 \r
7501 \r
7502 \r
7503 \r
7504 \r
7505 \r
7506 Stewart, et al.             Standards Track                   [Page 134]\r
7507 \f\r