idnits 2.17.1 draft-ietf-sigtran-sctp-13.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Cannot find the required boilerplate sections (Copyright, IPR, etc.) in this document. Expected boilerplate is as follows today (2024-04-24) according to https://trustee.ietf.org/license-info : IETF Trust Legal Provisions of 28-dec-2009, Section 6.a: This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 2: Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 3: This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity. == No 'Intended status' indicated for this document; assuming Proposed Standard == The page length should not exceed 58 lines per page, but there was 4 longer pages, the longest (page 102) being 60 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 46 instances of too long lines in the document, the longest one being 7 characters in excess of 72. ** There is 1 instance of lines with control characters in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == Line 4761 has weird spacing: '...ontains a par...' == Line 4783 has weird spacing: '...mber of unack...' == Line 4921 has weird spacing: '... set to indic...' == Line 4954 has weird spacing: '... set to indic...' == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: This value represents the dedicated buffer space, in number of bytes, the sender of the INIT has reserved in association with this window. During the life of the association this buffer space SHOULD not be lessened (i.e. dedicated buffers taken away from this association); however, an endpoint MAY change the value of a_rwnd it sends in SACK chunks. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: This value represents the dedicated buffer space, in number of bytes, the sender of the INIT ACK has reserved in association with this window. During the life of the association this buffer space SHOULD not be lessened (i.e. dedicated buffers taken away from this association). -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- Couldn't find a document date in the document -- date freshness check skipped. -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC2522' is mentioned on line 5761, but not defined == Missing Reference: 'RFC2104' is mentioned on line 5755, but not defined == Missing Reference: 'RFC2373' is mentioned on line 1187, but not defined ** Obsolete undefined reference: RFC 2373 (Obsoleted by RFC 3513) == Missing Reference: 'ASSOCIATE' is mentioned on line 2146, but not defined == Missing Reference: 'SHUTDOWN' is mentioned on line 2179, but not defined == Missing Reference: 'ABORT' is mentioned on line 2140, but not defined == Missing Reference: 'RFC1750' is mentioned on line 5749, but not defined ** Obsolete undefined reference: RFC 1750 (Obsoleted by RFC 4086) == Missing Reference: 'ALLMAN99' is mentioned on line 5742, but not defined == Missing Reference: 'FALL96' is mentioned on line 5745, but not defined == Missing Reference: 'SAVAGE99' is mentioned on line 5764, but not defined == Missing Reference: 'RFC2196' is mentioned on line 5758, but not defined == Missing Reference: 'RFC1950' is mentioned on line 5838, but not defined == Unused Reference: 'RFC1700' is defined on line 5700, but no explicit reference was found in the text ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 1700 (Obsoleted by RFC 3232) ** Obsolete normative reference: RFC 1981 (Obsoleted by RFC 8201) ** Obsolete normative reference: RFC 2401 (Obsoleted by RFC 4301) ** Obsolete normative reference: RFC 2402 (Obsoleted by RFC 4302, RFC 4305) ** Obsolete normative reference: RFC 2406 (Obsoleted by RFC 4303, RFC 4305) ** Obsolete normative reference: RFC 2408 (Obsoleted by RFC 4306) ** Obsolete normative reference: RFC 2409 (Obsoleted by RFC 4306) ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 2581 (Obsoleted by RFC 5681) Summary: 19 errors (**), 0 flaws (~~), 22 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group R. R. Stewart 2 INTERNET-DRAFT Q. Xie 3 Motorola 4 K. Morneault 5 C. Sharp 6 Cisco 7 H. J. Schwarzbauer 8 Siemens 9 T. Taylor 10 Nortel Networks 11 I. Rytina 12 Ericsson 13 M. Kalla 14 Telcordia 15 L. Zhang 16 UCLA 17 V. Paxson 18 ACIRI 20 expires in six months July 11,2000 22 Stream Control Transmission Protocol 23 25 Status of This Memo 27 This document is an Internet-Draft and is in full conformance with all 28 provisions of Section 10 of [RFC2026]. Internet-Drafts are working 29 documents of the Internet Engineering Task Force (IETF), its areas, 30 and its working groups. Note that other groups may also distribute 31 working documents as Internet-Drafts. 33 The list of current Internet-Drafts can be accessed at 34 http://www.ietf.org/ietf/1id-abstracts.txt 36 The list of Internet-Draft Shadow Directories can be accessed at 37 http://www.ietf.org/shadow.html. 39 Abstract 41 This document describes the Stream Control Transmission Protocol 42 (SCTP). SCTP is designed to transport PSTN signaling messages over 43 IP networks, but is capable of broader applications. 45 SCTP is a reliable transport protocol operating on top of a 46 connectionless packet network such as IP. It offers the following 47 services to its users: 49 -- acknowledged error-free non-duplicated transfer of user data, 50 -- data fragmentation to conform to discovered path MTU size, 51 -- sequenced delivery of user messages within multiple streams, 52 with an option for order-of-arrival delivery of individual 53 user messages, 54 -- optional bundling of multiple user messages into a single SCTP 55 packet, and 56 -- network-level fault tolerance through supporting of multi-homing 57 at either or both ends of an association. 59 The design of SCTP includes appropriate congestion avoidance behavior 60 and resistance to flooding and masquerade attacks. 62 TABLE OF CONTENTS 64 1. Introduction.................................................. 5 65 1.1 Motivation.................................................. 5 66 1.2 Architectural View of SCTP.................................. 5 67 1.3 Functional View of SCTP..................................... 6 68 1.3.1 Association Startup and Takedown........................ 7 69 1.3.2 Sequenced Delivery within Streams....................... 7 70 1.3.3 User Data Fragmentation................................. 8 71 1.3.4 Acknowledgement and Congestion Avoidance................ 8 72 1.3.5 Chunk Bundling ......................................... 8 73 1.3.6 Packet Validation....................................... 8 74 1.3.7 Path Management......................................... 9 75 1.4 Key Terms................................................... 9 76 1.5 Abbreviations............................................... 12 77 1.6 Serial Number Arithmetic.................................... 13 78 2. Conventions.................................................... 13 79 3. SCTP packet Format............................................ 13 80 3.1 SCTP Common Header Field Descriptions....................... 14 81 3.2 Chunk Field Descriptions.................................... 15 82 3.2.1 Optional/Variable-length Parameter Format............... 17 83 3.3 SCTP Chunk Definitions...................................... 18 84 3.3.1 Payload Data (DATA)..................................... 18 85 3.3.2 Initiation (INIT)....................................... 20 86 3.3.2.1 Optional or Variable Length Parameters.............. 23 87 3.3.3 Initiation Acknowledgement (INIT ACK)................... 25 88 3.3.3.1 Optional or Variable Length Parameters.............. 28 90 3.3.4 Selective Acknowledgement (SACK)........................ 28 91 3.3.5 Heartbeat Request (HEARTBEAT)........................... 31 92 3.3.6 Heartbeat Acknowledgement (HEARTBEAT ACK)............... 32 93 3.3.7 Abort Association (ABORT)............................... 33 94 3.3.8 Shutdown Association (SHUTDOWN)......................... 34 95 3.3.9 Shutdown Acknowledgement (SHUTDOWN ACK)................. 34 96 3.3.10 Operation Error (ERROR)................................ 35 97 3.3.10.1 Invalid Stream Identifier.......................... 36 98 3.3.10.2 Missing Mandatory Parameter........................ 36 99 3.3.10.3 Stale Cookie Error................................. 37 100 3.3.10.4 Out of Resource.................................... 37 101 3.3.10.5 Unresolvable Address............................... 37 102 3.3.10.6 Unrecognized Chunk Type............................ 38 103 3.3.10.7 Invalid Mandatory Parameter........................ 38 104 3.3.10.8 Unrecognized Parameters............................ 38 105 3.3.10.9 No User Data....................................... 39 106 3.3.10.10 Cookie Received While Shutting Down............... 39 107 3.3.11 Cookie Echo (COOKIE ECHO).............................. 40 108 3.3.12 Cookie Acknowledgement (COOKIE ACK).................... 40 109 3.3.13 Shutdown Complete (SHUTDOWN COMPLETE).................. 41 110 4. SCTP Association State Diagram................................. 41 111 5. Association Initialization..................................... 44 112 5.1 Normal Establishment of an Association...................... 44 113 5.1.1 Handle Stream Parameters................................ 46 114 5.1.2 Handle Address Parameters............................... 46 115 5.1.3 Generating State Cookie................................. 48 116 5.1.4 State Cookie Processing................................. 49 117 5.1.5 State Cookie Authentication............................. 49 118 5.1.6 An Example of Normal Association Establishment.......... 50 119 5.2 Handle Duplicate or unexpected INIT, INIT ACK, COOKIE ECHO, 120 and COOKIE ACK.............................................. 51 121 5.2.1 Handle Duplicate INIT in COOKIE-WAIT 122 or COOKIE-ECHOED States................................. 52 123 5.2.2 Unexpected INIT in States Other than CLOSED, 124 COOKIE-ECHOED and COOKIE-WAIT........................... 52 125 5.2.3 Unexpected INIT ACK..................................... 52 126 5.2.4 Handle a COOKIE ECHO when a TCB exists.................. 52 127 5.2.4.1 An Example of a Association Restart................. 55 128 5.2.5 Handle Duplicate COOKIE ACK............................. 56 129 5.2.6 Handle Stale COOKIE Error............................... 56 130 5.3 Other Initialization Issues................................. 56 131 5.3.1 Selection of Tag Value.................................. 56 132 6. User Data Transfer............................................. 57 133 6.1 Transmission of DATA Chunks................................. 58 134 6.2 Acknowledgement on Reception of DATA Chunks................. 59 135 6.2.1 Tracking Peer's Receive Buffer Space.................... 62 136 6.3 Management Retransmission Timer............................. 63 137 6.3.1 RTO Calculation......................................... 63 138 6.3.2 Retransmission Timer Rules.............................. 65 139 6.3.3 Handle T3-rtx Expiration................................ 65 140 6.4 Multi-homed SCTP Endpoints.................................. 67 141 6.4.1 Failover from Inactive Destination Address.............. 67 142 6.5 Stream Identifier and Stream Sequence Number................ 68 143 6.6 Ordered and Unordered Delivery.............................. 68 144 6.7 Report Gaps in Received DATA TSNs........................... 69 145 6.8 Adler-32 Checksum Calculation............................... 70 146 6.9 Fragmentation............................................... 70 147 6.10 Bundling .................................................. 71 148 7. Congestion Control .......................................... 72 149 7.1 SCTP Differences from TCP Congestion Control................ 73 150 7.2 SCTP Slow-Start and Congestion Avoidance.................... 74 151 7.2.1 Slow-Start.............................................. 74 152 7.2.2 Congestion Avoidance.................................... 75 153 7.2.3 Congestion Control...................................... 76 154 7.2.4 Fast Retransmit on Gap Reports.......................... 76 155 7.3 Path MTU Discovery.......................................... 77 156 8. Fault Management.............................................. 78 157 8.1 Endpoint Failure Detection.................................. 78 158 8.2 Path Failure Detection...................................... 78 159 8.3 Path Heartbeat.............................................. 79 160 8.4 Handle "Out of the blue" Packets............................ 81 161 8.5 Verification Tag............................................ 82 162 8.5.1 Exceptions in Verification Tag Rules.................... 82 163 9. Termination of Association..................................... 83 164 9.1 Abort of an Association..................................... 83 165 9.2 Shutdown of an Association.................................. 84 166 10. Interface with Upper Layer.................................... 86 167 10.1 ULP-to-SCTP................................................ 86 168 10.2 SCTP-to-ULP................................................ 95 169 11. Security Considerations....................................... 98 170 11.1 Security Objectives........................................ 98 171 11.2 SCTP Responses To Potential Threats........................ 98 172 11.2.1 Countering Insider Attacks............................. 98 173 11.2.2 Protecting against Data Corruption in the Network...... 98 174 11.2.3 Protecting Confidentiality............................. 99 175 11.2.4 Protecting against Blind Denial of Service Attacks..... 99 176 11.2.4.1 Flooding........................................... 99 177 11.2.4.2 Blind Masquerade...................................100 178 11.2.4.3 Improper Monopolization of Services................101 179 11.3 Protection against Fraud and Repudiation...................101 180 12. Recommended Transmission Control Block (TCB) Parameters.......102 181 12.1 Parameters necessary for the SCTP instance.................102 182 12.2 Parameters necessary per association (i.e. the TCB)........103 183 12.3 Per Transport Address Data.................................104 184 12.4 General Parameters Needed..................................105 185 13. IANA Consideration............................................105 186 13.1 IETF-defined Chunk Extension...............................105 187 13.2 IETF-defined Additional Error Causes.......................106 188 13.3 Payload Protocol Identifiers...............................106 189 14. Suggested SCTP Protocol Parameter Values......................107 190 15. Acknowledgements..............................................107 191 16. Authors' Addresses............................................107 192 17. References....................................................109 193 18. Bibliography..................................................110 194 Appendix A .......................................................110 195 Appendix B .......................................................111 196 1. Introduction 198 This section explains the reasoning behind the development of the 199 Stream Control Transmission Protocol (SCTP), the services it offers, 200 and the basic concepts needed to understand the detailed description 201 of the protocol. 203 1.1 Motivation 205 TCP [RFC793] has performed immense service as the primary means of 206 reliable data transfer in IP networks. However, an increasing number of 207 recent applications have found TCP too limiting, and have incorporated 208 their own reliable data transfer protocol on top of UDP [RFC768]. The 209 limitations which users have wished to bypass include the following: 211 -- TCP provides both reliable data transfer and strict order- 212 of-transmission delivery of data. Some applications need reliable 213 transfer without sequence maintenance, while others would be 214 satisfied with partial ordering of the data. In both of these 215 cases the head-of-line blocking offered by TCP causes 216 unnecessary delay. 218 -- The stream-oriented nature of TCP is often an inconvenience. 219 Applications must add their own record marking to delineate 220 their messages, and must make explicit use of the push facility 221 to ensure that a complete message is transferred in a 222 reasonable time. 224 -- The limited scope of TCP sockets complicates the task of 225 providing highly-available data transfer capability using 226 multi-homed hosts. 228 -- TCP is relatively vulnerable to denial of service attacks, 229 such as SYN attacks. 231 Transport of PSTN signaling across the IP network is an application 232 for which all of these limitations of TCP are relevant. While this 233 application directly motivated the development of SCTP, other 234 applications may find SCTP a good match to their requirements. 236 1.2 Architectural View of SCTP 238 SCTP is viewed as a layer between the SCTP user application ("SCTP 239 user" for short) and a connectionless packet network service such 240 as IP. The remainder of this document assumes SCTP runs on top of IP. 241 The basic service offered by SCTP is the reliable transfer of 242 user messages between peer SCTP users. It performs this service 243 within the context of an association between two SCTP endpoints. 244 Section 10 of this document sketches the API which should exist at the 245 boundary between the SCTP and the SCTP user layers. 247 SCTP is connection-oriented in nature, but the SCTP association is a 248 broader concept than the TCP connection. SCTP provides the means for 249 each SCTP endpoint (Section 1.4) to provide the other endpoint (during 250 association startup) with a list of transport addresses (i.e., multiple 251 IP addresses in combination with an SCTP port) through which that 252 endpoint can be reached and from which it will originate SCTP packets. 253 The association spans transfers over all of the possible 254 source/destination combinations which may be generated from each 255 endpoint's lists. 257 _____________ _____________ 258 | SCTP User | | SCTP User | 259 | Application | | Application | 260 |-------------| |-------------| 261 | SCTP | | SCTP | 262 | Transport | | Transport | 263 | Service | | Service | 264 |-------------| |-------------| 265 | |One or more ---- One or more| | 266 | IP Network |IP address \/ IP address| IP Network | 267 | Service |appearances /\ appearances| Service | 268 |_____________| ---- |_____________| 270 SCTP Node A |<-------- Network transport ------->| SCTP Node B 272 Figure 1: An SCTP Association 274 1.3 Functional View of SCTP 276 The SCTP transport service can be decomposed into a number of 277 functions. These are depicted in Figure 2 and explained in the 278 remainder of this section. 280 SCTP User Application 282 ..----------------------------------------------------- 283 .. _____________ ____________________ 284 | | | Sequenced delivery | 285 | Association | | within streams | 286 | | |____________________| 287 | startup | 288 ..| | ____________________________ 289 | and | | User Data Fragmentation | 290 | | |____________________________| 291 | takedown | 292 ..| | ____________________________ 293 | | | Acknowledgement | 294 | | | and | 295 | | | Congestion Avoidance | 296 ..| | |____________________________| 297 | | 298 | | ____________________________ 299 | | | Chunk Bundling | 300 | | |____________________________| 301 | | 302 | | ________________________________ 303 | | | Packet Validation | 304 | | |________________________________| 305 | | 306 | | ________________________________ 307 | | | Path Management | 308 |______________ |________________________________| 310 Figure 2: Functional View of the SCTP Transport Service 312 1.3.1 Association Startup and Takedown 314 An association is initiated by a request from the SCTP user (see the 315 description of the ASSOCIATE (or SEND) primitive in Section 10). 317 A cookie mechanism, similar to one described by Karn and Simpson in 318 [RFC2522], is employed during the initialization to provide protection 319 against security attacks. The cookie mechanism uses a four-way 320 handshake, the last two legs of which are allowed to carry user 321 data for fast setup. The startup sequence is described in Section 5 of 322 this document. 324 SCTP provides for graceful close (i.e., shutdown) of an active 325 association on request from the SCTP user. See the description of the 326 SHUTDOWN primitive in Section 10. SCTP also allows ungraceful close 327 (i.e., abort), either on request from the user (ABORT primitive) or as 328 a result of an error condition detected within the SCTP layer. Section 329 9 describes both the graceful and the ungraceful close procedures. 331 SCTP does not support a half-open state (like TCP) wherein one side 332 may continue sending data while the other end is closed. When either 334 endpoint performs a shutdown, the association on each peer will stop 335 accepting new data from its user and only deliver data in queue at the 336 time of the graceful close (see Section 9). 338 1.3.2 Sequenced Delivery within Streams 340 The term "stream" is used in SCTP to refer to a sequence of user 341 messages that are to be delivered to the upper-layer protocol in order 342 with respect to other messages within the same stream. This is in 343 contrast to its usage in TCP, where it refers to a sequence of bytes 344 (in this document a byte is assumed to be eight bits). 346 The SCTP user can specify at association startup time the number of 347 streams to be supported by the association. This number is negotiated 348 with the remote end (see Section 5.1.1). User messages are associated 349 with stream numbers (SEND, RECEIVE primitives, Section 10). Internally, 350 SCTP assigns a stream sequence number to each message passed to it by 351 the SCTP user. On the receiving side, SCTP ensures that messages are 352 delivered to the SCTP user in sequence within a given stream. However, 353 while one stream may be blocked waiting for the next in-sequence user 354 message, delivery from other streams may proceed. 356 SCTP provides a mechanism for bypassing the sequenced delivery 357 service. User messages sent using this mechanism are delivered to the 358 SCTP user as soon as they are received. 360 1.3.3 User Data Fragmentation 362 When needed, SCTP fragments user messages to ensure that the SCTP 363 packet passed to the lower layer conforms to the path MTU. On receipt, 364 fragments are reassembled into complete messages before being passed to 365 the SCTP user. 367 1.3.4 Acknowledgement and Congestion Avoidance 369 SCTP assigns a Transmission Sequence Number (TSN) to each user data 370 fragment or unfragmented message. The TSN is independent of any 371 stream sequence number assigned at the stream level. The receiving end 372 acknowledges all TSNs received, even if there are gaps in the 373 sequence. In this way, reliable delivery is kept functionally separate 374 from sequenced stream delivery. 376 The acknowledgement and congestion avoidance function is responsible 377 for packet retransmission when timely acknowledgement has not been 378 received. Packet retransmission is conditioned by congestion 379 avoidance procedures similar to those used for TCP. See Sections 6 380 and 7 for a detailed description of the protocol procedures associated 381 with this function. 383 1.3.5 Chunk Bundling 385 As described in Section 3, the SCTP packet as delivered to the lower 386 layer consists of a common header followed by one or more chunks. Each 387 chunk may contain either user data or SCTP control information. The 389 SCTP user has the option to request bundling of more than one user 390 messages into a single SCTP packet. The chunk bundling function of SCTP 391 is responsible for assembly of the complete SCTP packet and its 392 disassembly at the receiving end. 394 During times of congestion an SCTP implementation MAY still perform 395 bundling even if the user has requested that SCTP not bundle. The 396 user's disabling of bundling only affects SCTP implementations that may 397 delay a small period of time before transmission (to attempt to 398 encourage bundling). When the user layer disables bundling, this small 399 delay is prohibited but not bundling that is performed during 400 congestion or retransmission. 402 1.3.6 Packet Validation 404 A mandatory Verification Tag field and a 32 bit checksum field (see 405 Appendix B for a description of the Adler-32 checksum) are included in 406 the SCTP common header. The Verification Tag value is chosen by each 407 end of the association during association startup. Packets received 408 without the expected Verification Tag value are discarded, as a 409 protection against blind masquerade attacks and against stale SCTP 410 packets from a previous association. The Adler-32 checksum should be 411 set by the sender of each SCTP packet to provide additional protection 412 against data corruption in the network. The receiver of an SCTP packet 413 with an invalid Adler-32 checksum silently discards the packet. 415 1.3.7 Path Management 417 The sending SCTP user is able to manipulate the set of transport 418 addresses used as destinations for SCTP packets through the 419 primitives described in Section 10. The SCTP path management function 420 chooses the destination transport address for each outgoing SCTP 421 packet based on the SCTP user's instructions and the currently 422 perceived reachability status of the eligible destination set. 423 The path management function monitors reachability through heartbeats 424 when other packet traffic is inadequate to provide this information 425 and advises the SCTP user when reachability of any far-end transport 426 address changes. The path management function is also responsible for 427 reporting the eligible set of local transport addresses to the far end 428 during association startup, and for reporting the transport addresses 429 returned from the far end to the SCTP user. 431 At association start-up, a primary path is defined for each SCTP 432 endpoint, and is used for normal sending of SCTP packets. 434 On the receiving end, the path management is responsible for verifying 435 the existence of a valid SCTP association to which the inbound SCTP 436 packet belongs before passing it for further processing. 438 Note: Path Management and Packet Validation are done at the 439 same time, so although described separately above, in reality they 440 cannot be performed as separate items. 442 1.4 Key Terms 444 Some of the language used to describe SCTP has been introduced in the 445 previous sections. This section provides a consolidated list of the key 446 terms and their definitions. 448 o Active destination transport address: A transport address on a peer 449 endpoint which a transmitting endpoint considers available for 450 receiving user messages. 452 o Bundling: An optional multiplexing operation, whereby more than one 453 user message may be carried in the same SCTP packet. Each user 454 message occupies its own DATA chunk. 456 o Chunk: A unit of information within an SCTP packet, consisting of 457 a chunk header and chunk-specific content. 459 o Congestion Window (cwnd): An SCTP variable that limits the data, in 460 number of bytes, a sender can send to a particular destination 461 transport address before receiving an acknowledgement. 463 o Cumulative TSN Ack Point: The TSN of the last DATA chunk 464 acknowledged via the Cumulative TSN Ack field of a SACK. 466 o Idle destination address: An address that has not had user messages 467 sent to it within some length of time, normally the HEARTBEAT 468 interval or greater. 470 o Inactive destination transport address: An address which is 471 considered inactive due to errors and unavailable to transport user 472 messages. 474 o Message = user message: Data submitted to SCTP by the Upper Layer 475 Protocol (ULP). 477 o Message Authentication Code (MAC): An integrity check mechanism 478 based on cryptographic hash functions using a secret key. 479 Typically, message authentication codes are used between two 480 parties that share a secret key in order to validate information 481 transmitted between these parties. In SCTP it is used by an 482 endpoint to validate the State Cookie information that is 483 returned from the peer in the COOKIE ECHO chunk. The term "MAC" 484 has different meanings in different contexts. SCTP uses this 485 term with the same meaning as in [RFC2104]. 487 o Network Byte Order: Most significant byte first, a.k.a., Big Endian. 489 o Ordered Message: A user message that is delivered in order with 490 respect to all previous user messages sent within the stream the 491 message was sent on. 493 o Outstanding TSN (at an SCTP endpoint): A TSN (and the associated 494 DATA chunk) that has been sent by the endpoint but for which it has 495 not yet received an acknowledgement. 497 o Path: The route taken by the SCTP packets sent by one SCTP 498 endpoint to a specific destination transport address of its peer 499 SCTP endpoint. Sending to different destination transport 500 addresses does not necessarily guarantee getting separate paths. 502 o Primary Path: The primary path is the destination and 503 source address that will be put into a packet outbound 504 to the peer endpoint by default. The definition includes 505 the source address since an implementation MAY wish to 506 specify both destination and source address to better 507 control the return path taken by reply chunks and on which 508 interface the packet is transmitted when the data sender 509 is multi-homed. 511 o Receiver Window (rwnd): An SCTP variable a data sender uses to store 512 the most recently calculated receiver window of its peer, in number 513 of bytes. This gives the sender an indication of the space available 514 in the receiver's inbound buffer. 516 o SCTP association: A protocol relationship between SCTP endpoints, 517 composed of the two SCTP endpoints and protocol state information 518 including Verification Tags and the currently active set of 519 Transmission Sequence Numbers (TSNs), etc. An association can be 520 uniquely identified by the transport addresses used by the endpoints 521 in the association. Two SCTP endpoints MUST NOT have more than one 522 SCTP association between them at any given time. 524 o SCTP endpoint: The logical sender/receiver of SCTP packets. On a 525 multi-homed host, an SCTP endpoint is represented to its peers as a 526 combination of a set of eligible destination transport addresses to 527 which SCTP packets can be sent and a set of eligible source 528 transport addresses from which SCTP packets can be received. 529 All transport addresses used by an SCTP endpoint must use the 530 same port number, but can use multiple IP addresses. A transport 531 address used by an SCTP endpoint must not be used by another 532 SCTP endpoint. In other words, a transport address is unique 533 to an SCTP endpoint. 535 o SCTP packet (or packet): The unit of data delivery across the 536 interface between SCTP and the connectionless packet network (e.g., 537 IP). An SCTP packet includes the common SCTP header, possible SCTP 538 control chunks, and user data encapsulated within SCTP DATA chunks. 540 o SCTP user application (SCTP user): The logical higher-layer 541 application entity which uses the services of SCTP, also called 542 the Upper-layer Protocol (ULP). 544 o Slow Start Threshold (ssthresh): An SCTP variable. This is the 545 threshold which the endpoint will use to determine whether to 546 perform slow start or congestion avoidance on a particular 547 destination transport address. Ssthresh is in number of bytes. 549 o Stream: A uni-directional logical channel established from one to 550 another associated SCTP endpoint, within which all user messages 551 are delivered in sequence except for those submitted to the 552 unordered delivery service. 554 Note: The relationship between stream numbers in opposite 555 directions is strictly a matter of how the applications use 556 them. It is the responsibility of the SCTP user to create and 557 manage these correlations if they are so desired. 559 o Stream Sequence Number: A 16-bit sequence number used internally by 560 SCTP to assure sequenced delivery of the user messages within a 561 given stream. One stream sequence number is attached to each user 562 message. 564 o Tie-Tags: Verification Tags from a previous association. These 565 Tags are used within a State Cookie so that the newly restarting 566 association can be linked to the original association within 567 the endpoint that did NOT restart. 569 o Transmission Control Block (TCB): An internal data structure 570 created by an SCTP endpoint for each of its existing SCTP 571 associations to other SCTP endpoints. TCB contains all the status 572 and operational information for the endpoint to maintain and manage 573 the corresponding association. 575 o Transmission Sequence Number (TSN): A 32-bit sequence number used 576 internally by SCTP. One TSN is attached to each chunk containing 577 user data to permit the receiving SCTP endpoint to acknowledge its 578 receipt and detect duplicate deliveries. 580 o Transport address: A Transport Address is traditionally defined by 581 Network Layer address, Transport Layer protocol and Transport Layer 582 port number. In the case of SCTP running over IP, a transport 583 address is defined by the combination of an IP address and an SCTP 584 port number (where SCTP is the Transport protocol). 586 o Unacknowledged TSN (at an SCTP endpoint): A TSN (and the associated 587 DATA chunk) which has been received by the endpoint but for which an 588 acknowledgement has not yet been sent. Or in the opposite case, 589 for a packet that has been sent but no acknowledgement has 590 been received. 592 o Unordered Message: Unordered messages are "unordered" with respect 593 to any other message, this includes both other unordered messages 594 as well as other ordered messages. Unordered message might be 595 delivered prior to or later than ordered messages sent on the 596 same stream. 598 o User message: The unit of data delivery across the interface 599 between SCTP and its user. 601 o Verification Tag: A 32 bit unsigned integer that is randomly 602 generated. The Verification Tag provides a key that allows 603 a receiver to verify that the SCTP packet belongs to the 604 current association and is NOT an old or stale packet from 605 a previous association. 607 1.5. Abbreviations 609 MAC - Message Authentication Code [RFC2104] 611 RTO - Retransmission Time-out 613 RTT - Round-trip Time 615 RTTVAR - Round-trip Time Variation 617 SCTP - Stream Control Transmission Protocol 619 SRTT - Smoothed RTT 621 TCB - Transmission Control Block 623 TLV - Type-Length-Value Coding Format 624 TSN - Transmission Sequence Number 626 ULP - Upper-layer Protocol 628 1.6 Serial Number Arithmetic 630 It is essential to remember that the actual Transmission Sequence 631 Number space is finite, though very large. This space ranges from 0 to 632 2**32 - 1. Since the space is finite, all arithmetic dealing with 633 Transmission Sequence Numbers must be performed modulo 2**32. This 634 unsigned Arithmetic preserves the relationship of sequence numbers as 635 they cycle From 2**32 - 1 to 0 again. There are some subtleties to 636 computer modulo arithmetic, so great care should be taken in 637 programming the comparison of such values. When referring to TSNs, the 638 symbol "=<" means "less than or equal"(modulo 2**32). 640 Comparisons and arithmetic on TSNs in this document SHOULD use Serial 641 Number Arithmetic as defined in [RFC1982] where SERIAL_BITS = 32. 643 An endpoint SHOULD NOT transmit a DATA chunk with a TSN that is more 644 than 2**31 - 1 above the beginning TSN of its current send window. 645 Doing so will cause problems in comparing TSNs. 647 Transmission Sequence Numbers wrap around when they reach 2**32 - 1. 648 That is, the next TSN a DATA chunk MUST use after transmitting TSN = 649 2*32 - 1 is TSN = 0. 651 Any arithmetic done on Stream Sequence Numbers SHOULD use Serial Number 652 Arithmetic as defined in [RFC1982] where SERIAL_BITS = 16. 654 All other arithmetic and comparisons in this document uses normal 655 arithmetic. 657 2. Conventions 659 The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, 660 SHOULD NOT, RECOMMENDED, NOT RECOMMENDED, MAY, and OPTIONAL, when 661 they appear in this document, are to be interpreted as described in 662 [RFC2119]. 664 3. SCTP packet Format 666 An SCTP packet is composed of a common header and chunks. A chunk 667 contains either control information or user data. 669 The SCTP packet format is shown below: 671 0 1 2 3 672 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 673 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 674 | Common Header | 675 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 676 | Chunk #1 | 677 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 678 | ... | 679 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 680 | Chunk #n | 681 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 683 Multiple chunks can be bundled into one SCTP packet up to 684 the MTU size, except for the INIT, INIT ACK, and SHUTDOWN COMPLETE 685 chunks. These chunks MUST NOT be bundled with any other chunk in a 686 packet. See Section 6.10 for more details on chunk bundling. 688 If a user data message doesn't fit into one SCTP packet it can be 689 fragmented into multiple chunks using the procedure defined in 690 Section 6.9. 692 All integer fields in an SCTP packet MUST be transmitted in 693 network byte order, unless otherwise stated. 695 3.1 SCTP Common Header Field Descriptions 697 SCTP Common Header Format 699 0 1 2 3 700 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 701 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 702 | Source Port Number | Destination Port Number | 703 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 704 | Verification Tag | 705 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 706 | Checksum | 707 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 709 Source Port Number: 16 bits (unsigned integer) 711 This is the SCTP sender's port number. It can be used by the 712 receiver in combination with the source IP address, the 713 SCTP destination port and possibly the destination IP address 714 to identify the association to which this packet belongs. 716 Destination Port Number: 16 bits (unsigned integer) 718 This is the SCTP port number to which this packet is destined. The 719 receiving host will use this port number to de-multiplex the 720 SCTP packet to the correct receiving endpoint/application. 722 Verification Tag: 32 bits (unsigned integer) 724 The receiver of this packet uses the Verification Tag to validate 725 the sender of this SCTP packet. On transmit, the value of this 726 Verification Tag MUST be set to the value of the Initiate Tag 727 received from the peer endpoint during the association 728 initialization, with the following exceptions: 730 - A packet containing an INIT chunk MUST have a zero 731 Verification Tag. 732 - A packet containing a SHUTDOWN-COMPLETE chunk with the T-bit 733 set MUST have the Verification Tag copied from the packet 734 with the SHUTDOWN-ACK chunk. 735 - A packet containing an ABORT chunk may have the verification 736 tag copied from the packet which caused the ABORT to be sent. 737 For details see Section 8.4 and 8.5. 739 An INIT chunk MUST be the only chunk in the SCTP packet carrying it. 741 Checksum: 32 bits (unsigned integer) 743 This field contains the checksum of this SCTP packet. Its calculation 744 is discussed in Section 6.8. SCTP uses the Adler-32 algorithm as 745 described in Appendix B for calculating the checksum 747 3.2 Chunk Field Descriptions 749 The figure below illustrates the field format for the chunks to be 750 transmitted in the SCTP packet. Each chunk is formatted with a Chunk 751 Type field, a chunk-specific Flag field, a Chunk Length field, and a 752 Value field. 754 0 1 2 3 755 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 756 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 757 | Chunk Type | Chunk Flags | Chunk Length | 758 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 759 \ \ 760 / Chunk Value / 761 \ \ 762 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 764 Chunk Type: 8 bits (unsigned integer) 766 This field identifies the type of information contained in the Chunk 767 Value field. It takes a value from 0 to 254. The value of 255 is 768 reserved for future use as an extension field. 770 The values of Chunk Types are defined as follows: 772 ID Value Chunk Type 773 ----- ---------- 774 0 - Payload Data (DATA) 775 1 - Initiation (INIT) 776 2 - Initiation Acknowledgement (INIT ACK) 777 3 - Selective Acknowledgement (SACK) 778 4 - Heartbeat Request (HEARTBEAT) 779 5 - Heartbeat Acknowledgement (HEARTBEAT ACK) 780 6 - Abort (ABORT) 781 7 - Shutdown (SHUTDOWN) 782 8 - Shutdown Acknowledgement (SHUTDOWN ACK) 783 9 - Operation Error (ERROR) 784 10 - State Cookie (COOKIE ECHO) 785 11 - Cookie Acknowledgement (COOKIE ACK) 786 12 - Reserved for Explicit Congestion Notification Echo (ECNE) 787 13 - Reserved for Congestion Window Reduced (CWR) 788 14 - Shutdown Complete (SHUTDOWN COMPLETE) 789 15 to 62 - reserved by IETF 790 63 - IETF-defined Chunk Extensions 791 64 to 126 - reserved by IETF 792 127 - IETF-defined Chunk Extensions 793 128 to 190 - reserved by IETF 794 191 - IETF-defined Chunk Extensions 795 192 to 254 - reserved by IETF 796 255 - IETF-defined Chunk Extensions 798 Chunk Types are encoded such that the highest-order two bits 799 specify the action that must be taken if the processing 800 endpoint does not recognize the Chunk Type. 802 00 - Stop processing this SCTP packet and discard it, do NOT process any 803 further chunks within it. 805 01 - Stop processing this SCTP packet and discard it, do NOT process any 806 further chunks within it, and report in an Operation Error Chunk 807 using the 'Unrecognized Chunk Type' cause of error. 809 10 - Skip this chunk and continue processing. 811 11 - Skip this chunk and continue processing, but report in an 812 Operation Error Chunk using the 'Unrecognized Chunk Type' 813 cause of error. 815 Note: The ECNE and CWR chunk types are reserved for future use of 816 Explicit Congestion Notification (ECN). 818 Chunk Flags: 8 bits 820 The usage of these bits depends on the chunk type as given by the 821 Chunk Type. Unless otherwise specified, they are set to zero on 822 transmit and are ignored on receipt. 824 Chunk Length: 16 bits (unsigned integer) 826 This value represents the size of the chunk in bytes including the 827 Chunk Type, Chunk Flags, Chunk Length, and Chunk Value fields. 828 Therefore, if the Chunk Value field is zero-length, the Length 829 field will be set to 4. The Chunk Length field does not count 830 any padding. 832 Chunk Value: variable length 833 The Chunk Value field contains the actual information to be 834 transferred in the chunk. The usage and format of this field is 835 dependent on the Chunk Type. 837 The total length of a chunk (including Type, Length and Value fields) 838 MUST be a multiple of 4 bytes. If the length of the chunk is not a 839 multiple of 4 bytes, the sender MUST pad the chunk with all zero bytes 840 and this padding is NOT included in the chunk length field. The sender 841 should never pad with more than 3 bytes. The receiver MUST ignore the 842 padding bytes. 844 SCTP defined chunks are described in detail in Section 3.3. The 845 guidelines for IETF-defined chunk extensions can be found in Section 846 13.1 of this document. 848 3.2.1 Optional/Variable-length Parameter Format 850 Chunk values of SCTP control chunks consist of a chunk-type-specific 851 header of required fields, followed by zero or more parameters. The 852 optional and variable-length parameters contained in a chunk are 853 defined in a Type-Length-Value format as shown below. 855 0 1 2 3 856 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 857 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 858 | Parameter Type | Parameter Length | 859 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 860 \ \ 861 / Parameter Value / 862 \ \ 863 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 865 Chunk Parameter Type: 16 bits (unsigned integer) 867 The Type field is a 16 bit identifier of the type of parameter. It 868 takes a value of 0 to 65534. 870 The value of 65535 is reserved for IETF-defined extensions. 871 Values other than those defined in specific SCTP chunk 872 description are reserved for use by IETF. 874 Chunk Parameter Length: 16 bits (unsigned integer) 876 The Parameter Length field contains the size of the parameter in bytes, 877 including the Parameter Type, Parameter Length, and Parameter 878 Value fields. Thus, a parameter with a zero-length Parameter 879 Value field would have a Length field of 4. The Parameter Length 880 does not include any padding bytes. 882 Chunk Parameter Value: variable-length. 884 The Parameter Value field contains the actual information to be 885 transferred in the parameter. 887 The total length of a parameter (including Type, Parameter Length and 888 Value fields) MUST be a multiple of 4 bytes. If the length of the 889 parameter is not a multiple of 4 bytes, the sender pads the Parameter 890 at the end (i.e., after the Parameter Value field) with all zero 891 bytes. The length of the padding is NOT included in the parameter 892 length field. A sender should NEVER pad with more than 3 bytes. The 893 receiver MUST ignore the padding bytes. 895 The Parameter Types are encoded such that the highest-order two bits 896 specify the action that must be taken if the processing 897 endpoint does not recognize the Parameter Type. 899 00 - Stop processing this SCTP packet and discard it, do NOT process any 900 further chunks within it. 902 01 - Stop processing this SCTP packet and discard it, do NOT process any 903 further chunks within it, and report the unrecognized parameter in 904 an 'Unrecognized Parameter Type' (in either a Operational Error or 905 in the INIT ACK). 907 10 - Skip this parameter and continue processing. 909 11 - Skip this parameter and continue processing but report the 910 the unrecognized parameter in an 'Unrecognized Parameter Type' 911 (in either a Operational Error or in the INIT ACK). 913 The actual SCTP parameters are defined in the specific SCTP chunk 914 sections. The rules for IETF-defined parameter extensions are 915 defined in Section 13.2. 917 3.3 SCTP Chunk Definitions 919 This section defines the format of the different SCTP chunk types. 921 3.3.1 Payload Data (DATA) (0) 923 The following format MUST be used for the DATA chunk: 925 0 1 2 3 926 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 927 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 928 | Type = 0 | Reserved|U|B|E| Length | 929 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 930 | TSN | 931 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 932 | Stream Identifier S | Stream Sequence Number n | 933 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 934 | Payload Protocol Identifier | 935 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 936 \ \ 937 / User Data (seq n of Stream S) / 938 \ \ 939 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 941 Reserved: 5 bits 942 Should be set to all '0's and ignored by the receiver. 944 U bit: 1 bit 945 The (U)nordered bit, if set to '1', indicates that this is an 946 unordered DATA chunk, and there is no Stream Sequence Number assigned 947 to this DATA chunk. Therefore, the receiver MUST ignore the Stream 948 Sequence Number field. 950 After re-assembly (if necessary), unordered DATA chunks MUST be 951 dispatched to the upper layer by the receiver without any attempt to 952 re-order. 954 If an unordered user message is fragmented, each fragment of the 955 message MUST have its U bit set to '1'. 957 B bit: 1 bit 959 The (B)eginning fragment bit, if set, indicates the first fragment of 960 a user message. 962 E bit: 1 bit 963 The (E)nding fragment bit, if set, indicates the last fragment of a 964 user message. 966 An unfragmented user message shall have both the B and E bits set 967 to '1'. Setting both B and E bits to '0' indicates a middle fragment of 968 a multi-fragment user message, as summarized in the following table: 970 B E Description 971 ============================================================ 972 | 1 0 | First piece of a fragmented user message | 973 +----------------------------------------------------------+ 974 | 0 0 | Middle piece of a fragmented user message | 975 +----------------------------------------------------------+ 976 | 0 1 | Last piece of a fragmented user message | 977 +----------------------------------------------------------+ 978 | 1 1 | Unfragmented Message | 979 ============================================================ 980 | Table 1: Fragment Description Flags | 981 ============================================================ 983 When a user message is fragmented into multiple chunks, the TSNs are 984 used by the receiver to reassemble the message. This means that the 985 TSNs for each fragment of a fragmented user message MUST be strictly 986 sequential. 988 Length: 16 bits (unsigned integer) 990 This field indicates the length of the DATA chunk in bytes from the 991 beginning of the type field to the end of the user data field 992 excluding any padding. A DATA chunk with no user data field will 993 have Length set to 16 (indicating 16 bytes). 995 TSN : 32 bits (unsigned integer) 997 This value represents the TSN for this DATA chunk. The valid range 998 of TSN is from 0 to 4294967295 (2**32 - 1). TSN wraps back to 0 999 after reaching 4294967295. 1001 Stream Identifier S: 16 bits (unsigned integer) 1003 Identifies the stream to which the following user data belongs. 1005 Stream Sequence Number n: 16 bits (unsigned integer) 1007 This value represents the stream sequence number of the following 1008 user data within the stream S. Valid range is 0 to 65535. 1010 When a user message is fragmented by SCTP for transport, the 1011 same stream sequence number MUST be carried in each of the fragments 1012 of the message. 1014 Payload Protocol Identifier: 32 bits (unsigned integer) 1016 This value represents an application (or upper layer) specified 1017 protocol identifier. This value is passed to SCTP by its upper layer 1018 and sent to its peer. This identifier is not used by SCTP but can be 1019 used by certain network entities as well as the peer application to 1020 identify the type of information being carried in this DATA chunk. 1021 This field must be sent even in fragmented DATA chunks (to make 1022 sure it is available for agents in the middle of the network). 1024 The value 0 indicates no application identifier is specified by 1025 the upper layer for this payload data. 1027 User Data: variable length 1029 This is the payload user data. The implementation MUST pad the end 1030 of the data to a 4 byte boundary with all-zero bytes. Any padding 1031 MUST NOT be included in the length field. A sender MUST never add 1032 more than 3 bytes of padding. 1034 3.3.2 Initiation (INIT) (1) 1036 This chunk is used to initiate a SCTP association between two 1037 endpoints. The format of the INIT chunk is shown below: 1039 0 1 2 3 1040 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 1041 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1042 | Type = 1 | Chunk Flags | Chunk Length | 1043 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1044 | Initiate Tag | 1045 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1046 | Advertised Receiver Window Credit (a_rwnd) | 1047 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1048 | Number of Outbound Streams | Number of Inbound Streams | 1049 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1050 | Initial TSN | 1051 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1052 \ \ 1053 / Optional/Variable-Length Parameters / 1054 \ \ 1055 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1057 The INIT chunk contains the following parameters. Unless otherwise 1058 noted, each parameter MUST only be included once in the INIT chunk. 1060 Fixed Parameters Status 1061 ---------------------------------------------- 1062 Initiate Tag Mandatory 1063 Advertised Receiver Window Credit Mandatory 1064 Number of Outbound Streams Mandatory 1065 Number of Inbound Streams Mandatory 1066 Initial TSN Mandatory 1068 Variable Parameters Status Type Value 1069 ------------------------------------------------------------- 1070 IPv4 Address (Note 1) Optional 5 1071 IPv6 Address (Note 1) Optional 6 1072 Cookie Preservative Optional 9 1073 Reserved for ECN Capable (Note 2) Optional 32768 (0x8000) 1074 Host Name Address (Note 3) Optional 11 1075 Supported Address Types (Note 4) Optional 12 1077 Note 1: The INIT chunks can contain multiple addresses that can be 1078 IPv4 and/or IPv6 in any combination. 1080 Note 2: The ECN capable field is reserved for future use of Explicit 1081 Congestion Notification. 1083 Note 3: An INIT chunk MUST NOT contain more than one Host Name address 1084 parameter. Moreover, the sender of the INIT MUST NOT combine any other 1085 address types with the Host Name address in the INIT. The receiver 1086 of INIT MUST ignore any other address types if the Host Name address 1087 parameter is present in the received INIT chunk. 1089 Note 4: This parameter, when present, specifies all the address types 1090 the sending endpoint can support. The absence of this parameter 1091 indicates that the sending endpoint can support any address type. 1093 The Chunk Flags field in INIT is reserved and all bits in it should be 1094 set to 0 by the sender and ignored by the receiver. The sequence of 1095 parameters within an INIT can be processed in any order. 1097 Initiate Tag: 32 bits (unsigned integer) 1099 The receiver of the INIT (the responding end) records the value of 1100 the Initiate Tag parameter. This value MUST be placed into the 1101 Verification Tag field of every SCTP packet that the receiver of the 1102 INIT transmits within this association. 1104 The Initiate Tag is allowed to have any value except 0. See 1105 Section 5.3.1 for more on the selection of the tag value. 1107 If the value of the Initiate Tag in a received INIT chunk is found 1108 to be 0, the receiver MUST treat it as an error and close 1109 the association by transmitting an ABORT. 1111 Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned integer) 1113 This value represents the dedicated buffer space, in number of 1114 bytes, the sender of the INIT has reserved in association with this 1115 window. During the life of the association this buffer space SHOULD 1116 not be lessened (i.e. dedicated buffers taken away from this 1117 association); however, an endpoint MAY change the value of a_rwnd 1118 it sends in SACK chunks. 1120 Number of Outbound Streams (OS): 16 bits (unsigned integer) 1122 Defines the number of outbound streams the sender of this INIT chunk 1123 wishes to create in this association. The value of 0 MUST NOT be 1124 used. 1126 Note: A receiver of an INIT with the OS value set to 0 SHOULD abort 1127 the association. 1129 Number of Inbound Streams (MIS) : 16 bits (unsigned integer) 1131 Defines the maximum number of streams the sender of this INIT chunk 1132 allows the peer end to create in this association. The value 0 MUST 1133 NOT be used. 1135 Note: There is no negotiation of the actual number of streams 1136 but instead the two endpoints will use the min(requested, 1137 offered). See Section 5.1.1 for details. 1139 Note: A receiver of an INIT with the MIS value of 0 SHOULD abort 1140 the association. 1142 Initial TSN (I-TSN) : 32 bits (unsigned integer) 1144 Defines the initial TSN that the sender will use. The valid range is 1145 from 0 to 4294967295. This field MAY be set to the value of the 1146 Initiate Tag field. 1148 3.3.2.1 Optional/Variable Length Parameters in INIT 1150 The following parameters follow the Type-Length-Value format as 1151 defined in Section 3.2.1. Any Type-Length-Value fields MUST come 1152 after the fixed-length fields defined in the previous section. 1154 IPv4 Address Parameter (5) 1156 0 1 2 3 1157 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 1158 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1159 | Type = 5 | Length = 8 | 1160 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1161 | IPv4 Address | 1162 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1164 IPv4 Address: 32 bits (unsigned integer) 1166 Contains an IPv4 address of the sending endpoint. It is binary 1167 encoded. 1169 IPv6 Address Parameter (6) 1171 0 1 2 3 1172 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 1173 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1174 | Type = 6 | Length = 20 | 1175 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1176 | | 1177 | IPv6 Address | 1178 | | 1179 | | 1180 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1182 IPv6 Address: 128 bit (unsigned integer) 1184 Contains an IPv6 address of the sending endpoint. It is binary 1185 encoded. 1187 Note: A sender MUST NOT use an IPv4-mapped IPv6 address [RFC2373] 1188 but should instead use an IPv4 Address Parameter for an IPv4 address. 1190 Combined with the Source Port Number in the SCTP common header, the 1191 value passed in an IPv4 or IPv6 Address parameter indicates a 1192 transport address the sender of the INIT will support for the 1193 association being initiated. That is, during the lifetime of this 1194 association, this IP address can appear in the source address field 1195 of an IP datagram sent from the sender of the INIT, and can be used 1196 as a destination address of an IP datagram sent from the receiver of 1197 the INIT. 1199 More than one IP Address parameter can be included in an INIT 1200 chunk when the INIT sender is multi-homed. Moreover, a multi-homed 1201 endpoint may have access to different types of network, thus more 1202 than one address type can be present in one INIT chunk, i.e., IPv4 1203 and IPv6 addresses are allowed in the same INIT chunk. 1205 If the INIT contains at least one IP Address parameter, then the 1206 source address of the IP datagram containing the INIT chunk and any 1207 additional address(es) provided within the INIT can be used as 1208 destinations by the endpoint receiving the INIT. If the INIT does 1209 not contain any IP Address parameters, the endpoint receiving the 1210 INIT MUST use the source address associated with the received IP 1211 datagram as its sole destination address for the association. 1213 Note that not using any IP address parameters in the INIT and INIT-ACK 1214 is an alternative to make an association more likely to work across 1215 a NAT box. 1217 Cookie Preservative (9) 1219 The sender of the INIT shall use this parameter to suggest to the 1220 receiver of the INIT for a longer life-span of the State Cookie. 1222 0 1 2 3 1223 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 1224 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1225 | Type = 9 | Length = 8 | 1226 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1227 | Suggested Cookie Life-span Increment (msec.) | 1228 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1230 Suggested Cookie Life-span Increment: 32 bits (unsigned integer) 1232 This parameter indicates to the receiver how much increment in 1233 milliseconds the sender wishes the receiver to add to its default 1234 cookie life-span. 1236 This optional parameter should be added to the INIT chunk by the 1237 sender when it re-attempts establishing an association with a peer 1238 to which its previous attempt of establishing the association failed 1239 due to a stale cookie operation error. The receiver MAY choose to 1240 ignore the suggested cookie life-span increase for its own security 1241 reasons. 1243 Host Name Address (11) 1245 The sender of INIT uses this parameter to pass its Host Name (in 1246 place of its IP addresses) to its peer. The peer is responsible for 1247 resolving the name. Using this parameter might make it more likely 1248 for the association to work across a NAT box. 1250 0 1 2 3 1251 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 1253 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1254 | Type = 11 | Length | 1255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1256 / Host Name / 1257 \ \ 1258 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1260 Host Name: variable length 1262 This field contains a host name in "host name syntax" per RFC1123 1263 Section 2.1 [RFC1123]. The method for resolving the host name is 1264 out of scope of SCTP. 1266 Note: At least one null terminator is included in the Host Name 1267 string and must be included in the length. 1269 Supported Address Types (12) 1271 The sender of INIT uses this parameter to list all the address types 1272 it can support. 1274 0 1 2 3 1275 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 1276 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1277 | Type = 12 | Length | 1278 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1279 | Address Type #1 | Address Type #2 | 1280 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1281 | ...... 1282 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1284 Address Type: 16 bits (unsigned integer) 1286 This is filled with the type value of the corresponding address 1287 TLV (e.g., IPv4 = 5, IPv6 = 6, Hostname = 11). 1289 3.3.3 Initiation Acknowledgement (INIT ACK) (2): 1291 The INIT ACK chunk is used to acknowledge the initiation of an SCTP 1292 association. 1294 The parameter part of INIT ACK is formatted similarly to the INIT 1295 chunk. It uses two extra variable parameters: The State Cookie 1296 and the Unrecognized Parameter: 1298 The format of the INIT ACK chunk is shown below: 1300 0 1 2 3 1301 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 1302 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1303 | Type = 2 | Chunk Flags | Chunk Length | 1304 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1305 | Initiate Tag | 1306 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1307 | Advertised Receiver Window Credit | 1308 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1309 | Number of Outbound Streams | Number of Inbound Streams | 1310 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1311 | Initial TSN | 1312 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1313 \ \ 1314 / Optional/Variable-Length Parameters / 1315 \ \ 1316 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1318 Initiate Tag: 32 bits (unsigned integer) 1320 The receiver of the INIT ACK records the value of the Initiate Tag 1321 parameter. This value MUST be placed into the Verification Tag 1322 field of every SCTP packet that the INIT ACK receiver transmits 1323 within this association. 1325 The Initiate Tag MUST NOT take the value 0. See Section 5.3.1 for 1326 more on the selection of the Initiate Tag value. 1328 If the value of the Initiate Tag in a received INIT ACK chunk is 1329 found to be 0, the receiver MUST treat it as an error and close the 1330 association by transmitting an ABORT. 1332 Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned integer) 1334 This value represents the dedicated buffer space, in number of 1335 bytes, the sender of the INIT ACK has reserved in association with 1336 this window. During the life of the association this buffer space 1337 SHOULD not be lessened (i.e. dedicated buffers taken away from this 1338 association). 1340 Number of Outbound Streams (OS): 16 bits (unsigned integer) 1342 Defines the number of outbound streams the sender of this INIT ACK 1343 chunk wishes to create in this association. The value of 0 MUST NOT 1344 be used. 1346 Note: A receiver of an INIT ACK with the OS value set to 0 SHOULD destroy 1347 the association discarding its TCB. 1349 Number of Inbound Streams (MIS) : 16 bits (unsigned integer) 1351 Defines the maximum number of streams the sender of this INIT ACK 1352 chunk allows the peer end to create in this association. The value 0 1353 MUST NOT be used. 1355 Note: There is no negotiation of the actual number of streams but 1356 instead the two endpoints will use the min(requested, 1357 offered). See Section 5.1.1 for details. 1359 Note: A receiver of an INIT ACK with the MIS value set to 0 SHOULD destroy 1360 the association discarding its TCB. 1362 Initial TSN (I-TSN) : 32 bits (unsigned integer) 1364 Defines the initial TSN that the INIT-ACK sender will use. The valid 1365 range is from 0 to 4294967295. This field MAY be set to the value 1366 of the Initiate Tag field. 1368 Fixed Parameters Status 1369 ---------------------------------------------- 1370 Initiate Tag Mandatory 1371 Advertised Receiver Window Credit Mandatory 1372 Number of Outbound Streams Mandatory 1373 Number of Inbound Streams Mandatory 1374 Initial TSN Mandatory 1376 Variable Parameters Status Type Value 1377 ------------------------------------------------------------- 1378 State Cookie Mandatory 7 1379 IPv4 Address (Note 1) Optional 5 1380 IPv6 Address (Note 1) Optional 6 1381 Unrecognized Parameters Optional 8 1382 Reserved for ECN Capable (Note 2) Optional 32768 (0x8000) 1383 Host Name Address (Note 3) Optional 11 1385 Note 1: The INIT ACK chunks can contain any number of IP address 1386 parameters that can be IPv4 and/or IPv6 in any combination. 1388 Note 2: The ECN capable field is reserved for future use of Explicit 1389 Congestion Notification. 1391 Note 3: The INIT ACK chunks MUST NOT contain more than one Host Name 1392 address parameter. Moreover, the sender of the INIT ACK MUST NOT 1393 combine any other address types with the Host Name address in the 1394 INIT ACK. The receiver of the INIT ACK MUST ignore any other 1395 address types if the Host Name address parameter is present. 1397 IMPLEMENTATION NOTE: An implementation MUST be prepared to receive 1398 a INIT ACK that is quite large (more than 1500 bytes) due to 1399 the variable size of the state cookie AND the variable address 1400 list. For example if a responder to the INIT has 1000 IPv4 1401 addresses it wishes to send, it would need at least 8,000 bytes 1402 to encode this in the INIT ACK. 1404 In combination with the Source Port carried in the SCTP common header, 1405 each IP Address parameter in the INIT ACK indicates to the receiver of 1406 the INIT ACK a valid transport address supported by the sender of the 1407 INIT ACK for the lifetime of the association being initiated. 1409 If the INIT ACK contains at least one IP Address parameter, then the 1410 source address of the IP datagram containing the INIT ACK and any 1411 additional address(es) provided within the INIT ACK may be used as 1412 destinations by the receiver of the INIT-ACK. If the INIT ACK does not 1413 contain any IP Address parameters, the receiver of the INIT-ACK MUST 1414 use the source address associated with the received IP datagram as its 1415 sole destination address for the association. 1417 The State Cookie and Unrecognized Parameters use the Type-Length- 1418 Value format as defined in Section 3.2.1 and are described below. The 1419 other fields are defined the same as their counterparts in the INIT 1420 chunk. 1422 3.3.3.1 Optional or Variable Length Parameters 1424 State Cookie 1425 Parameter Type Value: 7 1427 Parameter Length: variable size, depending on Size of Cookie 1429 Parameter Value: 1430 This parameter value MUST contain all the necessary state and 1431 parameter information required for the sender of this INIT ACK to 1432 create the association, along with a Message Authentication Code 1433 (MAC). See Section 5.1.3 for details on State Cookie definition. 1435 Unrecognized Parameters: 1436 Parameter Type Value: 8 1438 Parameter Length: Variable Size. 1440 Parameter Value: 1441 This parameter is returned to the originator of the INIT chunk 1442 when the INIT contains an unrecognized parameter which has a value 1443 that indicates that it should be reported to the sender. This parameter 1444 value field will contain unrecognized parameters copied from 1445 the INIT chunk complete with Parameter Type, Length and Value fields. 1447 3.3.4 Selective Acknowledgement (SACK) (3): 1449 This chunk is sent to the peer endpoint to acknowledge received DATA 1450 chunks and to inform the peer endpoint of gaps in the received 1451 subsequences of DATA chunks as represented by their TSNs. 1453 The SACK MUST contain the Cumulative TSN Ack and Advertised Receiver 1454 Window Credit (a_rwnd) parameters. 1456 By definition, the value of the Cumulative TSN Ack parameter is the 1457 last TSN received before a break in the sequence of received TSNs 1458 occurs; the next TSN value following this one has not yet been received 1459 at the endpoint sending the SACK. This parameter therefore acknowledges 1460 receipt of all TSNs less than or equal to its value. 1462 The handling of a_rwnd by the receiver of the SACK is discussed in 1463 detail in Section 6.2.1. 1465 The SACK also contains zero or more Gap Ack Blocks. Each 1466 Gap Ack Block acknowledges a subsequence of TSNs received following 1467 a break in the sequence of received TSNs. By definition, all TSNs 1468 acknowledged by Gap Ack Blocks are greater than the value of the 1469 Cumulative TSN Ack. 1471 0 1 2 3 1472 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 1473 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1474 | Type = 3 |Chunk Flags | Chunk Length | 1475 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1476 | Cumulative TSN Ack | 1477 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1478 | Advertised Receiver Window Credit (a_rwnd) | 1479 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1480 | Number of Gap Ack Blocks = N | Number of Duplicate TSNs = X | 1481 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1482 | Gap Ack Block #1 Start | Gap Ack Block #1 End | 1483 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1484 / / 1485 \ ... \ 1486 / / 1487 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1488 | Gap Ack Block #N Start | Gap Ack Block #N End | 1489 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1490 | Duplicate TSN 1 | 1491 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1492 / / 1493 \ ... \ 1494 / / 1495 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1496 | Duplicate TSN X | 1497 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1499 Chunk Flags: 8 bits 1501 Set to all zeros on transmit and ignored on receipt. 1503 Cumulative TSN Ack: 32 bits (unsigned integer) 1505 This parameter contains the TSN of the last DATA chunk received in 1506 sequence before a gap. 1508 Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned integer) 1510 This field indicates the updated receive buffer space in bytes of 1511 the sender of this SACK, see Section 6.2.1 for details. 1513 Number of Gap Ack Blocks: 16 bits (unsigned integer) 1514 Indicates the number of Gap Ack Blocks included in this SACK. 1516 Number of Duplicate TSNs: 16 bit 1518 This field contains the number of duplicate TSNs the endpoint 1519 has received. Each duplicate TSN is listed following the Gap Ack 1520 Block list. 1522 Gap Ack Blocks: 1524 These fields contain the Gap Ack Blocks. They are repeated for each 1525 Gap Ack Block up to the number of Gap Ack Blocks defined in the 1526 Number of Gap Ack Blocks field. All DATA chunks with TSNs greater 1527 than or equal to (Cumulative TSN Ack + Gap Ack Block Start) and less 1528 than or equal to (Cumulative TSN Ack + Gap Ack Block End) of each Gap 1529 Ack Block are assumed to have been received correctly. 1531 Gap Ack Block Start: 16 bits (unsigned integer) 1533 Indicates the Start offset TSN for this Gap Ack Block. To calculate 1534 the actual TSN number the Cumulative TSN Ack is added to this 1535 offset number. This calculated TSN identifies the first TSN in this 1536 Gap Ack Block that has been received. 1538 Gap Ack Block End: 16 bits (unsigned integer) 1540 Indicates the End offset TSN for this Gap Ack Block. To calculate the 1541 actual TSN number the Cumulative TSN Ack is added to this 1542 offset number. This calculated TSN identifies the TSN of the last 1543 DATA chunk received in this Gap Ack Block. 1545 For example, assume the receiver has the following DATA chunks newly 1546 arrived at the time when it decides to send a Selective ACK, 1548 ---------- 1549 | TSN=17 | 1550 ---------- 1551 | | <- still missing 1552 ---------- 1553 | TSN=15 | 1554 ---------- 1555 | TSN=14 | 1556 ---------- 1557 | | <- still missing 1558 ---------- 1559 | TSN=12 | 1560 ---------- 1561 | TSN=11 | 1562 ---------- 1563 | TSN=10 | 1564 ---------- 1566 then, the parameter part of the SACK MUST be constructed as 1567 follows (assuming the new a_rwnd is set to 4660 by the sender): 1569 +--------------------------------+ 1570 | Cumulative TSN Ack = 12 | 1571 +--------------------------------+ 1572 | a_rwnd = 4660 | 1573 +----------------+---------------+ 1574 | num of block=2 | num of dup=0 | 1575 +----------------+---------------+ 1576 |block #1 strt=2 |block #1 end=3 | 1577 +----------------+---------------+ 1578 |block #2 strt=5 |block #2 end=5 | 1579 +----------------+---------------+ 1581 Duplicate TSN: 32 bits (unsigned integer) 1583 Indicates the number of times a TSN was received in duplicate since 1584 the last SACK was sent. Every time a receiver gets a duplicate TSN 1585 (before sending the SACK) it adds it to the list of duplicates. The 1586 duplicate count is re-initialized to zero after sending each SACK. 1588 For example, if a receiver were to get the TSN 19 three times 1589 it would list 19 twice in the outbound SACK. After sending the 1590 SACK if it received yet one more TSN 19 it would list 19 as a 1591 duplicate once in the next outgoing SACK. 1593 3.3.5 Heartbeat Request (HEARTBEAT) (4): 1595 An endpoint should send this chunk to its peer endpoint to probe the 1596 reachability of a particular destination transport address defined in 1597 the present association. 1599 The parameter field contains the Heartbeat Information which is a 1600 variable length opaque data structure understood only by the sender. 1602 0 1 2 3 1603 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 1604 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1605 | Type = 4 | Chunk Flags | Heartbeat Length | 1606 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1607 \ \ 1608 / Heartbeat Information TLV (Variable-Length) / 1609 \ \ 1610 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1612 Chunk Flags: 8 bits 1614 Set to zero on transmit and ignored on receipt. 1616 Heartbeat Length: 16 bits (unsigned integer) 1618 Set to the size of the chunk in bytes, including the chunk header 1619 and the Heartbeat Information field. 1621 Heartbeat Information: variable length 1623 Defined as a variable-length parameter using the format described in 1624 Section 3.2.1, i.e.: 1626 Variable Parameters Status Type Value 1627 ------------------------------------------------------------- 1628 Heartbeat Info Mandatory 1 1630 0 1 2 3 1631 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 1632 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1633 | Heartbeat Info Type=1 | HB Info Length | 1634 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1635 / Sender-specific Heartbeat Info / 1636 \ \ 1637 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1639 The Sender-specific Heartbeat Info field should normally include 1640 information about the sender's current time when this HEARTBEAT 1641 chunk is sent and the destination transport address to which this 1642 HEARTBEAT is sent (see Section 8.3). 1644 3.3.6 Heartbeat Acknowledgement (HEARTBEAT ACK) (5): 1646 An endpoint should send this chunk to its peer endpoint as a response 1647 to a HEARTBEAT chunk (see Section 8.3). A HEARTBEAT ACK is always 1648 sent to the source IP address of the IP datagram containing the 1649 HEARTBEAT chunk to which this ack is responding. 1651 The parameter field contains a variable length opaque data structure. 1653 0 1 2 3 1654 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 1655 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1656 | Type = 5 | Chunk Flags | Heartbeat Ack Length | 1657 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1658 \ \ 1659 / Heartbeat Information TLV (Variable-Length) / 1660 \ \ 1661 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1663 Chunk Flags: 8 bits 1665 Set to zero on transmit and ignored on receipt. 1667 Heartbeat Ack Length: 16 bits (unsigned integer) 1669 Set to the size of the chunk in bytes, including the chunk header 1670 and the Heartbeat Information field. 1672 Heartbeat Information: variable length 1674 This field MUST contain the Heartbeat Information parameter of 1675 the Heartbeat Request to which this Heartbeat Acknowledgement is 1676 responding. 1678 Variable Parameters Status Type Value 1679 ------------------------------------------------------------- 1680 Heartbeat Info Mandatory 1 1682 3.3.7 Abort Association (ABORT) (6): 1684 The ABORT chunk is sent to the peer of an association to close the 1685 association. The ABORT chunk may contain Cause Parameters to inform 1686 the receiver the reason of the abort. DATA chunks MUST NOT be bundled 1687 with ABORT. Control chunks (except for INIT, INIT ACK and SHUTDOWN 1688 COMPLETE) MAY be bundled with an ABORT but they MUST be placed before 1689 the ABORT in the SCTP packet, or they will be ignored by the receiver. 1691 If an endpoint receives an ABORT with a format error or for an 1692 association that doesn't exist, it MUST silently discard it. 1693 Moreover, under any circumstances, an endpoint that receives an ABORT 1694 MUST NOT respond to that ABORT by sending an ABORT of its own. 1696 0 1 2 3 1697 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 1698 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1699 | Type = 6 |Reserved |T| Length | 1700 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1701 \ \ 1702 / zero or more Error Causes / 1703 \ \ 1704 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1706 Chunk Flags: 8 bits 1708 Reserved: 7 bits 1709 Set to 0 on transmit and ignored on receipt. 1711 T bit: 1 bit 1712 The T bit is set to 0 if the sender had a TCB that it destroyed. If 1713 the sender did NOT have a TCB it should set this bit to 1. 1715 Note: Special rules apply to this chunk for verification, please 1716 see Section 8.5.1 for details. 1718 Length: 16 bits (unsigned integer) 1720 Set to the size of the chunk in bytes, including the chunk header 1721 and all the Error Cause fields present. 1723 See Section 3.3.10 for Error Cause definitions. 1725 3.3.8 Shutdown Association (SHUTDOWN) (7): 1727 An endpoint in an association MUST use this chunk to initiate a 1728 graceful close of the association with its peer. This chunk has 1729 the following format. 1731 0 1 2 3 1732 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 1733 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1734 | Type = 7 | Chunk Flags | Length = 8 | 1735 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1736 | Cumulative TSN Ack | 1737 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1739 Chunk Flags: 8 bits 1741 Set to zero on transmit and ignored on receipt. 1743 Length: 16 bits (unsigned integer) 1744 Indicates the length of the parameter. Set to 8. 1746 Cumulative TSN Ack: 32 bits (unsigned integer) 1748 This parameter contains the TSN of the last chunk received in 1749 sequence before any gaps. 1751 Note: Since the SHUTDOWN message does not contain Gap Ack Blocks, it 1752 cannot be used to acknowledge TSNs received out of order. In a SACK, 1753 lack of Gap Ack Blocks that were previously included indicates that 1754 the data receiver reneged on the associated DATA chunks. Since 1755 SHUTDOWN does not contain Gap Ack Blocks, the receiver of the 1756 SHUTDOWN shouldn't interpret the lack of a Gap Ack Block as a renege. 1757 (see Section 6.2 for information on reneging) 1759 3.3.9 Shutdown Acknowledgement (SHUTDOWN ACK) (8): 1761 This chunk MUST be used to acknowledge the receipt of the SHUTDOWN 1762 chunk at the completion of the shutdown process, see Section 9.2 for 1763 details. 1765 The SHUTDOWN ACK chunk has no parameters. 1767 0 1 2 3 1768 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 1769 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1770 | Type = 8 |Chunk Flags | Length = 4 | 1771 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1773 Chunk Flags: 8 bits 1775 Set to zero on transmit and ignored on receipt. 1777 3.3.10 Operation Error (ERROR) (9): 1779 An endpoint sends this chunk to its peer endpoint to notify it of 1780 certain error conditions. It contains one or more error causes. An 1781 Operation Error is not considered fatal in and of itself, but may be 1782 used with an ABORT chunk to report a fatal condition. It has the 1783 following parameters: 1785 0 1 2 3 1786 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 1787 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1788 | Type = 9 | Chunk Flags | Length | 1789 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1790 \ \ 1791 / one or more Error Causes / 1792 \ \ 1793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1795 Chunk Flags: 8 bits 1797 Set to zero on transmit and ignored on receipt. 1799 Length: 16 bits (unsigned integer) 1801 Set to the size of the chunk in bytes, including the chunk header 1802 and all the Error Cause fields present. 1804 Error causes are defined as variable-length parameters using the 1805 format described in 3.2.1, i.e.: 1807 0 1 2 3 1808 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 1809 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1810 | Cause Code | Cause Length | 1811 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1812 / Cause-specific Information / 1813 \ \ 1814 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1816 Cause Code: 16 bits (unsigned integer) 1818 Defines the type of error conditions being reported. 1820 Cause Code 1821 Value Cause Code 1822 --------- ---------------- 1823 1 Invalid Stream Identifier 1824 2 Missing Mandatory Parameter 1825 3 Stale Cookie Error 1826 4 Out of Resource 1827 5 Unresolvable Address 1828 6 Unrecognized Chunk Type 1829 7 Invalid Mandatory Parameter 1830 8 Unrecognized Parameters 1831 9 No User Data 1832 10 Cookie Received While Shutting Down 1834 Cause Length: 16 bits (unsigned integer) 1836 Set to the size of the parameter in bytes, including the Cause Code, 1837 Cause Length, and Cause-Specific Information fields 1839 Cause-specific Information: variable length 1841 This field carries the details of the error condition. 1843 Sections 3.3.10.1 - 3.3.10.8 define error causes for SCTP. Guidelines 1844 for the IETF to define new error cause values are discussed in Section 1845 13.3. 1847 3.3.10.1 Invalid Stream Identifier (1) 1849 Cause of error 1850 --------------- 1851 Invalid Stream Identifier: Indicates endpoint received a DATA chunk 1852 sent to a nonexistent stream. 1854 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1855 | Cause Code=1 | Cause Length=8 | 1856 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1857 | Stream Identifier | (Reserved) | 1858 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1860 Stream Identifier: 16 bits (unsigned integer) 1861 Contains the Stream Identifier of the DATA chunk received in 1862 error. 1864 Reserved: 16 bits 1865 This field is reserved. It is set to all 0's on transmit and 1866 Ignored on receipt. 1868 3.3.10.2 Missing Mandatory Parameter (2) 1870 Cause of error 1871 --------------- 1872 Missing Mandatory Parameter: Indicates that one or more 1873 mandatory TLV parameters are missing in a received INIT or INIT ACK. 1875 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1876 | Cause Code=2 | Cause Length=8+N*2 | 1877 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1878 | Number of missing params=N | 1879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1880 | Missing Param Type #1 | Missing Param Type #2 | 1881 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1882 | Missing Param Type #N-1 | Missing Param Type #N | 1883 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1885 Number of Missing params: 32 bits (unsigned integer) 1887 This field contains the number of parameters contained in the 1888 Cause-specific Information field. 1890 Missing Param Type: 16 bits (unsigned integer) 1892 Each field will contain the missing mandatory parameter number. 1894 3.3.10.3 Stale Cookie Error (3) 1896 Cause of error 1897 -------------- 1898 Stale Cookie Error: Indicates the receipt of a valid State Cookie 1899 that has expired. 1901 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1902 | Cause Code=3 | Cause Length=8 | 1903 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1904 | Measure of Staleness (usec.) | 1905 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1907 Measure of Staleness: 32 bits (unsigned integer) 1908 This field contains the difference, in microseconds, between 1909 The current time and the time the State Cookie expired. 1911 The sender of this error cause MAY choose to report how long past 1912 expiration the State Cookie is by including a non-zero value in the 1913 Measure of Staleness field. If the sender does not wish to provide 1914 this information it should set the Measure of Staleness field to the 1915 value of zero. 1917 3.3.10.4 Out of Resource (4) 1919 Cause of error 1920 --------------- 1921 Out of Resource: Indicates that the sender is out of resource. This 1922 is usually sent in combination with or within an ABORT. 1924 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1925 | Cause Code=4 | Cause Length=4 | 1926 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1928 3.3.10.5 Unresolvable Address (5) 1930 Cause of error 1931 --------------- 1932 Unresolvable Address: Indicates that the sender is not able to 1933 resolve the specified address parameter (e.g., type of address is 1934 not supported by the sender). This is usually sent in combination 1935 with or within an ABORT. 1937 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1938 | Cause Code=5 | Cause Length | 1939 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1940 / Unresolvable Address / 1941 \ \ 1942 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1944 Unresolvable Address: variable length 1945 The unresolvable address field contains the complete Type, Length 1946 and Value of the address parameter (or Host Name parameter) that 1947 contains the unresolvable address or host name. 1949 3.3.10.6 Unrecognized Chunk Type (6) 1951 Cause of error 1952 --------------- 1953 Unrecognized Chunk Type: This error cause is returned to the 1954 originator of the chunk if the receiver does not understand 1955 the chunk and the upper bit of the 'Chunk Type' is set to one. 1957 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1958 | Cause Code=6 | Cause Length | 1959 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1960 / Unrecognized Chunk / 1961 \ \ 1962 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1964 Unrecognized Chunk: variable length 1966 The Unrecognized Chunk field contains the unrecognized 1967 Chunk from the SCTP packet complete with Chunk Type, 1968 Chunk Flags and Chunk Length. 1970 3.3.10.7 Invalid Mandatory Parameter (7) 1972 Cause of error 1973 --------------- 1974 Invalid Mandatory Parameter: This error cause is returned to the 1975 originator of an INIT or INIT ACK chunk when one of the mandatory 1976 parameters is set to a invalid value. 1978 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1979 | Cause Code=7 | Cause Length=4 | 1980 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1982 3.3.10.8 Unrecognized Parameters (8) 1984 Cause of error 1985 --------------- 1986 Unrecognized Parameters: This error cause is returned to the 1987 originator of the INIT ACK chunk if the receiver does not 1988 recognize one or more Optional TLV parameters in the INIT ACK chunk. 1990 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1991 | Cause Code=8 | Cause Length | 1992 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1993 / Unrecognized Parameters / 1994 \ \ 1995 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1997 Unrecognized Parameters: variable length 1998 The Unrecognized Parameters field contains the unrecognized 1999 parameters copied from the INIT ACK chunk complete with TLV. This 2000 error cause is normally contained in an ERROR chunk bundled with 2001 the COOKIE ECHO chunk when responding to the INIT ACK, when the 2002 sender of the COOKIE ECHO chunk wishes to report unrecognized 2003 parameters. 2005 3.3.10.9 No User Data (9) 2007 Cause of error 2008 --------------- 2009 No User Data: This error cause is returned to the 2010 originator of a DATA chunk if a received DATA chunk has no user data. 2012 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2013 | Cause Code=9 | Cause Length=8 | 2014 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2015 / TSN value / 2016 \ \ 2017 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2019 TSN value: 32 bits (+unsigned integer) 2020 The TSN value field contains the TSN of the DATA chunk received 2021 with no user data field. 2023 This cause code is normally returned in an ABORT chunk 2024 (see Section 6.2) 2026 3.3.10.10 Cookie Received While Shutting Down (10) 2028 Cause of error 2029 --------------- 2030 Cookie Received While Shutting Down: A COOKIE ECHO was received 2031 While the endpoint was in SHUTDOWN-ACK-SENT state. This error is 2032 usually returned in an ERROR chunk bundled with the retransmitted 2033 SHUTDOWN ACK. 2035 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2036 | Cause Code=10 | Cause Length=4 | 2037 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2039 3.3.11 Cookie Echo (COOKIE ECHO) (10): 2041 This chunk is used only during the initialization of an association. 2042 It is sent by the initiator of an association to its peer to complete 2043 the initialization process. This chunk MUST precede any DATA chunk 2044 sent within the association, but MAY be bundled with one or more DATA 2045 chunks in the same packet. 2047 0 1 2 3 2048 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 2049 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2050 | Type = 10 |Chunk Flags | Length | 2051 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2052 / Cookie / 2053 \ \ 2054 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2056 Chunk Flags: 8 bit 2058 Set to zero on transmit and ignored on receipt. 2060 Length: 16 bits (unsigned integer) 2062 Set to the size of the chunk in bytes, including the 4 bytes of 2063 the chunk header and the size of the Cookie. 2065 Cookie: variable size 2067 This field must contain the exact cookie received in the 2068 State Cookie parameter from the previous INIT ACK. 2070 An implementation SHOULD make the cookie as small as possible 2071 to insure interoperability. 2073 3.3.12 Cookie Acknowledgement (COOKIE ACK) (11): 2075 This chunk is used only during the initialization of an association. 2076 It is used to acknowledge the receipt of a COOKIE ECHO chunk. This 2077 chunk MUST precede any DATA or SACK chunk sent within the association, 2078 but MAY be bundled with one or more DATA chunks or SACK chunk in the 2079 same SCTP packet. 2081 0 1 2 3 2082 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 2083 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2084 | Type = 11 |Chunk Flags | Length = 4 | 2085 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2087 Chunk Flags: 8 bits 2088 Set to zero on transmit and ignored on receipt. 2090 3.3.13 Shutdown Complete (SHUTDOWN COMPLETE) (14): 2092 This chunk MUST be used to acknowledge the receipt of the SHUTDOWN ACK 2093 chunk at the completion of the shutdown process, see Section 9.2 for 2094 details. 2096 The SHUTDOWN COMPLETE chunk has no parameters. 2098 0 1 2 3 2099 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 2100 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2101 | Type = 14 |Reserved |T| Length = 4 | 2102 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2104 Chunk Flags: 8 bits 2106 Reserved: 7 bits 2107 Set to 0 on transmit and ignored on receipt. 2109 T bit: 1 bit 2110 The T bit is set to 0 if the sender had a TCB that it destroyed. If 2111 the sender did NOT have a TCB it should set this bit to 1. 2113 Note: Special rules apply to this chunk for verification, please 2114 see Section 8.5.1 for details. 2116 4. SCTP Association State Diagram 2118 During the lifetime of an SCTP association, the SCTP endpoint's association 2119 progress from one state to another in response to various events. The 2120 events that may potentially advance an association's state include: 2122 o SCTP user primitive calls, e.g., [ASSOCIATE], [SHUTDOWN], [ABORT], 2124 o Reception of INIT, COOKIE ECHO, ABORT, SHUTDOWN, etc. control 2125 chunks, or 2127 o Some timeout events. 2129 The state diagram in the figures below illustrates state changes, 2130 together with the causing events and resulting actions. Note that some 2131 of the error conditions are not shown in the state diagram. Full 2132 description of all special cases should be found in the text. 2134 Note: Chunk names are given in all capital letters, while parameter 2135 names have the first letter capitalized, e.g., COOKIE ECHO chunk type 2136 vs. State Cookie parameter. If more than one event/message can occur 2137 which causes a state transition it is labeled (A), (B) etc. 2139 ----- -------- (frm any state) 2140 / \ / rcv ABORT [ABORT] 2141 rcv INIT | | | ---------- or ---------- 2142 --------------- | v v delete TCB snd ABORT 2143 generate Cookie \ +---------+ delete TCB 2144 snd INIT ACK ---| CLOSED | 2145 +---------+ 2146 / \ [ASSOCIATE] 2147 / \ --------------- 2148 | | create TCB 2149 | | snd INIT 2150 | | strt init timer 2151 rcv valid | | 2152 COOKIE ECHO | v 2153 (1) ---------------- | +------------+ 2154 create TCB | | COOKIE-WAIT| (2) 2155 snd COOKIE ACK | +------------+ 2156 | | 2157 | | rcv INIT ACK 2158 | | ----------------- 2159 | | snd COOKIE ECHO 2160 | | stop init timer 2161 | | strt cookie timer 2162 | v 2163 | +--------------+ 2164 | | COOKIE-ECHOED| (3) 2165 | +--------------+ 2166 | | 2167 | | rcv COOKIE ACK 2168 | | ----------------- 2169 | | stop cookie timer 2170 v v 2171 +---------------+ 2172 | ESTABLISHED | 2173 +---------------+ 2175 (from the ESTABLISHED state only) 2176 | 2177 | 2178 /--------+--------\ 2179 [SHUTDOWN] / \ 2180 -------------------| | 2181 check outstanding | | 2182 DATA chunks | | 2183 v | 2184 +---------+ | 2185 |SHUTDOWN-| | rcv SHUTDOWN/check 2186 |PENDING | | outstanding DATA 2187 +---------+ | chunks 2188 | |------------------ 2189 No more outstanding | | 2190 ---------------------| | 2191 snd SHUTDOWN | | 2192 strt shutdown timer | | 2193 v v 2194 +---------+ +-----------+ 2195 (4) |SHUTDOWN-| | SHUTDOWN- | (5,6) 2196 |SENT | | RECEIVED | 2197 +---------+ +-----------+ 2198 | \ | 2199 (A) rcv SHUTDOWN ACK | \ | 2200 ----------------------| \ | 2201 stop shutdown timer | \rcv:SHUTDOWN | 2202 send SHUTDOWN COMPLETE| \ (B) | 2203 delete TCB | \ | 2204 | \ | No more outstanding 2205 | \ |----------------- 2206 | \ | send SHUTDOWN ACK 2207 (B)rcv SHUTDOWN | \ | strt shutdown timer 2208 ----------------------| \ | 2209 send SHUTDOWN ACK | \ | 2210 start shutdown timer | \ | 2211 move to SHUTDOWN- | \ | 2212 ACK-SENT | | | 2213 | v | 2214 | +-----------+ 2215 | | SHUTDOWN- | (7) 2216 | | ACK-SENT | 2217 | +-----------+ 2218 | | (C)rcv SHUTDOWN COMPLETE 2219 | |----------------- 2220 | | stop shutdown timer 2221 | | delete TCB 2222 | | 2223 | | (D)rcv SHUTDOWN ACK 2224 | |-------------- 2225 | | stop shutdown timer 2226 | | send SHUTDOWN COMPLETE 2227 | | delete TCB 2228 | | 2229 \ +---------+ / 2230 \-->| CLOSED |<--/ 2231 +---------+ 2233 Figure 3: State Transition Diagram of SCTP 2235 Notes: 2236 (1) If the State Cookie in the received COOKIE ECHO is invalid (i.e., 2237 failed to pass the integrity check), the receiver MUST silently 2238 discard the packet. Or, if the received State Cookie is expired 2239 (see Section 5.1.5), the receiver MUST send back an ERROR chunk. 2240 In either case, the receiver stays in the CLOSED state. 2242 (2) If the T1-init timer expires, the endpoint MUST retransmit INIT 2243 and re-start the T1-init timer without changing state. This MUST be 2244 repeated up to 'Max.Init.Retransmits' times. After that, the 2245 endpoint MUST abort the initialization process and report the 2246 error to SCTP user. 2248 (3) If the T1-cookie timer expires, the endpoint MUST retransmit 2249 COOKIE ECHO and re-start the T1-cookie timer without changing 2250 state. This MUST be repeated up to 'Max.Init.Retransmits' 2251 times. After that, the endpoint MUST abort the initialization 2252 process and report the error to SCTP user. 2254 (4) In SHUTDOWN-SENT state the endpoint MUST acknowledge any received 2255 DATA chunks without delay. 2257 (5) In SHUTDOWN-RECEIVED state, the endpoint MUST NOT accept any new 2258 send request from its SCTP user. 2260 (6) In SHUTDOWN-RECEIVED state, the endpoint MUST transmit or retransmit 2261 data and leave this state when all data inqueue is transmitted. 2263 (7) In SHUTDOWN-ACK-SENT state, the endpoint MUST NOT accept any new 2264 send request from its SCTP user. 2266 The CLOSED state is used to indicate that an association is not 2267 created (i.e., doesn't exist). 2269 5. Association Initialization 2271 Before the first data transmission can take place from one SCTP 2272 endpoint ("A") to another SCTP endpoint ("Z"), the two endpoints must 2273 complete an initialization process in order to set up an SCTP 2274 association between them. 2276 The SCTP user at an endpoint should use the ASSOCIATE primitive to 2277 initialize an SCTP association to another SCTP endpoint. 2279 IMPLEMENTATION NOTE: From an SCTP-user's point of view, an 2280 association may be implicitly opened, without an ASSOCIATE primitive 2281 (see 10.1 B) being invoked, by the initiating endpoint's sending of 2282 the first user data to the destination endpoint. The initiating SCTP 2283 will assume default values for all mandatory and optional parameters 2284 for the INIT/INIT ACK. 2286 Once the association is established, unidirectional streams are 2287 open for data transfer on both ends (see Section 5.1.1). 2289 5.1 Normal Establishment of an Association 2291 The initialization process consists of the following steps (assuming 2292 that SCTP endpoint "A" tries to set up an association with SCTP 2293 endpoint "Z" and "Z" accepts the new association): 2295 A) "A" first sends an INIT chunk to "Z". In the INIT, "A" must 2296 provide its Verification Tag (Tag_A) in the Initiate Tag field. 2297 Tag_A SHOULD be a random number in the range of 1 to 4294967295 2298 (see 5.3.1 for Tag value selection). After sending the INIT, "A" 2299 starts the T1-init timer and enters the COOKIE-WAIT state. 2301 B) "Z" shall respond immediately with an INIT ACK chunk. The 2302 destination IP address of the INIT ACK MUST be set to the source 2303 IP address of the INIT to which this INIT ACK is responding. In 2304 the response, besides filling in other parameters, "Z" must set the 2305 Verification Tag field to Tag_A, and also provide its own 2306 Verification Tag (Tag_Z) in the Initiate Tag field. 2308 Moreover, "Z" MUST generate and send along with the INIT ACK a 2309 State Cookie. See Section 5.1.3 for State Cookie generation. 2311 Note: After sending out INIT ACK with the State Cookie parameter, 2312 "Z" MUST NOT allocate any resources, nor keep any states for the new 2313 association. Otherwise, "Z" will be vulnerable to resource attacks. 2315 C) Upon reception of the INIT ACK from "Z", "A" shall stop the T1-init 2316 timer and leave COOKIE-WAIT state. "A" shall then send the State 2317 Cookie received in the INIT ACK chunk in a COOKIE ECHO chunk, start 2318 the T1-cookie timer, and enter the COOKIE-ECHOED state. 2320 Note: The COOKIE ECHO chunk can be bundled with any pending outbound 2321 DATA chunks, but it MUST be the first chunk in the packet and 2322 until the COOKIE ACK is returned the sender MUST NOT send any 2323 other packets to the peer. 2325 D) Upon reception of the COOKIE ECHO chunk, Endpoint "Z" will reply 2326 with a COOKIE ACK chunk after building a TCB and moving to 2327 the ESTABLISHED state. A COOKIE ACK chunk may be bundled with 2328 any pending DATA chunks (and/or SACK chunks), but the COOKIE ACK 2329 chunk MUST be the first chunk in the packet. 2331 IMPLEMENTATION NOTE: An implementation may choose to send the 2332 Communication Up notification to the SCTP user upon reception 2333 of a valid COOKIE ECHO chunk. 2335 E) Upon reception of the COOKIE ACK, endpoint "A" will move from the 2336 COOKIE-ECHOED state to the ESTABLISHED state, stopping the T1-cookie 2337 timer. It may also notify its ULP about the successful 2338 establishment of the association with a Communication Up 2339 notification (see Section 10). 2341 An INIT or INIT ACK chunk MUST NOT be bundled with any other chunk. 2343 They MUST be the only chunks present in the SCTP packets that carry 2344 them. 2346 An endpoint MUST send the INIT ACK to the IP address from which it 2347 received the INIT. 2349 Note: T1-init timer and T1-cookie timer shall follow the same rules 2350 given in Section 6.3. 2352 If an endpoint receives an INIT, INIT ACK, or COOKIE ECHO chunk but 2353 decides not to establish the new association due to missing mandatory 2354 parameters in the received INIT or INIT ACK, invalid parameter values, 2355 or lack of local resources, it MUST respond with an ABORT chunk. It 2356 SHOULD also specify the cause of abort, such as the type of the 2357 missing mandatory parameters, etc., by including the error cause 2358 parameters with the ABORT chunk. The Verification Tag field in the 2359 common header of the outbound SCTP packet containing the ABORT chunk 2360 MUST be set to the Initiate Tag value of the peer. 2362 After the reception of the first DATA chunk in an association 2363 the endpoint MUST immediately respond with a SACK to acknowledge 2364 the DATA chunk. Subsequent acknowledgements should be done as 2365 described in Section 6.2. 2367 When the TCB is created, each endpoint MUST set its internal Cumulative 2368 TSN Ack Point to the value of its transmitted Initial TSN minus one. 2370 IMPLEMENTATION NOTE: The IP addresses and SCTP port are generally 2371 used as the key to find the TCB within an SCTP instance. 2373 5.1.1 Handle Stream Parameters 2375 In the INIT and INIT ACK chunks, the sender of the chunk shall 2376 indicate the number of outbound streams (OS) it wishes to have in the 2377 association, as well as the maximum inbound streams (MIS) it will 2378 accept from the other endpoint. 2380 After receiving the stream configuration information from the other 2381 side, each endpoint shall perform the following check: If the peer's 2382 MIS is less than the endpoint's OS, meaning that the peer is incapable 2383 of supporting all the outbound streams the endpoint wants to 2384 configure, the endpoint MUST either use MIS outbound streams, 2385 or abort the association and report to its upper layer the resources 2386 shortage at its peer. 2388 After the association is initialized, the valid outbound stream 2389 identifier range for either endpoint shall be 0 to 2390 min(local OS, remote MIS)-1. 2392 5.1.2 Handle Address Parameters 2394 During the association initialization, an endpoint shall use the 2395 following rules to discover and collect the destination transport 2396 address(es) of its peer. 2398 A) If there are no address parameters present in the received INIT 2399 or INIT ACK chunk, the endpoint shall take the source IP address 2400 from which the chunk arrives and record it, in combination with 2401 the SCTP source port number, as the only destination transport 2402 address for this peer. 2404 B) If there is a Host Name parameter present in the received INIT or 2405 INIT ACK chunk, the endpoint shall resolve that host name to a 2406 list of IP address(es) and derive the transport address(es) of this 2407 peer by combining the resolved IP address(es) with the SCTP source 2408 port. 2410 The endpoint MUST ignore any other IP address parameters if 2411 they are also present in the received INIT or INIT ACK chunk. 2413 The time at which the receiver of an INIT resolves the host 2414 name has potential security implications to SCTP. If the receiver of 2415 an INIT resolves the host name upon the reception of the chunk, and 2416 the mechanism the receiver uses to resolve the host name involves 2417 potential long delay (e.g. DNS query), the receiver may open itself 2418 up to resource attacks for the period of time while it is waiting for 2419 the name resolution results before it can build the State Cookie and 2420 release local resources. 2422 Therefore, in cases where the name translation involves potential 2423 long delay, the receiver of the INIT MUST postpone the name 2424 resolution till the reception of the COOKIE ECHO chunk from the 2425 peer. In such a case, the receiver of the INIT SHOULD build the 2426 State Cookie using the received Host Name (instead of destination 2427 transport addresses) and send the INIT ACK to the source IP 2428 address from which the INIT was received. 2430 The receiver of an INIT ACK shall always immediately attempt to 2431 resolve the name upon the reception of the chunk. 2433 The receiver of the INIT or INIT ACK MUST NOT send user data 2434 (piggy-backed or stand-alone) to its peer until the host name is 2435 successfully resolved. 2437 If the name resolution is not successful, the endpoint MUST 2438 immediately send an ABORT with "Unresolvable Address" error cause to 2439 its peer. The ABORT shall be sent to the source IP address from which 2440 the last peer packet was received. 2442 C) If there are only IPv4/IPv6 addresses present in the received 2443 INIT or INIT ACK chunk, the receiver shall derive and record all 2444 the transport address(es) from the received chunk AND the 2445 source IP address that sent the INIT or INIT ACK. The transport 2446 address(es) are derived by the combination of SCTP source port (from 2447 the common header) and the IP address parameter(s) carried in the 2448 INIT or INIT ACK chunk and the source IP address of the IP datagram. 2449 The receiver should use only these transport addresses as 2450 destination transport addresses when sending subsequent packets 2451 to its peer. 2453 IMPLEMENTATION NOTE: In some cases (e.g., when the implementation 2454 doesn't control the source IP address that is used for transmitting), 2455 an endpoint might need to include in its INIT or INIT ACK all possible 2456 IP addresses from which packets to the peer could be transmitted. 2458 After all transport addresses are derived from the INIT or INIT ACK 2459 chunk using the above rules, the endpoint shall select one of the 2460 transport addresses as the initial primary path. 2462 Note: The INIT-ACK MUST be sent to the source address of the INIT. 2464 The sender of INIT may include a 'Supported Address Types' 2465 parameter in the INIT to indicate what types of address are 2466 acceptable. When this parameter is present, the receiver of INIT 2467 (initiatee) MUST either use one of the address types indicated in the 2468 Supported Address Types parameter when responding to the INIT, or 2469 abort the association with an "Unresolvable Address" error cause if it 2470 is unwilling or incapable of using any of the address types indicated 2471 by its peer. 2473 IMPLEMENTATION NOTE: In the case that the receiver of an INIT ACK 2474 fails to resolve the address parameter due to an unsupported type, 2475 it can abort the initiation process and then attempt a re-initiation 2476 by using a 'Supported Address Types' parameter in the new INIT to 2477 indicate what types of address it prefers. 2479 5.1.3 Generating State Cookie 2481 When sending an INIT ACK as a response to an INIT chunk, the sender 2482 of INIT ACK creates a State Cookie and sends it in the State Cookie 2483 parameter of the INIT ACK. Inside this State Cookie, the sender should 2484 include a MAC (see [RFC2104] for an example), a time stamp on when the 2485 State Cookie is created, and the lifespan of the State Cookie, along 2486 with all the information necessary for it to establish the association. 2488 The following steps SHOULD be taken to generate the State Cookie: 2490 1) Create an association TCB using information from both the received 2491 INIT and the outgoing INIT ACK chunk, 2493 2) In the TCB, set the creation time to the current time of day, and 2494 the lifespan to the protocol parameter 'Valid.Cookie.Life', 2496 3) From the TCB, identify and collect the minimal subset of 2497 information needed to re-create the TCB, and generate a MAC using 2498 this subset of information and a secret key (see [RFC2104] for an 2499 example of generating a MAC), and 2501 4) Generate the State Cookie by combining this subset of information 2502 and the resultant MAC. 2504 After sending the INIT ACK with the State Cookie parameter, the sender 2505 SHOULD delete the TCB and any other local resource related to the new 2506 association, so as to prevent resource attacks. 2508 The hashing method used to generate the MAC is strictly a 2509 private matter for the receiver of the INIT chunk. The use of a MAC 2510 is mandatory to prevent denial of service attacks. The secret key 2511 SHOULD be random ([RFC1750] provides some information on randomness 2512 guidelines); it SHOULD be changed reasonably frequently, and the 2513 timestamp in the State Cookie MAY be used to determine which key should 2514 be used to verify the MAC. 2516 An implementation SHOULD make the cookie as small as possible to 2517 insure interoperability. 2519 5.1.4 State Cookie Processing 2521 When an endpoint receives an INIT ACK chunk with a State Cookie 2522 parameter, it MUST immediately send a COOKIE ECHO chunk to its peer 2523 with the received State Cookie. The sender MAY also add any pending 2524 DATA chunks to the packet after the COOKIE ECHO chunk. 2526 The endpoint shall also start the T1-cookie timer after sending out the 2527 COOKIE ECHO chunk. If the timer expires, the endpoint shall retransmit 2528 the COOKIE ECHO chunk and restart the T1-cookie timer. This is repeated 2529 until either a COOKIE ACK is received or 'Max.Init.Retransmits' is 2530 reached causing the peer endpoint to be marked unreachable (and thus 2531 the association enters the CLOSED state). 2533 5.1.5 State Cookie Authentication 2535 When an endpoint receives a COOKIE ECHO chunk from another endpoint 2536 with which it has no association, it shall take the following actions: 2538 1) Compute a MAC using the TCB data carried in the State 2539 Cookie and the secret key (note the timestamp in the State Cookie 2540 MAY be used to determine which secret key to use). Reference 2541 [RFC2104] can be used as a guideline for generating the MAC, 2543 2) Authenticate the State Cookie as one that it previously generated by 2544 comparing the computed MAC against the one carried in the 2545 State Cookie. If this comparison fails, the SCTP packet, including 2546 the COOKIE ECHO and any DATA chunks, should be silently discarded, 2548 3) Compare the creation timestamp in the State Cookie to the current 2549 local time. If the elapsed time is longer than the lifespan carried 2550 in the State Cookie, then the packet, including the COOKIE ECHO and 2551 any attached DATA chunks, SHOULD be discarded and the endpoint MUST 2552 transmit an ERROR chunk with a "Stale Cookie" error cause to the 2553 peer endpoint, 2555 4) If the State Cookie is valid, create an association to the sender of 2556 the COOKIE ECHO chunk with the information in the TCB data carried 2557 in the COOKIE ECHO, and enter the ESTABLISHED state, 2559 5) Send a COOKIE ACK chunk to the peer acknowledging reception of 2560 the COOKIE ECHO. The COOKIE ACK MAY be bundled with an outbound 2561 DATA chunk or SACK chunk; however, the COOKIE ACK MUST be the first 2562 chunk in the SCTP packet. 2564 6) Immediately acknowledge any DATA chunk bundled with the COOKIE ECHO 2565 with a SACK (subsequent DATA chunk acknowledgement should follow the 2566 rules defined in Section 6.2). As mentioned in step 5), if the SACK 2567 is bundled with the COOKIE ACK, the COOKIE ACK MUST appear first in 2568 the SCTP packet. 2570 If a COOKIE ECHO is received from an endpoint with which the 2571 receiver of the COOKIE ECHO has an existing association, the procedures 2572 in Section 5.2 should be followed. 2574 5.1.6 An Example of Normal Association Establishment 2576 In the following example, "A" initiates the association and then sends 2577 a user message to "Z", then "Z" sends two user messages to "A" later 2578 (assuming no bundling or fragmentation occurs): 2580 Endpoint A Endpoint Z 2581 {app sets association with Z} 2582 (build TCB) 2583 INIT [I-Tag=Tag_A 2584 & other info] --------\ 2585 (Start T1-init timer) \ 2586 (Enter COOKIE-WAIT state) \---> (compose temp TCB and Cookie_Z) 2588 /--- INIT ACK [Veri Tag=Tag_A, 2589 / I-Tag=Tag_Z, 2590 (Cancel T1-init timer) <------/ Cookie_Z, & other info] 2591 (destroy temp TCB) 2592 COOKIE ECHO [Cookie_Z] ------\ 2593 (Start T1-init timer) \ 2594 (Enter COOKIE-ECHOED state) \---> (build TCB enter ESTABLISHED 2595 state) 2597 /---- COOKIE-ACK 2598 / 2599 (Cancel T1-init timer, <-----/ 2600 Enter ESTABLISHED state) 2601 ... 2602 {app sends 1st user data; strm 0} 2603 DATA [TSN=initial TSN_A 2604 Strm=0,Seq=1 & user data]--\ 2605 (Start T3-rtx timer) \ 2606 \-> 2607 /----- SACK [TSN Ack=init TSN_A,Block=0] 2608 (Cancel T3-rtx timer) <------/ 2609 ... 2611 ... 2612 {app sends 2 messages;strm 0} 2613 /---- DATA 2614 / [TSN=init TSN_Z 2615 <--/ Strm=0,Seq=1 & user data 1] 2616 SACK [TSN Ack=init TSN_Z, /---- DATA 2617 Block=0] --------\ / [TSN=init TSN_Z +1, 2618 \/ Strm=0,Seq=2 & user data 2] 2619 <------/\ 2620 \ 2621 \------> 2623 Figure 4: INITiation Example 2625 If the T1-init timer expires at "A" after the INIT or COOKIE ECHO 2626 chunks are sent, the same INIT or COOKIE ECHO chunk with the same 2627 Initiate Tag (i.e., Tag_A) or State Cookie shall be retransmitted and 2628 the timer restarted. This shall be repeated Max.Init.Retransmits times 2629 before "A" considers "Z" unreachable and reports the failure to its 2630 upper layer (and thus the association enters the CLOSED state). When 2631 retransmitting the INIT, the endpoint MUST follow the rules 2632 defined in 6.3 to determine the proper timer value. 2634 5.2 Handle Duplicate or Unexpected INIT, INIT ACK, COOKIE ECHO, and 2635 COOKIE ACK 2637 During the lifetime of an association (in one of the possible 2638 states), an endpoint may receive from its peer endpoint one of the 2639 setup chunks (INIT, INIT ACK, COOKIE ECHO, and COOKIE ACK). The 2640 receiver shall treat such a setup chunk as a duplicate and process it 2641 as described in this section. 2642 Note: An endpoint will not receive the chunk unless the chunk was 2643 sent to a SCTP transport address and is from a SCTP transport address 2644 associated with this endpoint. Therefore, the endpoint processes 2645 such a chunk as part of its current association. 2647 The following scenarios can cause duplicated or unexpected chunks: 2649 A) The peer has crashed without being detected, re-started 2650 itself and sent out a new INIT chunk trying to restore the 2651 association, 2653 B) Both sides are trying to initialize the association at about the 2654 same time, 2656 C) The chunk is from a stale packet that was used to establish 2657 the present association or a past association that is no 2658 longer in existence, 2660 D) The chunk is a false packet generated by an attacker, or 2662 E) The peer never received the COOKIE ACK and is retransmitting its 2663 COOKIE ECHO. 2665 The rules in the following sections shall be applied in order to 2666 identify and correctly handle these cases. 2668 5.2.1 INIT received in COOKIE-WAIT or COOKIE-ECHOED State (Item B) 2669 This usually indicates an initialization collision, i.e., each 2670 endpoint is attempting, at about the same time, to establish an 2671 association with the other endpoint. 2673 Upon receipt of an INIT in the COOKIE-WAIT or COOKIE-ECHOED state, an 2674 endpoint MUST respond with an INIT ACK using the same parameters it 2675 sent in its original INIT chunk (including its Verification Tag, 2676 unchanged). These original parameters are combined with those from the 2677 newly received INIT chunk. The endpoint shall also generate a State 2678 Cookie with the INIT ACK. The endpoint uses the parameters sent in its 2679 INIT to calculate the State Cookie. 2681 After that, the endpoint MUST NOT change its state, the T1-init 2682 timer shall be left running and the corresponding TCB MUST NOT be 2683 destroyed. The normal procedures for handling State Cookies when 2684 a TCB exists will resolve the duplicate INITs to a single association. 2686 For an endpoint that is in the COOKIE-ECHOED state it MUST populate 2687 its Tie-Tags with the Tag information of itself and its peer (see 2688 section 5.2.2 for a description of the Tie-Tags). 2690 5.2.2 Unexpected INIT in States Other than CLOSED, COOKIE-ECHOED and 2691 COOKIE-WAIT 2693 Unless otherwise stated, upon reception of an unexpected INIT for this 2694 association, the endpoint shall generate an INIT ACK with a State 2695 Cookie. In the outbound INIT ACK the endpoint MUST copy its current 2696 Verification Tag and Peers Verification tag into a reserved place 2697 within the state cookie. We shall refer to these locations as the 2698 Peers-Tie-Tag and the Local-Tie-Tag. The INIT ACK MUST contain a new 2699 Verification Tag (randomly generated see Section 5.3.1). Other 2700 parameters for the endpoint SHOULD be copied from the existing 2701 parameters of the association (e.g. number of outbound streams) into 2702 the INIT ACK and cookie. 2704 After sending out the INIT ACK, the endpoint shall take no further 2705 actions, i.e., the existing association, including its current state, 2706 and the corresponding TCB MUST NOT be changed. 2708 Note: Only when a TCB exists and the association is NOT in a 2709 COOKIE-WAIT state are the Tie-Tags populated. For a normal association 2710 INIT (i.e. the endpoint is in a COOKIE-WAIT state), the Tie-Tags MUST 2711 be set to 0 (indicating that no previous TCB existed). The INIT ACK 2712 and State Cookie are populated as specified in section 5.2.1. 2714 5.2.3 Unexpected INIT ACK 2716 If an INIT ACK is received by an endpoint in any state 2717 other than the COOKIE-WAIT state, the endpoint should discard 2718 the INIT ACK chunk. An unexpected INIT ACK usually indicates the 2719 processing of an old or duplicated INIT chunk. 2721 5.2.4 Handle a COOKIE ECHO when a TCB exists 2722 When a COOKIE ECHO chunk is received by an endpoint in any state for an 2723 existing association (i.e., not in the CLOSED state) the following 2724 rules shall be applied: 2726 1) Compute a MAC as described in Step 1 of Section 5.1.5, 2728 2) Authenticate the State Cookie as described in Step 2 of Section 2729 5.1.5 (this is case C or D above). 2731 3) Compare the timestamp in the State Cookie to the current time. If 2732 the State Cookie is older than the lifespan carried in the State 2733 Cookie and the Verification Tags contained in the State Cookie do 2734 not match the current association's Verification Tags, the packet, 2735 including the COOKIE ECHO and any DATA chunks, should be discarded. 2736 The endpoint also MUST transmit an ERROR chunk with a "Stale Cookie" 2737 error cause to the peer endpoint (this is case C or D above). 2739 If both Verification Tags in the State Cookie match the Verification 2740 Tags of the current association, consider the State Cookie valid 2741 (this is case E) even if the lifespan is exceeded. 2743 4) If the State Cookie proves to be valid, unpack the TCB into a 2744 temporary TCB. 2746 5) Refer to Table 2 to determine the correct action to be taken. 2748 +------------+------------+---------------+--------------+-------------+ 2749 | Local Tag | Peers Tag | Local-Tie-Tag | Peers-Tie-Tag| Action/ | 2750 | | | | | Description | 2751 +------------+------------+---------------+--------------+-------------+ 2752 | X | X | M | M | (A) | 2753 +------------+------------+---------------+--------------+-------------+ 2754 | M | A | A | A | (B) | 2755 +------------+------------+---------------+--------------+-------------+ 2756 | X | M | 0 | 0 | (C) | 2757 +------------+------------+---------------+--------------+-------------+ 2758 | M | M | A | A | (D) | 2759 +======================================================================+ 2760 | Table 2: Handling of a Cookie when a TCB exists | 2761 +======================================================================+ 2763 Legend: 2765 X - Tag does not match the existing TCB 2766 M - Tag matches the existing TCB. 2767 0 - No Tie-Tag in Cookie (unknown). 2768 A - All cases, i.e. M, X or 0. 2770 Note: For any case not shown in Table 2, the cookie should be 2771 silently discarded. 2773 Action 2775 (A)In this case, the peer may have restarted. When the endpoint 2776 recognizes this potential 'restart', the existing session is 2777 treated the same as if it received an ABORT followed by a new 2778 Cookie Echo with the following exceptions: 2780 - Any SCTP Data Chunks MAY be retained (this is an implementation 2781 specific option). 2783 - A notification of RESTART SHOULD be sent to the ULP instead 2784 of a "COMMUNICATION LOST" notification. 2786 All the congestion control parameters (e.g., cwnd, ssthresh) related 2787 to this peer MUST be reset to their initial values (see Section 2788 6.2.1). 2790 After this the endpoint shall enter the ESTABLISHED state. 2792 If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes 2793 the peer has restarted (Action A), it MUST NOT setup a new 2794 association but instead resend the SHUTDOWN ACK and send an ERROR 2795 chunk with a "Cookie Received while Shutting Down" error cause to 2796 its peer. 2798 (B)In this case, both sides may be attempting to start an 2799 association at about the same time but the peer endpoint 2800 started its INIT after responding to the local endpoints 2801 INIT. Thus it may have picked a new Verification Tag not being aware 2802 of the previous Tag it had sent this endpoint. The endpoint 2803 should stay in or enter the Established state but it MUST update 2804 its peers Verification Tag from the Cookie, stop any init 2805 or cookie timers that may running and send a Cookie Ack. 2807 (C)In this case, the local endpoints cookie has arrived 2808 late. Before it arrived the local endpoint, sent 2809 a INIT and received a INIT-ACK and finally sent a 2810 Cookie with the peers same tag but a new tag of 2811 its own. The cookie should be silently discarded. 2812 The endpoint should NOT change states and should 2813 leave any timers running. 2815 (D)When both local and remote tags match the endpoint should 2816 always enter the Established state. It should stop any init 2817 or cookie timers that may running and send a Cookie Ack. 2819 Note: The "peer's Verification Tag" is the tag received in the 2820 Initiate Tag field of the INIT or INIT ACK chunk. 2822 5.2.4.1 An Example of a Association Restart 2824 In the following example, "A" initiates the association after a restart 2825 has occured. Endpoint "Z" had no knowledge of the restart until the 2826 exchange (i.e. Heartbeats had not yet detected the failure of "A"). 2827 (assuming no bundling or fragmentation occurs): 2829 Endpoint A Endpoint Z 2830 <-------------- Association is established----------------------> 2831 Tag=Tag_A Tag=Tag_Z 2832 <---------------------------------------------------------------> 2833 {A crashes and restarts} 2834 {app sets up a association with Z} 2835 (build TCB) 2836 INIT [I-Tag=Tag_A' 2837 & other info] --------\ 2838 (Start T1-init timer) \ 2839 (Enter COOKIE-WAIT state) \---> (find a existing TCB 2840 compose temp TCB and Cookie_Z 2841 with Tie-Tags to previous 2842 association) 2843 /--- INIT ACK [Veri Tag=Tag_A', 2844 / I-Tag=Tag_Z', 2845 (Cancel T1-init timer) <------/ Cookie_Z[TieTags=Tag_A,Tag_Z 2846 & other info] 2847 (destroy temp TCB,leave original in place) 2848 COOKIE ECHO [Veri=Tag_Z', 2849 Cookie_Z 2850 Tie=Tag_A, 2851 Tag_Z]----------\ 2852 (Start T1-init timer) \ 2853 (Enter COOKIE-ECHOED state) \---> (Find existing association, 2854 Tie-Tags match old tags, 2855 Tags do not match i.e. 2856 case X X M M above, 2857 Announce Restart to ULP 2858 and reset association). 2859 /---- COOKIE-ACK 2860 / 2861 (Cancel T1-init timer, <-----/ 2862 Enter ESTABLISHED state) 2863 ... 2864 {app sends 1st user data; strm 0} 2865 DATA [TSN=initial TSN_A 2866 Strm=0,Seq=1 & user data]--\ 2867 (Start T3-rtx timer) \ 2868 \-> 2869 /----- SACK [TSN Ack=init TSN_A,Block=0] 2870 (Cancel T3-rtx timer) <------/ 2871 Figure 5: A Restart Example 2873 5.2.5 Handle Duplicate COOKIE-ACK. 2875 At any state other than COOKIE-ECHOED, an endpoint should silently 2876 discard a received COOKIE ACK chunk. 2878 5.2.6 Handle Stale COOKIE Error 2880 Receipt of an Operational ERROR chunk with a "Stale Cookie" error 2881 cause indicates one of a number of possible events: 2883 A) That the association failed to completely setup before the 2884 State Cookie issued by the sender was processed. 2886 B) An old State Cookie was processed after setup completed. 2888 C) An old State Cookie is received from someone that the receiver is 2889 not interested in having an association with and the ABORT 2890 chunk was lost. 2892 When processing an Operational ERROR chunk with a "Stale Cookie" error cause an 2893 endpoint should first examine if an association is in the process of 2894 being setup, i.e. the association is in the COOKIE-ECHOED state. In all 2895 cases if the association is NOT in the COOKIE-ECHOED state, the ERROR 2896 chunk should be silently discarded. 2898 If the association is in the COOKIE-ECHOED state, the endpoint may elect 2899 one of the following three alternatives. 2901 1) Send a new INIT chunk to the endpoint to generate a new State 2902 Cookie and re-attempt the setup procedure. 2904 2) Discard the TCB and report to the upper layer the inability to 2905 setup the association. 2907 3) Send a new INIT chunk to the endpoint, adding a Cookie 2908 Preservative parameter requesting an extension to the lifetime of 2909 the State Cookie. When calculating the time extension, an 2910 implementation SHOULD use the RTT information measured based on the 2911 previous COOKIE ECHO / ERROR exchange, and should add no more 2912 than 1 second beyond the measured RTT, due to long State Cookie 2913 lifetimes making the endpoint more subject to a replay attack. 2915 5.3 Other Initialization Issues 2917 5.3.1 Selection of Tag Value 2919 Initiate Tag values should be selected from the range of 1 to 2920 2**32 - 1. It is very important that the Initiate Tag value be 2921 randomized to help protect against "man in the middle" and "sequence 2922 number" attacks. The methods described in [RFC1750] can be used for 2923 the Initiate Tag randomization. Careful selection of Initiate Tags is 2924 also necessary to prevent old duplicate packets from previous 2925 associations being mistakenly processed as belonging to the current 2926 association. 2928 Moreover, the Verification Tag value used by either endpoint in a given 2929 association MUST NOT change during the lifetime of an 2930 association. A new Verification Tag value MUST be used each 2931 time the endpoint tears-down and then re-establishes an association to 2932 the same peer. 2934 6. User Data Transfer 2936 Data transmission MUST only happen in the ESTABLISHED, 2937 SHUTDOWN-PENDING, and SHUTDOWN-RECEIVED states. The only 2938 exception to this is that DATA chunks are allowed to be 2939 bundled with an outbound COOKIE ECHO chunk when in COOKIE-WAIT 2940 state. 2942 DATA chunks MUST only be received according to the rules below 2943 in ESTABLISHED, SHUTDOWN-PENDING, SHUTDOWN-SENT. A DATA chunk 2944 received in CLOSED is out of the blue and SHOULD be handled 2945 per 8.4. A DATA chunk received in any other state SHOULD be 2946 discarded. 2948 A SACK MUST be processed in ESTABLISHED, SHUTDOWN-PENDING, and 2949 SHUTDOWN-RECEIVED. An incoming SACK MAY be processed in 2950 COOKIE-ECHOED. A SACK in the CLOSED state is out of the blue 2951 and SHOULD be processed according to the rules in 8.4. A SACK 2952 chunk received in any other state SHOULD be discarded. 2954 A SCTP receiver MUST be able to receive a minimum of 1500 bytes 2955 in one SCTP packet. This means that a SCTP endpoint MUST NOT 2956 indicate less than 1500 bytes in its Initial a_rwnd sent in the 2957 INIT or INIT ACK. 2959 For transmission efficiency, SCTP defines mechanisms for bundling of 2960 small user messages and fragmentation of large user messages. 2961 The following diagram depicts the flow of user messages through SCTP. 2963 In this section the term "data sender" refers to the endpoint that 2964 transmits a DATA chunk and the term "data receiver" refers to the 2965 endpoint that receives a DATA chunk. A data receiver will transmit 2966 SACK chunks. 2968 +--------------------------+ 2969 | User Messages | 2970 +--------------------------+ 2971 SCTP user ^ | 2972 ==================|==|======================================= 2973 | v (1) 2974 +------------------+ +--------------------+ 2975 | SCTP DATA Chunks | |SCTP Control Chunks | 2976 +------------------+ +--------------------+ 2977 ^ | ^ | 2978 | v (2) | v (2) 2979 +--------------------------+ 2980 | SCTP packets | 2981 +--------------------------+ 2982 SCTP ^ | 2983 ===========================|==|=========================== 2984 | v 2985 Connectionless Packet Transfer Service (e.g., IP) 2987 Notes: 2988 (1) When converting user messages into DATA chunks, an endpoint 2989 will fragment user messages larger than the current association 2990 path MTU into multiple DATA chunks. The data receiver will 2991 normally reassemble the fragmented message from DATA chunks 2992 before delivery to the user (see Section 6.9 for details). 2994 (2) Multiple DATA and control chunks may be bundled by the 2995 sender into a single SCTP packet for transmission, as long as 2996 the final size of the packet does not exceed the current path 2997 MTU. The receiver will unbundle the packet back into 2998 the original chunks. Control chunks MUST come before 2999 DATA chunks in the packet. 3001 Figure 6: Illustration of User Data Transfer 3003 The fragmentation and bundling mechanisms, as detailed in Sections 6.9 3004 and 6.10, are OPTIONAL to implement by the data sender, but they MUST 3005 be implemented by the data receiver, i.e., an endpoint MUST 3006 properly receive and process bundled or fragmented data. 3008 6.1 Transmission of DATA Chunks 3010 This document is specified as if there is a single retransmission 3011 timer per destination transport address, but implementations MAY have 3012 a retransmission timer for each DATA chunk. 3014 The following general rules MUST be applied by the data sender for 3015 transmission and/or retransmission of outbound DATA chunks: 3017 A) At any given time, the data sender MUST NOT transmit new data to any 3018 destination transport address if its peer's rwnd indicates that the 3019 peer has no buffer space (i.e. rwnd is 0, see Section 6.2.1). 3020 However, regardless of the value of rwnd (including if it is 0), 3021 the data sender can always have one DATA chunk in flight to the 3022 receiver if allowed by cwnd (see rule B below). This rule 3023 allows the sender to probe for a change in rwnd that the sender 3024 missed due to the SACK having been lost in transit from 3025 the data receiver to the data sender. 3027 B) At any given time, the sender MUST NOT transmit new data to a 3028 given transport address if it has cwnd or more bytes of data 3029 outstanding to that transport address. 3031 C) When the time comes for the sender to transmit, before sending 3032 new DATA chunks, the sender MUST first transmit any outstanding 3033 DATA chunks which are marked for retransmission (limited by the 3034 current cwnd). 3036 D) Then, the sender can send out as many new DATA chunks as Rule A and 3037 Rule B above allow. 3039 Multiple DATA chunks committed for transmission MAY be 3040 bundled in a single packet. Furthermore, DATA chunks being 3041 retransmitted MAY be bundled with new DATA chunks, as long as the 3042 resulting packet size does not exceed the path MTU. A ULP 3043 may request that no bundling is performed but this should only turn off 3044 any delays that a SCTP implementation may be using to increase 3045 bundling efficiency. It does not in itself stop all bundling 3046 from occurring (i.e. in case of congestion or retransmission). 3048 Before an endpoint transmits a DATA chunk, if any received DATA 3049 chunks have not been acknowledged (e.g., due to delayed ack), the 3050 sender should create a SACK and bundle it with the outbound DATA 3051 chunk, as long as the size of the final SCTP packet does not exceed 3052 the current MTU. See Section 6.2. 3054 IMPLEMENTATION NOTE: When the window is full (i.e., transmission is 3055 disallowed by Rule A and/or Rule B), the sender MAY still accept 3056 send requests from its upper layer, but MUST transmit no more DATA 3057 chunks until some or all of the outstanding DATA chunks are 3058 acknowledged and transmission is allowed by Rule A and Rule B 3059 again. 3061 Whenever a transmission or retransmission is made to any address, if 3062 the T3-rtx timer of that address is not currently running, the sender 3063 MUST start that timer. If the timer for that address is already 3064 running, the sender MUST restart the timer if the earliest 3065 (i.e., lowest TSN) outstanding DATA chunk sent to that address is being 3066 retransmitted. Otherwise, the data sender MUST NOT restart the timer. 3068 When starting or restarting the T3-rtx timer, the timer value must be 3069 adjusted according to the timer rules defined in Sections 6.3.2, 3070 and 6.3.3. 3072 Note: The data sender SHOULD NOT use a TSN that is more than 3073 2**31 - 1 above the beginning TSN of the current send window. 3075 6.2 Acknowledgement on Reception of DATA Chunks 3077 The SCTP endpoint MUST always acknowledge the reception of each valid 3078 DATA chunk. 3080 The guidelines on delayed acknowledgement algorithm specified in 3081 Section 4.2 of [RFC2581] SHOULD be followed. Specifically, an 3082 acknowledgement SHOULD be generated for at least every second packet 3083 (not every second DATA chunk) received, and SHOULD be generated within 3084 200 ms of the arrival of any unacknowledged DATA chunk. In some 3085 situations it may be beneficial for an SCTP transmitter to be more 3086 conservative than the algorithms detailed in this document allow. 3087 However, an SCTP transmitter MUST NOT be more aggressive than the 3088 following algorithms allow. 3090 A SCTP receiver MUST NOT generate more than one SACK for every 3091 incoming packet, other than to update the offered window as the 3092 receiving application consumes new data. 3094 IMPLEMENTATION NOTE: The maximum delay for generating an 3095 acknowledgement may be configured by the SCTP administrator, either 3096 statically or dynamically, in order to meet the specific 3097 timing requirement of the protocol being carried. 3099 An implementation MUST NOT allow the maximum delay to be configured to 3100 be more than 500 ms. In other words an implementation MAY lower this 3101 value below 500ms but MUST NOT raise it above 500ms. 3103 Acknowledgements MUST be sent in SACK chunks unless shutdown was 3104 requested by the ULP in which case an endpoint MAY send an 3105 acknowledgement in the SHUTDOWN chunk. A SACK chunk can acknowledge the 3106 reception of multiple DATA chunks. See Section 3.3.4 for SACK chunk 3107 format. In particular, the SCTP endpoint MUST fill in the Cumulative 3108 TSN Ack field to indicate the latest sequential TSN (of a valid DATA 3109 chunk) it has received. Any received DATA chunks with TSN greater than 3110 the value in the Cumulative TSN Ack field SHOULD also be reported in 3111 the Gap Ack Block fields. 3113 Note: The SHUTDOWN chunk does not contain Gap Ack Block fields. 3114 Therefore, the endpoint should use a SACK instead of the SHUTDOWN 3115 chunk to acknowledge DATA chunks received out of order . 3117 When a packet arrives with duplicate DATA chunk(s) and with no new 3118 DATA chunk(s), the endpoint MUST immediately send a SACK with no 3119 delay. If a packet arrives with duplicate DATA chunk(s) bundled with 3120 new DATA chunks, the endpoint MAY immediately send a SACK. Normally 3121 receipt of duplicate DATA chunks will occur when the original SACK 3122 chunk was lost and the peer's RTO has expired. The duplicate TSN 3123 number(s) SHOULD be reported in the SACK as duplicate. 3125 When an endpoint receives a SACK, it MAY use the Duplicate TSN 3126 information to determine if SACK loss is occurring. Further use of 3127 this data is for future study. 3129 The data receiver is responsible for maintaining its receive buffers. 3130 The data receiver SHOULD notify the data sender in a timely manner of 3131 changes in its ability to receive data. How an implementation manages 3132 its receive buffers is dependent on many factors (e.g., Operating 3133 System, memory management system, amount of memory, etc.). However, 3134 the data sender strategy defined in Section 6.2.1 is based on the 3135 assumption of receiver operation similar to the following: 3137 A) At initialization of the association, the endpoint tells the 3138 peer how much receive buffer space it has allocated to the 3139 association in the INIT or INIT ACK. The endpoint sets a_rwnd 3140 to this value. 3142 B) As DATA chunks are received and buffered, decrement a_rwnd by 3143 the number of bytes received and buffered. This is, in effect, 3144 closing rwnd at the data sender and restricting the amount of 3145 data it can transmit. 3147 C) As DATA chunks are delivered to the ULP and released from the 3148 receive buffers, increment a_rwnd by the number of bytes 3149 delivered to the upper layer. This is, in effect, opening up 3150 rwnd on the data sender and allowing it to send more data. The 3151 data receiver SHOULD NOT increment a_rwnd unless it has released 3152 bytes from its receive buffer. For example, if the receiver is 3153 holding fragmented DATA chunks in a reassembly queue, it should 3154 not increment a_rwnd. 3156 D) When sending a SACK, the data receiver SHOULD place the 3157 current value of a_rwnd into the a_rwnd field. The data 3158 receiver SHOULD take into account that the data sender will not 3159 retransmit DATA chunks that are acked via the Cumulative TSN Ack 3160 (i.e., will drop from its retransmit queue). 3162 Under certain circumstances, the data receiver may need to drop 3163 DATA chunks that it has received but hasn't released from its receive 3164 buffers (i.e., delivered to the ULP). These DATA chunks may have 3165 been acked in Gap Ack Blocks. For example, the data receiver may be 3166 holding data in its receive buffers while reassembling a fragmented 3167 user message from its peer when it runs out of receive buffer space. 3168 It may drop these DATA chunks even though it has acknowledged them in 3169 Gap Ack Blocks. If a data receiver drops DATA chunks, it MUST NOT include 3170 them in Gap Ack Blocks in subsequent SACKs until they are received again 3171 via retransmission. In addition, the endpoint should take into account the 3172 dropped data when calculating its a_rwnd. 3174 An endpoint SHOULD NOT revoke a SACK and discard data. Only in extreme 3175 circumstance should an endpoint use this procedure (such as out of buffer 3176 space). The data receiver should take into account that dropping data that 3177 has been acked in Gap Ack Blocks can result in suboptimal retransmission 3178 strategies in the data sender and thus in suboptimal performance. 3180 The following example illustrates the use of delayed acknowledgements: 3182 Endpoint A Endpoint Z 3184 {App sends 3 messages; strm 0} 3185 DATA [TSN=7,Strm=0,Seq=3] ------------> (ack delayed) 3186 (Start T3-rtx timer) 3187 DATA [TSN=8,Strm=0,Seq=4] ------------> (send ack) 3188 /------- SACK [TSN Ack=8,block=0] 3189 (cancel T3-rtx timer) <-----/ 3190 ... 3191 ... 3193 DATA [TSN=9,Strm=0,Seq=5] ------------> (ack delayed) 3194 (Start T3-rtx timer) 3195 ... 3196 {App sends 1 message; strm 1} 3197 (bundle SACK with DATA) 3198 /----- SACK [TSN Ack=9,block=0] \ 3199 / DATA [TSN=6,Strm=1,Seq=2] 3200 (cancel T3-rtx timer) <------/ (Start T3-rtx timer) 3202 (ack delayed) 3203 ... 3204 (send ack) 3205 SACK [TSN Ack=6,block=0] -------------> (cancel T3-rtx timer) 3207 Figure 7: Delayed Acknowledgment Example 3209 If an endpoint receives a DATA chunk with no user data (i.e., the 3210 Length field is set to 16) it MUST send an ABORT with error cause set 3211 to "No User Data". 3213 An endpoint SHOULD NOT send a DATA chunk with no user data part. 3215 6.2.1 Processing a Received SACK 3217 Each SACK an endpoint receives contains an a_rwnd value. This value 3218 represents the amount of buffer space the data receiver, at the time 3219 of transmitting the SACK, has left of its total receive buffer space (as 3220 specified in the INIT/INIT ACK). Using a_rwnd, Cumulative TSN Ack and Gap 3221 Ack Blocks, the data sender can develop a representation of the peer's 3222 receive buffer space. 3224 One of the problems the data sender must take into account when processing 3225 a SACK is that a SACK can be received out of order. That is, a SACK sent 3226 by the data receiver can pass an earlier SACK and be received first by the 3227 data sender. If a SACK is received out of order, the data sender can 3228 develop an incorrect view of the peer's receive buffer space. 3230 Since there is no explicit identifier that can be used to detect 3231 out-of-order SACKs, the data sender must use heuristics to determine if a 3232 SACK is new. 3234 An endpoint SHOULD use the following rules to calculate the rwnd, using the 3235 a_rwnd value, the Cumulative TSN Ack and Gap Ack Blocks in a received SACK. 3237 A) At the establishment of the association, the endpoint 3238 initializes the rwnd to the Advertised Receiver Window 3239 Credit (a_rwnd) the peer specified in the INIT or INIT ACK. 3241 B) Any time a DATA chunk is transmitted (or retransmitted) 3242 to a peer, the endpoint subtracts the data size of the 3243 chunk from the rwnd of that peer. 3245 C) Any time a DATA chunk is marked for retransmission (via 3246 either T3-rtx timer expiration (Section 6.3.3)or via fast 3247 retransmit (Section 7.2.4)), add the data size of 3248 those chunks to the rwnd. 3250 Note: If the implementation is maintaining a timer on each 3251 DATA chunk then only DATA chunks whose timer expired would 3252 be marked for retransmission. 3254 D) Any time a SACK arrives, the endpoint performs the following: 3256 i) If Cumulative TSN Ack is less than the Cumulative TSN Ack Point, 3257 then drop the SACK. Since Cumulative TSN Ack is monotonically 3258 increasing, a SACK whose Cumulative TSN Ack is less than the 3259 Cumulative TSN Ack Point indicates an out-of-order SACK. 3261 ii) Set rwnd equal to the newly received a_rwnd minus the number 3262 of bytes still outstanding after processing the Cumulative TSN Ack 3263 and the Gap Ack Blocks. 3265 iii) If the SACK is missing a TSN that was previously 3266 acknowledged via a Gap Ack Block (e.g., the data receiver 3267 reneged on the data), then mark the corresponding DATA chunk 3268 as available for retransmit: Mark it as missing for fast 3269 retransmit as described in Section 7.2.4 and if no retransmit 3270 timer is running for the destination address to which the DATA 3271 chunk was originally transmitted, then T3-rtx is started for 3272 that destination address. 3274 6.3 Management of Retransmission Timer 3276 An SCTP endpoint uses a retransmission timer T3-rtx to ensure data 3277 delivery in the absence of any feedback from its peer. The duration of 3278 this timer is referred to as RTO (retransmission timeout). 3280 When an endpoint's peer is multi-homed, the endpoint will calculate a 3281 separate RTO for each different destination transport address of its 3282 peer endpoint. 3284 The computation and management of RTO in SCTP follows closely how 3285 TCP manages its retransmission timer. To compute the current RTO, an 3286 endpoint maintains two state variables per destination transport 3287 address: SRTT (smoothed round-trip time) and RTTVAR (round-trip time 3288 variation). 3290 6.3.1 RTO Calculation 3291 The rules governing the computation of SRTT, RTTVAR, and RTO are 3292 as follows: 3294 C1) Until an RTT measurement has been made for a packet sent 3295 to the given destination transport address, set RTO to the 3296 protocol parameter 'RTO.Initial'. 3298 C2) When the first RTT measurement R is made, set SRTT <- R, 3299 RTTVAR <- R/2, and RTO <- SRTT + 4 * RTTVAR. 3301 C3) When a new RTT measurement R' is made, set 3303 RTTVAR <- (1 - RTO.Beta) * RTTVAR + RTO.Beta * |SRTT - R'| 3304 SRTT <- (1 - RTO.Alpha) * SRTT + RTO.Alpha * R' 3306 Note: The value of SRTT used in the update to RTTVAR is its value 3307 before updating SRTT itself using the second assignment. 3309 After the computation, update RTO <- SRTT + 4 * RTTVAR. 3311 C4) When data is in flight and when allowed by rule C5 below, a new 3312 RTT measurement MUST be made each round trip. Furthermore, new RTT 3313 measurements SHOULD be made no more than once per round-trip for a 3314 given destination transport address. There are two reasons for this 3315 recommendation: First, it appears that measuring more frequently 3316 often does not in practice yield any significant benefit 3317 [ALLMAN99]; second, if measurements are made more often, then the 3318 values of RTO.Alpha and RTO.Beta in rule C3 above should be 3319 adjusted so that SRTT and RTTVAR still adjust to changes at roughly 3320 the same rate (in terms of how many round trips it takes them to 3321 reflect new values) as they would if making only one measurement 3322 per round-trip and using RTO.Alpha and RTO.Beta as given in rule 3323 C3. However, the exact nature of these adjustments remains a 3324 research issue. 3326 C5) Karn's algorithm: RTT measurements MUST NOT be made using 3327 packets that were retransmitted (and thus for which it is 3328 ambiguous whether the reply was for the first instance of the 3329 packet or a later instance). 3331 C6) Whenever RTO is computed, if it is less than RTO.Min seconds 3332 then it is rounded up to RTO.Min seconds. The reason for this 3333 rule is that RTOs that do not have a high minimum value are 3334 susceptible to unnecessary timeouts [ALLMAN99]. 3336 C7) A maximum value may be placed on RTO provided it is at least 3337 RTO.max seconds. 3339 There is no requirement for the clock granularity G used for computing 3340 RTT measurements and the different state variables, other than: 3342 G1) Whenever RTTVAR is computed, if RTTVAR = 0, then adjust 3343 RTTVAR <- G. 3345 Experience [ALLMAN99] has shown that finer clock granularities 3346 (<= 100 msec) perform somewhat better than more coarse granularities. 3348 6.3.2 Retransmission Timer Rules 3350 The rules for managing the retransmission timer are as follows: 3352 R1) Every time a DATA chunk is sent to any address (including 3353 a retransmission), if the T3-rtx timer of that address is not 3354 running, start it running so that it will expire after the RTO of 3355 that address. The RTO used here is that obtained after any doubling 3356 due to previous T3-rtx timer expirations on the corresponding 3357 destination address as discussed in rule E2 below. 3359 R2) Whenever all outstanding data sent to an address have been 3360 acknowledged, turn off the T3-rtx timer of that address. 3362 R3) Whenever a SACK is received that acknowledges the DATA chunk with 3363 the earliest outstanding TSN for that address, restart T3-rtx timer 3364 for that address with its current RTO. 3366 (R4) Whenever a SACK is received missing a TSN that was previously acknowledged 3367 via a Gap Ack Block, start T3-rtx for the destination address to which 3368 the DATA chunk was originally transmitted if it is not already running. 3370 The following example shows the use of various timer rules (assuming 3371 the receiver uses delayed acks). 3373 Endpoint A Endpoint Z 3374 {App begins to send} 3375 Data [TSN=7,Strm=0,Seq=3] ------------> (ack delayed) 3376 (Start T3-rtx timer) 3377 {App sends 1 message; strm 1} 3378 (bundle ack with data) 3379 DATA [TSN=8,Strm=0,Seq=4] ----\ /-- SACK [TSN Ack=7,Block=0] \ 3380 \ / DATA [TSN=6,Strm=1,Seq=2] 3381 \ / (Start T3-rtx timer) 3382 \ 3383 / \ 3384 (Re-start T3-rtx timer) <------/ \--> (ack delayed) 3385 (ack delayed) 3386 ... 3387 {send ack} 3388 SACK [TSN Ack=6,Block=0] --------------> (Cancel T3-rtx timer) 3389 .. 3390 (send ack) 3391 (Cancel T3-rtx timer) <-------------- SACK [TSN Ack=8,Block=0] 3393 Figure 8 - Timer Rule Examples 3395 6.3.3 Handle T3-rtx Expiration 3396 Whenever the retransmission timer T3-rtx expires for a destination 3397 address, do the following: 3399 E1) For the destination address for which the timer expires, adjust its 3400 ssthresh with rules defined in Section 7.2.3 and set the 3401 cwnd <- MTU. 3403 E2) For the destination address for which the timer expires, set 3404 RTO <- RTO * 2 ("back off the timer"). The maximum value discussed 3405 in rule C7 above (RTO.max) may be used to provide an upper bound 3406 to this doubling operation. 3408 E3) Determine how many of the earliest (i.e., lowest TSN) outstanding 3409 DATA chunks for the address for which the T3-rtx has expired will 3410 fit into a single packet, subject to the MTU constraint for the 3411 path corresponding to the destination transport address to which 3412 the retransmission is being sent (this may be different from the 3413 address for which the timer expires [see Section 6.4]). Call this 3414 value K. Bundle and retransmit those K DATA chunks in a single 3415 packet to the destination endpoint. 3417 E4) Start the retransmission timer T3-rtx on the destination address 3418 to which the retransmission is sent, if rule R1 above indicates to 3419 do so. The RTO to be used for starting T3-rtx should be the 3420 one for the destination address to which the retransmission is 3421 sent, which, when the receiver is multi-homed, may be different 3422 from the destination address for which the timer expired (see 3423 Section 6.4 below). 3425 After retransmitting, once a new RTT measurement is obtained 3426 (which can happen only when new data has been sent and acknowledged, 3427 per rule C5, or for a measurement made from a HEARTBEAT [see Section 3428 8.3]), the computation in rule C3 is performed, including the 3429 computation of RTO, which may result in "collapsing" RTO back down 3430 after it has been subject to doubling (rule E2). 3432 Note: Any DATA chunks that were sent to the address for which the 3433 T3-rtx timer expired but did not fit in one MTU (rule E3 above), 3434 should be marked for retransmission and sent as soon as cwnd allows 3435 (normally when a SACK arrives). 3437 The final rule for managing the retransmission timer concerns failover 3438 (see Section 6.4.1): 3440 F1) Whenever an endpoint switches from the current destination 3441 transport address to a different one, the current retransmission 3442 timers are left running. As soon as the endpoint transmits a packet 3443 containing DATA chunk(s) to the new transport address, start the 3444 timer on that transport address, using the RTO value of the 3445 destination address to which the data is being sent, if rule R1 3446 indicates to do so. 3448 6.4 Multi-homed SCTP Endpoints 3450 An SCTP endpoint is considered multi-homed if there are more than one 3451 transport address that can be used as a destination address to reach 3452 that endpoint. 3454 Moreover, the ULP of an endpoint shall select one of the multiple 3455 destination addresses of a multi-homed peer endpoint as the primary 3456 path (see Sections 5.1.2 and 10.1 for details). 3458 By default, an endpoint SHOULD always transmit to the primary 3459 path, unless the SCTP user explicitly specifies the destination 3460 transport address (and possibly source transport address) to use. 3462 An endpoint SHOULD transmit reply chunks (e.g., SACK, HEARTBEAT ACK, 3463 etc.) to the same destination transport address from which it received 3464 the DATA or control chunk to which it is replying. This rule should 3465 also be followed if the endpoint is bundling DATA chunks together 3466 with the reply chunk. 3468 However, when acknowledging multiple DATA chunks received in packets 3469 from different source addresses in a single SACK, the SACK chunk may be 3470 transmitted to one of the destination transport addresses from which 3471 the DATA or control chunks being acknowledged were received. 3473 When a receiver of a duplicate DATA chunk sends a SACK to a multi-homed 3474 endpoint it MAY be beneficial to vary the destination address and not 3475 use the source address of the DATA chunk. The reason being that 3476 receiving a duplicate from a multi-homed endpoint might indicate that 3477 the return path (as specified in the source address of the DATA chunk) 3478 for the SACK is broken. 3480 Furthermore, when its peer is multi-homed, an endpoint SHOULD try to 3481 retransmit a chunk to an active destination transport address that is 3482 different from the last destination address to which the DATA chunk was 3483 sent. 3485 Retransmissions do not affect the total outstanding data 3486 count. However, if the DATA chunk is retransmitted onto a different 3487 destination address, both the outstanding data counts on the new 3488 destination address and the old destination address to which the data 3489 chunk was last sent shall be adjusted accordingly. 3491 6.4.1 Failover from Inactive Destination Address 3493 Some of the transport addresses of a multi-homed SCTP endpoint may 3494 become inactive due to either the occurrence of certain error 3495 conditions (see Section 8.2) or adjustments from SCTP user. 3497 When there is outbound data to send and the primary path becomes 3498 inactive (e.g., due to failures), or where the SCTP user explicitly 3499 requests to send data to an inactive destination transport address, 3500 before reporting an error to its ULP, the SCTP endpoint should try to 3501 send the data to an alternate active destination transport address if 3502 one exists. 3504 When retransmitting data, if the endpoint is multi-homed, it should 3505 consider each source-destination address pair in its retransmission 3506 selection policy. When retransmitting the endpoint should attempt to 3507 pick the most divergent source-destination pair from the original 3508 source-destination pair to which the packet was transmitted. 3510 Note: Rules for picking the most divergent source-destination pair 3511 are an implementation decision and is not specified within this 3512 document. 3514 6.5 Stream Identifier and Stream Sequence Number 3516 Every DATA chunk MUST carry a valid stream identifier. If an endpoint 3517 receives a DATA chunk with an invalid stream identifier, it shall 3518 acknowledge the reception of the DATA chunk following the normal 3519 procedure, immediately send an ERROR chunk with cause set to "Invalid 3520 Stream Identifier" (see Section 3.3.10) and discard the DATA chunk. 3521 The endpoint may bundle the ERROR chunk in the same packet as the SACK 3522 as long as the ERROR follows the SACK. 3524 The stream sequence number in all the streams shall start from 0 3525 when the association is established. Also, when the stream sequence 3526 number reaches the value 65535 the next stream sequence number shall 3527 be set to 0. 3529 6.6 Ordered and Unordered Delivery 3531 Within a stream, an endpoint MUST deliver DATA chunks received with the 3532 U flag set to 0 to the upper layer according to the order of their 3533 stream sequence number. If DATA chunks arrive out of order of their 3534 stream sequence number, the endpoint MUST hold the received DATA chunks 3535 from delivery to the ULP until they are re-ordered. 3537 However, an SCTP endpoint can indicate that no ordered delivery is 3538 required for a particular DATA chunk transmitted within the stream by 3539 setting the U flag of the DATA chunk to 1. 3541 When an endpoint receives a DATA chunk with the U flag set to 1, it 3542 must bypass the ordering mechanism and immediately deliver the data to 3543 the upper layer (after re-assembly if the user data is fragmented by 3544 the data sender). 3546 This provides an effective way of transmitting "out-of-band" data in a 3547 given stream. Also, a stream can be used as an "unordered" stream by 3548 simply setting the U flag to 1 in all DATA chunks sent through that 3549 stream. 3551 IMPLEMENTATION NOTE: When sending an unordered DATA chunk, an 3552 implementation may choose to place the DATA chunk in an outbound 3553 packet that is at the head of the outbound transmission queue if 3554 possible. 3556 The 'Stream Sequence Number' field in a DATA chunk with U flag set to 1 3557 has no significance. The sender can fill it with arbitrary value, but 3558 the receiver MUST ignore the field. 3560 Note: When transmitting ordered and unordered data, an endpoint does 3561 not increment its Stream Sequence Number when transmitting a DATA 3562 chunk with U flag set to 1. 3564 6.7 Report Gaps in Received DATA TSNs 3566 Upon the reception of a new DATA chunk, an endpoint shall examine 3567 the continuity of the TSNs received. If the endpoint detects a gap 3568 in the received DATA chunk sequence, it SHOULD send a SACK with Gap Ack 3569 Blocks immediately. The data receiver continues sending a SACK after 3570 receipt of each SCTP packet that doesn't fill the gap. 3572 Based on the Gap Ack Block from the received SACK, the endpoint 3573 can calculate the missing DATA chunks and make decisions on whether to 3574 retransmit them (see Section 6.2.1 for details). 3576 Multiple gaps can be reported in one single SACK (see Section 3.3.4). 3578 When its peer is multi-homed, the SCTP endpoint SHOULD always 3579 try to send the SACK to the same destination address from which the 3580 last DATA chunk was received. 3582 Upon the reception of a SACK, the endpoint MUST remove all DATA 3583 chunks which have been acknowledged by the SACK's Cumulative TSN Ack 3584 from its transmit queue. The endpoint MUST also treat all the DATA 3585 chunks with TSNs not included in the Gap Ack Blocks reported by the 3586 SACK as "missing". The number of "missing" reports for each outstanding 3587 DATA chunk MUST be recorded by the data sender in order to make 3588 retransmission decisions. See Section 7.2.4 for details. 3590 The following example shows the use of SACK to report a gap. 3592 Endpoint A Endpoint Z 3593 {App sends 3 messages; strm 0} 3594 DATA [TSN=6,Strm=0,Seq=2] ---------------> (ack delayed) 3595 (Start T3-rtx timer) 3597 DATA [TSN=7,Strm=0,Seq=3] --------> X (lost) 3599 DATA [TSN=8,Strm=0,Seq=4] ---------------> (gap detected, 3600 immediately send ack) 3601 /----- SACK [TSN Ack=6,Block=1, 3602 / Strt=2,End=2] 3603 <-----/ 3604 (remove 6 from out-queue, 3605 and mark 7 as "1" missing report) 3606 Figure 9 - Reporting a Gap using SACK 3608 The maximum number of Gap Ack Blocks that can be reported within a 3609 single SACK chunk is limited by the current path MTU. When a single 3610 SACK can not cover all the Gap Ack Blocks needed to be reported due to 3611 the MTU limitation, the endpoint MUST send only one SACK, reporting the 3612 Gap Ack Blocks from the lowest to highest TSNs, within the size limit 3613 set by the MTU, and leave the remaining highest TSN numbers 3614 unacknowledged. 3616 6.8 Adler-32 Checksum Calculation 3618 When sending an SCTP packet, the endpoint MUST strengthen the data 3619 integrity of the transmission by including the Adler-32 checksum 3620 value calculated on the packet, as described below. 3622 After the packet is constructed (containing the SCTP common header 3623 and one or more control or DATA chunks), the transmitter shall: 3625 1) Fill in the proper Verification Tag in the SCTP common header and 3626 initialize the checksum field to 0's. 3628 2) Calculate the Adler-32 checksum of the whole packet, including the 3629 SCTP common header and all the chunks. Refer to appendix B 3630 for details of the Adler-32 algorithm. And, 3632 3) Put the resultant value into the checksum field in the 3633 common header, and leave the rest of the bits unchanged. 3635 When an SCTP packet is received, the receiver MUST first check the 3636 Adler-32 checksum: 3638 1) Store the received Adler-32 checksum value aside, 3640 2) Replace the 32 bits of the checksum field in the received 3641 SCTP packet with all '0's and calculate an Adler-32 checksum 3642 value of the whole received packet. And, 3644 3) Verify that the calculated Adler-32 checksum is the same as the 3645 received Adler-32 checksum, If not, the receiver MUST treat the 3646 packet as an invalid SCTP packet. 3648 The default procedure for handling invalid SCTP packets is to 3649 silently discard them. 3651 6.9 Fragmentation and Reassembly 3653 An endpoint MAY support fragmentation when sending DATA chunks, but 3654 MUST support reassembly when receiving DATA chunks. If an endpoint 3655 supports fragmentation, it MUST fragment a user message if the size of 3656 the user message to be sent causes the outbound SCTP packet size to 3657 exceed the current MTU. If an implementation does not support 3658 fragmentation of outbound user messages, the endpoint must return an 3659 error to its upper layer and not attempt to send the user message. 3661 IMPLEMENTATION NOTE: In this error case, the Send primitive 3662 discussed in Section 10.1 would need to return an error to the upper 3663 layer. 3665 If its peer is multi-homed, the endpoint shall choose a 3666 size no larger than the association Path MTU. The association Path 3667 MTU is the smallest Path MTU of all destination addresses. 3669 Note: Once a message is fragmented it cannot be re-fragmented. 3670 Instead if the PMTU has been reduced, then IP fragmentation must be 3671 used. Please see Section 7.3 for details of PMTU discovery. 3673 When determining when to fragment, the SCTP implementation MUST take 3674 into account the SCTP packet header as well as the DATA chunk 3675 header(s). The implementation MUST also take into account the space 3676 required for a SACK chunk if bundling a SACK chunk with the DATA chunk. 3678 Fragmentation takes the following steps: 3680 1) The data sender MUST break the user message into a series of 3681 DATA chunks such that each chunk plus SCTP overhead fits into an IP 3682 datagram smaller than or equal to the association Path MTU. 3684 2) The transmitter MUST then assign, in sequence, a separate TSN to 3685 each of the DATA chunks in the series. The transmitter assigns the 3686 same SSN to each of the DATA chunks. If the user indicates that the 3687 user message is to be delivered using unordered delivery, then the U 3688 flag of each DATA chunk of the user message MUST be set to 1. 3690 3) The transmitter MUST also set the B/E bits of the first DATA chunk 3691 in the series to '10', the B/E bits of the last DATA chunk in the 3692 series to '01', and the B/E bits of all other DATA chunks in the 3693 series to '00'. 3695 An endpoint MUST recognize fragmented DATA chunks by examining the B/E 3696 bits in each of the received DATA chunks, and queue the fragmented DATA 3697 chunks for re-assembly. Once the user message is reassembled, SCTP 3698 shall pass the re-assembled user message to the specific stream for 3699 possible re-ordering and final dispatching. 3701 Note: If the data receiver runs out of buffer space while still 3702 waiting for more fragments to complete the re-assembly of the 3703 message, it should dispatch part of its inbound message through a 3704 partial delivery API (see Section 10), freeing some of its receive 3705 buffer space so that the rest of the message may be received. 3707 6.10 Bundling 3709 An endpoint bundles chunks by simply including multiple chunks in one 3710 outbound SCTP packet. The total size of the resultant IP datagram, 3711 including the SCTP packet and IP headers, MUST be less or equal to the 3712 current Path MTU. 3714 If its peer endpoint is multi-homed, the sending endpoint shall choose 3715 a size no larger than the latest MTU of the current primary path. 3717 When bundling control chunks with DATA chunks, an endpoint MUST place 3718 control chunks first in the outbound SCTP packet. The transmitter 3719 MUST transmit DATA chunks within a SCTP packet in increasing order of 3720 TSN. 3721 Note: Since control chunks must be placed first in a packet and 3722 since DATA chunks must be transmitted before SHUTDOWN or SHUTDOWN ACK 3723 chunks, DATA chunks cannot be bundled with SHUTDOWN or SHUTDOWN ACK 3724 chunks. 3726 Partial chunks MUST NOT be placed in an SCTP packet. 3728 An endpoint MUST process received chunks in their order in the packet. 3729 The receiver uses the chunk length field to determine the end of a 3730 chunk and beginning of the next chunk taking account of the fact that 3731 all chunks end on a 4 byte boundary. If the receiver detects a partial 3732 chunk, it MUST drop the chunk. 3734 An endpoint MUST NOT bundle INIT, INIT ACK or SHUTDOWN COMPLETE with 3735 any other chunks. 3737 7. Congestion control 3739 Congestion control is one of the basic functions in SCTP. 3740 For some applications, it may be likely that adequate resources will 3741 be allocated to SCTP traffic to assure prompt delivery of 3742 time-critical data - thus it would appear to be unlikely, during 3743 normal operations, that transmissions encounter severe congestion 3744 conditions. However SCTP must operate under adverse operational 3745 conditions, which can develop upon partial network failures or 3746 unexpected traffic surges. In such situations SCTP must follow correct 3747 congestion control steps to recover from congestion quickly in order 3748 to get data delivered as soon as possible. In the absence of network 3749 congestion, these preventive congestion control algorithms should show 3750 no impact on the protocol performance. 3752 IMPLEMENTATION NOTE: As far as its specific performance requirements 3753 are met, an implementation is always allowed to adopt a more 3754 conservative congestion control algorithm than the one defined 3755 below. 3757 The congestion control algorithms used by SCTP are based on 3758 [RFC2581]. This section describes how the algorithms defined in 3759 RFC2581 are adapted for use in SCTP. We first list differences in 3760 protocol designs between TCP and SCTP, and then describe SCTP's 3761 congestion control scheme. The description will use the same 3762 terminology as in TCP congestion control whenever appropriate. 3764 SCTP congestion control is always applied to the entire association, 3765 and NOT to individual streams. 3767 7.1 SCTP Differences from TCP Congestion control 3769 Gap Ack Blocks in the SCTP SACK carry the same semantic meaning as the 3770 TCP SACK. TCP considers the information carried in the SACK as advisory 3771 information only. SCTP considers the information carried in the Gap Ack 3772 Blocks in the SACK chunk as advisory. In SCTP, any DATA chunk that has 3773 been acknowledged by SACK, including DATA that arrived at the receiving 3774 end out of order, are NOT considered fully delivered until the 3775 Cumulative TSN Ack Point passes the TSN of the DATA chunk (i.e., the 3777 DATA chunk has been acknowledged by the Cumulative TSN Ack field in the 3778 SACK). Consequently, the value of cwnd controls the amount of 3779 outstanding data, rather than (as in the case of non-SACK TCP) the 3780 upper bound between the highest acknowledged sequence number and the 3781 latest DATA chunk that can be sent within the congestion window. SCTP 3782 SACK leads to different implementations of fast-retransmit and fast- 3783 recovery than non-SACK TCP. As an example see [FALL96]. 3785 The biggest difference between SCTP and TCP, however, is multi-homing. 3786 SCTP is designed to establish robust communication associations 3787 between two endpoints each of which may be reachable by more than one 3788 transport address. Potentially different addresses may lead to 3789 different data paths between the two endpoints, thus ideally one may 3790 need a separate set of congestion control parameters for each of the 3791 paths. The treatment here of congestion control for multi-homed 3792 receivers is new with SCTP and may require refinement in the 3793 future. The current algorithms make the following assumptions: 3795 o The sender usually uses the same destination address until being 3796 instructed by the upper layer otherwise; however, SCTP may change to 3797 an alternate destination in the event an address is marked inactive 3798 (see Section 8.2). Also, SCTP may retransmit to a different 3799 transport address than the original transmission. 3801 o The sender keeps a separate congestion control parameter set for each 3802 of the destination addresses it can send to (NOT each 3803 source-destination pair but for each destination) . The parameters 3804 should decay if the address is not used for a long enough 3805 time period. 3807 o For each of the destination addresses, an endpoint does slow-start 3808 upon the first transmission to that address. 3810 Note: TCP guarantees in-sequence delivery of data to its upper-layer 3811 protocol within a single TCP session. This means that when TCP 3812 notices a gap in the received sequence number, it waits until 3813 the gap is filled before delivering the data that was received 3814 with sequence numbers higher than that of the missing data. On 3815 the other hand, SCTP can deliver data to its upper-layer 3816 protocol even if there is a gap in TSN if the Stream Sequence 3817 Numbers are in sequence for a particular stream (i.e., the 3818 missing DATA chunks are for a different stream) or if unordered 3819 delivery is indicated. Although this does not affect cwnd, it 3820 might affect rwnd calculation. 3822 7.2 SCTP Slow-Start and Congestion Avoidance 3824 The slow start and congestion avoidance algorithms MUST be used by an 3825 endpoint to control the amount of data being injected into the network. 3826 The congestion control in SCTP is employed in regard to the 3827 association, not to an individual stream. In some situations it 3828 may be beneficial for an SCTP sender to be more conservative than the 3829 algorithms allow; however, an SCTP sender MUST NOT be more aggressive 3830 than the following algorithms allow. 3832 Like TCP, an SCTP endpoint uses the following three control variables 3833 to regulate its transmission rate. 3835 o Receiver advertised window size (rwnd, in bytes), which is set by 3836 the receiver based on its available buffer space for incoming 3837 packets. 3839 Note: This variable is kept on the entire association. 3841 o Congestion control window (cwnd, in bytes), which is adjusted by 3842 the sender based on observed network conditions. 3844 Note: This variable is maintained on a per-destination address basis. 3846 o Slow-start threshold (ssthresh, in bytes), which is used by the 3847 sender to distinguish slow start and congestion avoidance phases. 3849 Note: This variable is maintained on a per-destination address basis. 3851 SCTP also requires one additional control variable, 3852 partial_bytes_acked, which is used during congestion avoidance phase to 3853 facilitate cwnd adjustment. 3855 Unlike TCP, an SCTP sender MUST keep a set of these control variables 3856 for EACH destination address of its peer (when its peer is multi- 3857 homed). 3859 7.2.1 Slow-Start 3861 Beginning data transmission into a network with unknown conditions or 3862 after a sufficiently long idle period requires SCTP to probe the 3863 network to determine the available capacity. The slow start algorithm 3864 is used for this purpose at the beginning of a transfer, or after 3865 repairing loss detected by the retransmission timer. 3867 o The initial cwnd before data transmission or after a sufficiently 3868 long idle period MUST be <= 2*MTU. 3870 o The initial cwnd after a retransmission timeout MUST be no more 3871 than 1*MTU. 3873 o The initial value of ssthresh MAY be arbitrarily high (for example, 3874 implementations MAY use the size of the receiver advertised window). 3876 o Whenever cwnd is greater than zero, the endpoint is allowed to have 3877 cwnd bytes of data outstanding on that transport address. 3879 o When cwnd is less than or equal to ssthresh an SCTP endpoint MUST use 3880 the slow start algorithm to increase cwnd (assuming the current 3881 congestion window is being fully utilized). If an incoming SACK 3882 advances the Cumulative TSN Ack Point, cwnd MUST be increased by at 3884 most the lesser of 1) the total size of the previously outstanding 3885 DATA chunk(s) acknowledged, and 2) the destination's path MTU. 3886 This protects against the ACK-Splitting attack outlined in 3887 [SAVAGE99]. 3889 In instances where its peer endpoint is multi-homed, if an endpoint 3890 receives a SACK that advances its Cumulative TSN Ack Point, then it 3891 should update its cwnd (or cwnds) apportioned to the destination 3892 addresses to which it transmitted the acknowledged data. However if 3893 the received SACK does not advance the Cumulative TSN Ack Point, the 3894 endpoint MUST NOT adjust the cwnd of any of the destination 3895 addresses. 3897 Because an endpoint's cwnd is not tied to its Cumulative TSN Ack 3898 Point, as duplicate SACKs come in, even though they may not advance 3899 the Cumulative TSN Ack Point an endpoint can still use them to clock 3900 out new data. That is, the data newly acknowledged by the SACK 3901 diminishes the amount of data now in flight to less than cwnd; and so 3902 the current, unchanged value of cwnd now allows new data to be sent. 3903 On the other hand, the increase of cwnd must be tied to the 3904 Cumulative TSN Ack Point advancement as specified above. Otherwise 3905 the duplicate SACKs will not only clock out new data, but also will 3906 adversely clock out more new data than what has just left the 3907 network, during a time of possible congestion. 3909 o When the endpoint does not transmit data on a given transport 3910 address, the cwnd of the transport address should be adjusted to 3911 max(cwnd/2, 2*MTU) per RTO. 3913 7.2.2 Congestion Avoidance 3915 When cwnd is greater than ssthresh, cwnd should be incremented 3916 by 1*MTU per RTT if the sender has cwnd or more bytes of data 3917 outstanding for the corresponding transport address. 3919 In practice an implementation can achieve this goal in the 3920 following way: 3922 o partial_bytes_acked is initialized to 0. 3924 o Whenever cwnd is greater than ssthresh, upon each SACK arrival that 3925 advances the Cumulative TSN Ack Point, increase partial_bytes_acked 3926 by the total number of bytes of all new chunks acknowledged in that 3927 SACK including chunks acknowledged by the new Cumulative TSN Ack and 3928 by Gap Ack Blocks. 3930 o When partial_bytes_acked is equal to or greater than cwnd and before 3931 the arrival of the SACK the sender had cwnd or more bytes of data 3932 outstanding (i.e., before arrival of the SACK, flightsize was greater 3933 than or equal to cwnd), increase cwnd by MTU, and reset 3934 partial_bytes_acked to (partial_bytes_acked - cwnd). 3936 o Same as in the slow start, when the sender does not transmit data on 3937 a given transport address, the cwnd of the transport address should 3938 be adjusted to max(cwnd / 2, 2*MTU) per RTO. 3940 o When all of the data transmitted by the sender has been acknowledged 3941 by the receiver, partial_bytes_acked is initialized to 0. 3943 7.2.3 Congestion Control 3945 Upon detection of packet losses from SACK (see Section 7.2.4), 3946 An endpoint should do the following: 3948 ssthresh = max(cwnd/2, 2*MTU) 3949 cwnd = ssthresh 3951 Basically, a packet loss causes cwnd to be cut in half. 3953 When the T3-rtx timer expires on an address, SCTP should perform 3954 slow start by: 3956 ssthresh = max(cwnd/2, 2*MTU) 3957 cwnd = 1*MTU 3959 and assure that no more than one DATA chunk will be in flight for that 3960 address until the endpoint receives acknowledgement for successful 3961 delivery of data to that address. 3963 7.2.4 Fast Retransmit on Gap Reports 3965 In the absence of data loss, an endpoint performs delayed 3966 acknowledgement. However, whenever an endpoint notices a hole in the 3967 arriving TSN sequence, it SHOULD start sending a SACK back every time 3968 a packet arrives carrying data until the hole is filled. 3970 Whenever an endpoint receives a SACK that indicates some TSN(s) 3971 missing, it SHOULD wait for 3 further miss indications (via subsequent 3972 SACK's) on the same TSN(s) before taking action with regard to Fast 3973 Retransmit. 3975 When the TSN(s) is reported as missing in the fourth consecutive SACK, 3976 the data sender shall: 3978 1) Mark the missing DATA chunk(s) for retransmission, 3980 2) Adjust the ssthresh and cwnd of the destination address(es) to which 3981 the missing DATA chunks were last sent, according to the formula 3982 described in Section 7.2.3. 3984 3) Determine how many of the earliest (i.e., lowest TSN) DATA 3985 chunks marked for retransmission will fit into a single packet, 3986 subject to constraint of the path MTU of the destination transport 3987 address to which the packet is being sent. Call this value K. 3988 Retransmit those K DATA chunks in a single packet. 3990 4) Restart T3-rtx timer only if the last SACK acknowledged the lowest 3991 outstanding TSN number sent to that address, or the endpoint is 3992 retransmitting the first outstanding DATA chunk sent to that 3993 address. 3995 Note: Before the above adjustments, if the received SACK also 3996 acknowledges new DATA chunks and advances the Cumulative TSN Ack 3997 Point, the cwnd adjustment rules defined in Sections 7.2.1 and 7.2.2 3998 must be applied first. 4000 A straightforward implementation of the above keeps a counter for each 4001 TSN hole reported by a SACK. The counter increments for each 4002 consecutive SACK reporting the TSN hole. After reaching 4 and starting 4003 the fast retransmit procedure, the counter resets to 0. 4005 Because cwnd in SCTP indirectly bounds the number of outstanding 4006 TSN's, the effect of TCP fast-recovery is achieved automatically with 4007 no adjustment to the congestion control window size. 4009 7.3 Path MTU Discovery 4011 [RFC1191] specifies "Path MTU Discovery", whereby an endpoint 4012 maintains an estimate of the maximum transmission unit (MTU) along a 4013 given Internet path and refrains from sending packets along that path 4014 which exceed the MTU, other than occasional attempts to probe for a 4015 change in the Path MTU (PMTU). RFC 1191 is thorough in its discussion 4016 of the MTU discovery mechanism and strategies for determining the 4017 current end-to-end MTU setting as well as detecting changes in this 4018 value. [RFC1981] specifies the same mechanisms for IPv6. An SCTP 4019 sender using IPv6 MUST use Path MTU Discovery unless all packets are 4020 less than the minimum IPv6 MTU [RFC2460]. 4022 An endpoint SHOULD apply these techniques, and SHOULD do so on a 4023 per-destination-address basis. 4025 There are 4 ways in which SCTP differs from the description in RFC 1191 4026 of applying MTU discovery to TCP: 4028 1) SCTP associations can span multiple addresses. 4029 An endpoint MUST maintain separate MTU estimates for each 4030 destination address of its peer. 4032 2) Elsewhere in this document, when the term "MTU" is discussed, 4033 it refers to the MTU associated with the destination address 4034 corresponding to the context of the discussion. 4036 3) Unlike TCP, SCTP does not have a notion of "Maximum Segment 4037 Size". Accordingly, the MTU for each destination address 4038 SHOULD be initialized to a value no larger than the link MTU 4039 for the local interface to which packets for that remote 4040 destination address will be routed. 4042 4) Since data transmission in SCTP is naturally structured in 4043 terms of TSNs rather than bytes (as is the case for TCP), the 4044 discussion in Section 6.5 of RFC 1191 applies: When retransmitting 4045 an IP datagram to a remote address for which the IP datagram 4046 appears too large for the path MTU to that address, the IP datagram 4047 SHOULD be retransmitted without the DF bit set, allowing it to 4048 possibly be fragmented. Transmissions of new IP datagrams MUST have 4049 DF set. 4051 5) The sender should track an association PMTU which will be 4052 the smallest PMTU discovered for all of the peer's destination 4053 addresses. When fragmenting messages into multiple parts this 4054 association PMTU should be used to calculate the size of 4055 each fragment. This will allow retransmissions to be seamlessly 4056 sent to an alternate address without encountering IP fragmentation. 4058 Other than these differences, the discussion of TCP's use of MTU 4059 discovery in RFCs 1191 and 1981 applies to SCTP on a 4060 per-destination-address basis. 4062 Note: For IPv6 destination addresses the DF bit does not exist, 4063 instead the IP datagram must be fragmented as described in [RFC2460]. 4065 8. Fault Management 4067 8.1 Endpoint Failure Detection 4069 An endpoint shall keep a counter on the total number of consecutive 4070 retransmissions to its peer (including retransmissions to all the 4071 destination transport addresses of the peer if it is multi-homed). If 4072 the value of this counter exceeds the limit indicated in the protocol 4073 parameter 'Association.Max.Retrans', the endpoint shall consider the 4074 peer endpoint unreachable and shall stop transmitting any more data to 4075 it (and thus the association enters the CLOSED state). In addition, the 4076 endpoint shall report the failure to the upper layer, and optionally 4077 report back all outstanding user data remaining in its outbound queue. 4078 The association is automatically closed when the peer endpoint 4079 becomes unreachable. 4081 The counter shall be reset each time a DATA chunk sent to that peer 4082 endpoint is acknowledged (by the reception of a SACK), or a HEARTBEAT- 4083 ACK is received from the peer endpoint. 4085 8.2 Path Failure Detection 4086 When its peer endpoint is multi-homed, an endpoint should keep a error 4087 counter for each of the destination transport addresses of the peer 4088 endpoint. 4090 Each time the T3-rtx timer expires on any address, or when a HEARTBEAT 4091 sent to an idle address is not acknowledged within a RTO, the error 4092 counter of that destination address will be incremented. When the 4093 value in the error counter exceeds the protocol parameter 4094 'Path.Max.Retrans' of that destination address, the endpoint should 4095 mark the destination transport address as inactive, and a notification 4096 SHOULD be sent to the upper layer. 4098 When an outstanding TSN is acknowledged or a HEARTBEAT sent to that 4099 address is acknowledged with a HEARTBEAT ACK, the endpoint shall 4100 clear the error counter of the destination transport address 4101 to which the DATA chunk was last sent (or HEARTBEAT was sent). When the 4102 peer endpoint is multi-homed and the last chunk sent to it was a 4103 retransmission to an alternate address, there exists an ambiguity as to 4104 whether or not the acknowledgement should be credited to the address of 4105 the last chunk sent. However, this ambiguity does not seem to bear any 4106 significant consequence to SCTP behavior. If this ambiguity is 4107 undesirable, the transmitter may choose not to clear the 4108 error counter if the last chunk sent was a retransmission. 4110 Note: When configuring the SCTP endpoint, the user should avoid 4111 having the value of 'Association.Max.Retrans' larger than the 4112 summation of the 'Path.Max.Retrans' of all the destination addresses 4113 for the remote endpoint. Otherwise, all the destination addresses may 4114 become inactive while the endpoint still considers the peer endpoint 4115 reachable. When this condition occurs, how the SCTP chooses to 4116 function is implementation specific. 4118 When the primary path is marked inactive (due to excessive 4119 retransmissions, for instance), the sender MAY automatically transmit 4120 new packets to an alternate destination address if one exists and is 4121 active. If more than one alternate address is active when the primary 4122 path is marked inactive only ONE transport address SHOULD be chosen 4123 and used as the new destination transport address. 4125 8.3 Path Heartbeat 4127 By default, an SCTP endpoint shall monitor the reachability of the 4128 idle destination transport address(es) of its peer by sending a 4129 HEARTBEAT chunk periodically to the destination transport 4130 address(es). 4132 A destination transport address is considered "idle" if no new chunk 4133 which can be used for updating path RTT (usually including first 4134 transmission DATA, INIT, COOKIE ECHO, HEARTBEAT etc.) and no 4135 HEARTBEAT has been sent to it within the current heartbeat period of 4136 that address. This applies to both active and inactive destination 4137 addresses. 4139 The upper layer can optionally initiate the following functions: 4141 A) Disable heartbeat on a specific destination transport address of a 4142 given association, 4143 B) Change the HB.interval, 4144 C) Re-enable heartbeat on a specific destination transport address of 4145 a given association, and, 4146 D) Request an on-demand HEARTBEAT on a specific destination transport 4147 address of a given association. 4149 The endpoint should increment the respective error counter 4150 of the destination transport address each time a HEARTBEAT is sent to 4151 that address and not acknowledged within one RTO. 4153 When the value of this counter reaches the protocol parameter 4154 'Path.Max.Retrans', the endpoint should mark the corresponding 4155 destination address as inactive if it is not so marked, and may also 4156 optionally report to the upper layer the change of reachability of 4157 this destination address. After this, the endpoint should continue 4158 HEARTBEAT on this destination address but should stop increasing the 4159 counter. 4161 The sender of the HEARTBEAT chunk should include in the Heartbeat 4162 Information field of the chunk the current time when the packet is 4163 sent out and the destination address to which the packet is sent. 4165 IMPLEMENTATION NOTE: An alternative implementation of the heartbeat 4166 mechanism that can be used is to increment the error counter 4167 variable every time a HEARTBEAT is sent to a destination. Whenever 4168 a HEARTBEAT ACK arrives, the sender SHOULD clear the 4169 error counter of the destination that the HEARTBEAT was 4170 sent to. This in effect would clear the previously stroked 4171 error (and any other error counts as well). 4173 The receiver of the HEARTBEAT should immediately respond with a 4174 HEARTBEAT ACK that contains the Heartbeat Information field copied 4175 from the received HEARTBEAT chunk. 4177 Upon the receipt of the HEARTBEAT ACK, the sender of the HEARTBEAT 4178 should clear the error counter of the destination transport 4179 address to which the HEARTBEAT was sent, and mark the destination 4180 transport address as active if it is not so marked. The endpoint may 4181 optionally report to the upper layer when an inactive destination 4182 address is marked as active due to the reception of the latest 4183 HEARTBEAT ACK. The receiver of the HEARTBEAT ACK must also 4184 clear the association overall error count as well (as defined 4185 in section 8.1). 4187 The receiver of the HEARTBEAT ACK should also perform an RTT 4188 measurement for that destination transport address using the time 4189 value carried in the HEARTBEAT ACK chunk. 4191 On an idle destination address that is allowed to heartbeat, a HEARTBEAT 4192 chunk is RECOMMENDED to be sent once per RTO of that destination 4193 address plus the protocol parameter 'HB.interval' , with 4194 jittering of +/- 50%, and exponential back-off of the RTO if the 4195 previous HEARTBEAT is unanswered. 4197 A primitive is provided for the SCTP user to change the HB.interval 4198 and turn on or off the heartbeat on a given destination address. The 4199 heartbeat interval set by the SCTP user is added to the RTO of that 4200 destination (including any exponential backoff). Only one heartbeat 4201 should be sent each time the heartbeat timer expires (if multiple 4202 destinations are idle). It is a implementation decision on how to 4203 choose which of the candidate idle destinations to heartbeat to (if 4204 more than one destination is idle). 4206 Note: When tuning the heartbeat interval, there is a side effect that 4207 SHOULD be taken into account. When this value is increased, i.e. the 4208 HEARTBEAT takes longer, the detection of lost ABORT messages takes 4209 longer as well. If a peer endpoint ABORTs the association for 4210 any reason and the ABORT chunk is lost, the local endpoint will only 4211 discover the lost ABORT by sending a DATA chunk or HEARTBEAT chunk 4212 (thus causing the peer to send another ABORT). This must be considered 4213 when tuning the HEARBEAT timer. If the HEARTBEAT is disabled only 4214 sending DATA to the association will discover a lost ABORT from the 4215 peer. 4217 8.4 Handle "Out of the blue" Packets 4219 An SCTP packet is called an "out of the blue" (OOTB) packet if it 4220 is correctly formed, i.e., passed the receiver's Adler-32 check (see 4221 Section 6.8), but the receiver is not able to identify the association 4222 to which this packet belongs. 4224 The receiver of an OOTB packet MUST do the following: 4226 1) If the OOTB packet is to or from a non-unicast address, silently 4227 discard the packet. Otherwise, 4229 2) If the OOTB packet contains an ABORT chunk, the receiver MUST 4230 silently discard the OOTB packet and take no further action. 4231 Otherwise, 4233 3) If the packet contains an INIT chunk with a Verification Tag set to 4234 '0', process it as described in Section 5.1. Otherwise, 4236 4) If the packet contains a COOKIE ECHO in the first chunk, process it 4237 as described in Section 5.1. Otherwise, 4239 5) If the packet contains a SHUTDOWN ACK chunk, the receiver should 4240 respond to the sender of the OOTB packet with a SHUTDOWN COMPLETE. 4241 When sending the SHUTDOWN COMPLETE, the receiver of the OOTB packet 4242 must fill in the Verification Tag field of the outbound packet with 4243 the Verification Tag received in the SHUTDOWN ACK and set the 4244 T-bit in the Chunk Flags to indicate that no TCB was found. 4246 Otherwise, 4248 6) If the packet contains a SHUTDOWN COMPLETE chunk, the receiver 4249 should silently discard the packet and take no further action. 4250 Otherwise, 4252 7) If the packet contains a "Stale cookie" ERROR or a COOKIE ACK 4253 the SCTP Packet should be silently discarded. Otherwise, 4255 8) The receiver should respond to the sender of the OOTB packet with 4256 an ABORT. When sending the ABORT, the receiver of the OOTB packet 4257 MUST fill in the Verification Tag field of the outbound packet 4258 with the value found in the Verification Tag field of the OOTB 4259 packet and set the T-bit in the Chunk Flags to indicate that no 4260 TCB was found. After sending this ABORT, the receiver of the 4261 OOTB packet shall discard the OOTB packet and take no further 4262 action. 4264 8.5 Verification Tag 4266 The Verification Tag rules defined in this section apply when sending 4267 or receiving SCTP packets which do not contain an INIT, SHUTDOWN 4268 COMPLETE, COOKIE ECHO (see Section 5.1) or ABORT chunk. The rules for 4269 sending and receiving SCTP packets containing one of these chunk types 4270 are discussed separately in Section 8.5.1. 4272 When sending an SCTP packet, the endpoint MUST fill in the Verification 4273 Tag field of the outbound packet with the tag value in the Initiate Tag 4274 parameter of the INIT or INIT ACK received from its peer. 4276 When receiving an SCTP packet, the endpoint MUST ensure that the 4277 value in the Verification Tag field of the received SCTP packet 4278 matches its own Tag. If the received Verification Tag value does not 4279 match the receiver's own tag value, the receiver shall silently 4280 discard the packet and shall not process it any further except for 4281 those cases listed in Section 8.5.1 below. 4283 8.5.1 Exceptions in Verification Tag Rules 4285 A) Rules for packet carrying INIT: 4287 - The sender MUST set the Verification Tag of the packet to 0. 4289 - When an endpoint receives an SCTP packet with the Verification Tag 4290 set to 0, it should verify that the packet contains only an INIT 4291 chunk. Otherwise, the receiver MUST silently discard the packet. 4293 B) Rules for packet carrying ABORT: 4295 - The endpoint shall always fill in the Verification Tag field of the 4296 outbound packet with the destination endpoint's tag value if it 4297 is known. 4299 - If the ABORT is sent in response to an OOTB packet, the endpoint 4300 MUST follow the procedure described in Section 8.4. 4302 - The receiver MUST accept the packet if the Verification Tag 4303 matches either its own tag, OR the tag of its peer. Otherwise, the 4304 receiver MUST silently discard the packet and take no further 4305 action. 4307 C) Rules for packet carrying SHUTDOWN COMPLETE: 4309 - When sending a SHUTDOWN COMPLETE, if the receiver of the SHUTDOWN 4310 ACK has a TCB then the destination endpoint's tag MUST be used. Only 4311 where no TCB exists should the sender use the Verification Tag from 4312 the SHUTDOWN ACK. 4314 - The receiver of a SHUTDOWN COMPLETE shall accept the packet if the 4315 Verification Tag field of the packet matches its own tag OR it is 4316 set to its peer's tag and the T bit is set in the Chunk Flags. 4317 Otherwise, the receiver MUST silently discard the packet and take 4318 no further action. An endpoint MUST ignore the SHUTDOWN COMPLETE if 4319 it is not in the SHUTDOWN-ACK-SENT state. 4321 D) Rules for packet carrying a COOKIE ECHO 4323 - When sending a COOKIE ECHO, the endpoint MUST use the value of the 4324 Initial Tag received in the INIT ACK. 4326 - The receiver of a COOKIE ECHO follows the procedures in Section 5. 4328 E) Rules for packet carrying a SHUTDOWN ACK 4330 - If the receiver is in COOKIE-ECHOED or COOKIE-WAIT state the procedures 4331 in section 8.4 SHOULD be followed, in other words it should be 4332 treated as an Out Of The Blue packet. 4334 9. Termination of Association 4336 An endpoint should terminate its association when it exits from 4337 service. An association can be terminated by either abort or 4338 shutdown. An abort of an association is abortive by definition in that 4339 any data pending on either end of the association is discarded and NOT 4340 delivered to the peer. A shutdown of an association is considered a 4341 graceful close where all data in queue by either endpoint is delivered 4342 to the respective peers. However, in the case of a shutdown, SCTP does 4343 not support a half-open state (like TCP) wherein one side may continue 4344 sending data while the other end is closed. When either endpoint 4345 performs a shutdown, the association on each peer will stop accepting 4346 new data from its user and only deliver data in queue at the time of 4347 sending or receiving the SHUTDOWN chunk. 4349 9.1 Abort of an Association 4350 When an endpoint decides to abort an existing association, it 4351 shall send an ABORT chunk to its peer endpoint. The sender MUST fill 4352 in the peer's Verification Tag in the outbound packet and MUST NOT 4353 bundle any DATA chunk with the ABORT. 4355 An endpoint MUST NOT respond to any received packet that contains an 4356 ABORT chunk (also see Section 8.4). 4358 An endpoint receiving an ABORT shall apply the special Verification Tag 4359 check rules described in Section 8.5.1. 4361 After checking the Verification Tag, the receiving endpoint shall 4362 remove the association from its record, and shall report the 4363 termination to its upper layer. 4365 9.2 Shutdown of an Association 4367 Using the SHUTDOWN primitive (see Section 10.1), the upper layer of an 4368 endpoint in an association can gracefully close the association. 4369 This will allow all outstanding DATA chunks from the peer of 4370 the shutdown initiator to be delivered before the association 4371 terminates. 4373 Upon receipt of the SHUTDOWN primitive from its upper layer, the 4374 endpoint enters SHUTDOWN-PENDING state and remains there until all 4375 outstanding data has been acknowledged by its peer. The endpoint 4376 accepts no new data from its upper layer, but retransmits data to the 4377 far end if necessary to fill gaps. 4379 Once all its outstanding data has been acknowledged, the endpoint 4380 shall send a SHUTDOWN chunk to its peer including in the Cumulative 4381 TSN Ack field the last sequential TSN it has received from the peer. 4382 It shall then start the T2-shutdown timer and enter the SHUTDOWN-SENT 4383 state. If the timer expires, the endpoint must re-send the SHUTDOWN 4384 with the updated last sequential TSN received from its peer. 4386 The rules in Section 6.3 MUST be followed to determine the proper timer 4387 value for T2-shutdown. To indicate any gaps in TSN, the endpoint may 4388 also bundle a SACK with the SHUTDOWN chunk in the same SCTP packet. 4390 An endpoint should limit the number of retransmissions of the SHUTDOWN 4391 chunk to the protocol parameter 'Association.Max.Retrans'. If this 4392 threshold is exceeded the endpoint should destroy the TCB and MUST 4393 report the peer endpoint unreachable to the upper layer (and thus the 4394 association enters the CLOSED state). The reception of any packet from 4395 its peer (i.e. as the peer sends all of its queued DATA chunks) should 4396 clear the endpoint's retransmission count and restart the T2-Shutdown 4397 timer, giving its peer ample opportunity to transmit all of its queued 4398 DATA chunks that have not yet been sent. 4400 Upon the reception of the SHUTDOWN, the peer endpoint shall 4401 - enter the SHUTDOWN-RECEIVED state, 4403 - stop accepting new data from its SCTP user 4404 - verify, by checking the Cumulative TSN Ack field of the chunk, that 4405 all its outstanding DATA chunks have been received by the SHUTDOWN 4406 sender. 4408 Once an endpoint as reached the SHUTDOWN-RECEIVED state it MUST NOT 4409 send a SHUTDOWN in response to a ULP request. And should discard 4410 subsequent SHUTDOWN chunks. 4412 If there are still outstanding DATA chunks left, the SHUTDOWN receiver 4413 shall continue to follow normal data transmission procedures defined in 4414 Section 6 until all outstanding DATA chunks are acknowledged; however, 4415 the SHUTDOWN receiver MUST NOT accept new data from its SCTP user. 4417 While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately 4418 respond to each received packet containing one or more DATA chunk(s) 4419 with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer. 4420 If it has no more outstanding DATA chunks, the SHUTDOWN receiver shall 4421 send a SHUTDOWN ACK and start a T2-shutdown timer of its own, entering 4422 the SHUTDOWN-ACK-SENT state. If the timer expires, the endpoint must 4423 re-send the SHUTDOWN ACK. 4425 The sender of the SHUTDOWN ACK should limit the number of 4426 retransmissions of the SHUTDOWN ACK chunk to the protocol parameter 4427 'Association.Max.Retrans'. If this threshold is exceeded the endpoint 4428 should destroy the TCB and may report the peer endpoint unreachable to 4429 the upper layer (and thus the association enters the CLOSED state). 4431 Upon the receipt of the SHUTDOWN ACK, the SHUTDOWN sender shall stop 4432 the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its 4433 peer, and remove all record of the association. 4435 Upon reception of the SHUTDOWN COMPLETE chunk the endpoint will verify 4436 that it is in SHUTDOWN-ACK-SENT state, if it is not the chunk should be 4437 discarded. If the endpoint is in the SHUTDOWN-ACK-SENT state the endpoint 4438 should stop the T2-shutdown timer and remove all knowledge of the 4439 association (and thus the association enters the CLOSED state). 4441 An endpoint SHOULD assure that all its outstanding DATA chunks have 4442 been acknowledged before initiating the shutdown procedure. 4444 An endpoint should reject any new data request from its upper 4445 layer if it is in SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED, 4446 or SHUTDOWN-ACK-SENT state. 4448 If an endpoint is in SHUTDOWN-ACK-SENT state and receives an INIT chunk 4449 (e.g., if the SHUTDOWN COMPLETE was lost) with source and destination 4450 transport addresses (either in the IP addresses or in the INIT chunk) 4451 that belong to this association, it should discard the INIT chunk and 4452 retransmit the SHUTDOWN ACK chunk. 4453 Note: Receipt of an INIT with the same source and destination IP 4454 addresses as used in transport addresses assigned to an endpoint but 4455 with a different port number indicates the initialization of a 4456 separate association. 4458 The sender of the INIT or COOKIE should respond to the receipt of a 4459 SHUTDOWN-ACK with a stand-alone SHUTDOWN COMPLETE in an SCTP packet with the 4460 Verification Tag field of its common header set to the same tag that 4461 was received in the SHUTDOWN ACK packet. This is considered an Out of 4462 the Blue packet as defined in Section 8.4. The sender of the INIT lets 4463 T1-init continue running and remains in the COOKIE-WAIT or COOKIE-ECHOED state. 4464 Normal T1-init timer expiration will cause the INIT or COOKIE chunk to be 4465 retransmitted and thus start a new association. 4467 If a SHUTDOWN is received in COOKIE WAIT or COOKIE ECHOED states the 4468 SHUTDOWN chunk SHOULD be silently discarded. 4470 If an endpoint is in SHUTDOWN-SENT state and receives a SHUTDOWN chunk 4471 from its peer, the endpoint shall respond immediately with a SHUTDOWN 4472 ACK to its peer, and move into a SHUTDOWN-ACK-SENT state restarting its 4473 T2-shutdown timer. 4475 If an endpoint is in the SHUTDOWN-ACK-SENT state and receives a 4476 SHUTDOWN ACK, it shall stop the T2-shutdown timer, send a 4477 SHUTDOWN COMPLETE chunk to its peer, and remove all record of the 4478 association. 4480 10. Interface with Upper Layer 4482 The Upper Layer Protocols (ULP) shall request for services by passing 4483 primitives to SCTP and shall receive notifications from SCTP for 4484 various events. 4486 The primitives and notifications described in this section should be 4487 used as a guideline for implementing SCTP. The following functional 4488 description of ULP interface primitives is shown for illustrative 4489 purposes. Different SCTP implementations may have different ULP 4490 interfaces. However, all SCTPs must provide a certain minimum set of 4491 services to guarantee that all SCTP implementations can support the 4492 same protocol hierarchy. 4494 10.1 ULP-to-SCTP 4496 The following sections functionally characterize a ULP/SCTP interface. 4497 The notation used is similar to most procedure or function calls in 4498 high level languages. 4500 The ULP primitives described below specify the basic functions the 4501 SCTP must perform to support inter-process communication. Individual 4502 implementations must define their own exact format, and may provide 4503 combinations or subsets of the basic functions in single calls. 4505 A) Initialize 4507 Format: INITIALIZE ([local port], [local eligible address list]) 4508 -> local SCTP instance name 4510 This primitive allows SCTP to initialize its internal data structures 4511 and allocate necessary resources for setting up its operation 4512 environment. Once SCTP is initialized, ULP can communicate 4513 directly with other endpoints without re-invoking this primitive. 4515 SCTP will return a local SCTP instance name to the ULP. 4517 Mandatory attributes: 4519 None. 4521 Optional attributes: 4523 The following types of attributes may be passed along with the 4524 primitive: 4526 o local port - SCTP port number, if ULP wants it to be specified; 4528 o local eligible address list - An address list that the local SCTP 4529 endpoint should bind. By default, if an address list is not 4530 included, all IP addresses assigned to the host should be used by 4531 the local endpoint. 4533 IMPLEMENTATION NOTE: If this optional attribute is supported by an 4534 implementation, it will be the responsibility of the implementation 4535 to enforce that the IP source address field of any SCTP packets 4536 sent out by this endpoint contains one of the IP addresses 4537 indicated in the local eligible address list. 4539 B) Associate 4541 Format: ASSOCIATE(local SCTP instance name, destination transport addr, 4542 outbound stream count) 4543 -> association id [,destination transport addr list] [,outbound stream 4544 count] 4546 This primitive allows the upper layer to initiate an association to a 4547 specific peer endpoint. 4549 The peer endpoint shall be specified by one of the transport addresses 4550 which defines the endpoint (see Section 1.4). If the local SCTP 4551 instance has not been initialized, the ASSOCIATE is considered an 4552 error. 4554 An association id, which is a local handle to the SCTP association, 4555 will be returned on successful establishment of the association. If 4556 SCTP is not able to open an SCTP association with the peer endpoint, 4557 an error is returned. 4559 Other association parameters may be returned, including the complete 4560 destination transport addresses of the peer as well as the outbound 4561 stream count of the local endpoint. One of the transport address from 4562 the returned destination addresses will be selected by the local 4563 endpoint as default primary path for sending SCTP 4564 packets to this peer. The returned "destination transport addr 4565 list" can be used by the ULP to change the default primary path or to 4566 force sending a packet to a specific transport address. 4568 IMPLEMENTATION NOTE: If ASSOCIATE primitive is implemented as a 4569 blocking function call, the ASSOCIATE primitive can return 4570 association parameters in addition to the association id upon 4571 successful establishment. If ASSOCIATE primitive is implemented as a 4572 non-blocking call, only the association id shall be returned and 4573 association parameters shall be passed using the COMMUNICATION UP 4574 notification. 4576 Mandatory attributes: 4578 o local SCTP instance name - obtained from the INITIALIZE operation. 4580 o destination transport addr - specified as one of the transport 4581 addresses of the peer endpoint with which the association is to be 4582 established. 4584 o outbound stream count - the number of outbound streams the ULP 4585 would like to open towards this peer endpoint. 4587 Optional attributes: 4589 None. 4591 C) Shutdown 4593 Format: SHUTDOWN(association id) 4594 -> result 4596 Gracefully closes an association. Any locally queued user data 4597 will be delivered to the peer. The association will be terminated only 4598 after the peer acknowledges all the SCTP packets sent. A success code 4599 will be returned on successful termination of the association. If 4600 attempting to terminate the association results in a failure, an error 4601 code shall be returned. 4603 Mandatory attributes: 4605 o association id - local handle to the SCTP association 4607 Optional attributes: 4609 None. 4611 D) Close 4613 Format: ABORT(association id [, cause code]) 4614 -> result 4616 Ungracefully closes an association. Any locally queued user data 4617 will be discarded and an ABORT chunk is sent to the peer. A success 4618 code will be returned on successful abortion of the association. If 4619 attempting to abort the association results in a failure, an error 4620 code shall be returned. 4622 Mandatory attributes: 4624 o association id - local handle to the SCTP association 4626 Optional attributes: 4628 o cause code - reason of the abort to be passed to the peer. 4630 None. 4632 E) Send 4634 Format: SEND(association id, buffer address, byte count [,context] 4635 [,stream id] [,life time] [,destination transport address] 4636 [,unorder flag] [,no-bundle flag] [,payload protocol-id] ) 4637 -> result 4639 This is the main method to send user data via SCTP. 4641 Mandatory attributes: 4643 o association id - local handle to the SCTP association 4645 o buffer address - the location where the user message to be 4646 transmitted is stored; 4648 o byte count - The size of the user data in number of bytes; 4650 Optional attributes: 4652 o context - an optional 32 bit integer that will be carried in the 4653 sending failure notification to the ULP if the transportation of 4654 this User Message fails. 4656 o stream id - to indicate which stream to send the data on. If not 4657 specified, stream 0 will be used. 4659 o life time - specifies the life time of the user data. The user data 4660 will not be sent by SCTP after the life time expires. This 4661 parameter can be used to avoid efforts to transmit stale 4662 user messages. SCTP notifies the ULP if the data cannot be 4663 initiated to transport (i.e. sent to the destination via SCTP's 4664 send primitive) within the life time variable. However, the 4665 user data will be transmitted if SCTP has attempted to transmit a 4666 chunk before the life time expired. 4668 IMPLEMENTATION NOTE: In order to better support the data lifetime 4669 option, the transmitter may hold back the assigning of the TSN 4670 number to an outbound DATA chunk to the last moment. And, for 4671 implementation simplicity, once a TSN number has been assigned the 4672 sender should consider the send of this DATA chunk as committed, 4673 overriding any lifetime option attached to the DATA chunk. 4675 o destination transport address - specified as one of the destination 4676 transport addresses of the peer endpoint to which this packet 4677 should be sent. Whenever possible, SCTP should use this destination 4678 transport address for sending the packets, instead of the current 4679 primary path. 4681 o unorder flag - this flag, if present, indicates that the user 4682 would like the data delivered in an unordered fashion to the peer 4683 (i.e., the U flag is set to 1 on all DATA chunks carrying this 4684 message). 4686 o no-bundle flag - instructs SCTP not to bundle this user data with 4687 other outbound DATA chunks. SCTP MAY still bundle even when 4688 this flag is present, when faced with network congestion. 4690 o payload protocol-id - A 32 bit unsigned integer that is to be 4691 passed to the peer indicating the type of payload protocol data 4692 being transmitted. This value is passed as opaque data by SCTP. 4694 F) Set Primary 4696 Format: SETPRIMARY(association id, destination transport address, 4697 [source transport address] ) 4698 -> result 4700 Instructs the local SCTP to use the specified destination transport 4701 address as primary path for sending packets. 4703 The result of attempting this operation shall be returned. If the 4704 specified destination transport address is not present in the 4705 "destination transport address list" returned earlier in an associate 4706 command or communication up notification, an error shall be returned. 4708 Mandatory attributes: 4710 o association id - local handle to the SCTP association 4712 o destination transport address - specified as one of the transport 4713 addresses of the peer endpoint, which should be used as primary 4714 address for sending packets. This overrides the current primary 4715 address information maintained by the local SCTP endpoint. 4717 Optional attributes: 4719 o source transport address - optionally, some implementations may 4720 allow you to set the default source address placed in all 4721 outgoing IP datagrams. 4723 G) Receive 4725 Format: RECEIVE(association id, buffer address, buffer size 4726 [,stream id]) 4728 -> byte count [,transport address] [,stream id] [,stream sequence 4729 number] [,partial flag] [,delivery number] [,payload protocol-id] 4731 This primitive shall read the first user message in the SCTP in-queue 4732 into the buffer specified by ULP, if there is one available. The size 4733 of the message read, in bytes, will be returned. It may, depending on 4734 the specific implementation, also return other information such as the 4735 sender's address, the stream id on which it is received, whether there 4736 are more messages available for retrieval, etc. For ordered messages, 4737 their stream sequence number may also be returned. 4739 Depending upon the implementation, if this primitive is invoked when 4740 no message is available the implementation should return an indication 4741 of this condition or should block the invoking process until data does 4742 become available. 4744 Mandatory attributes: 4746 o association id - local handle to the SCTP association 4748 o buffer address - the memory location indicated by the ULP to store 4749 the received message. 4751 o buffer size - the maximum size of data to be received, in bytes. 4753 Optional attributes: 4755 o stream id - to indicate which stream to receive the data on. 4757 o stream sequence number - the stream sequence number assigned by the 4758 sending SCTP peer. 4760 o partial flag - if this returned flag is set to 1, then this 4761 Receive contains a partial delivery of the whole message. When 4762 this flag is set, the stream id and stream sequence number MUST 4763 accompany this receive. When this flag is set to 0, it indicates 4764 that no more deliveries will be received for this stream sequence 4765 number. 4767 o payload protocol-id - A 32 bit unsigned integer that is received 4768 from the peer indicating the type of payload protocol of the 4769 received data. This value is passed as opaque data by SCTP. 4771 H) Status 4773 Format: STATUS(association id) 4774 -> status data 4776 This primitive should return a data block containing the following 4777 information: 4778 association connection state, 4779 destination transport address list, 4780 destination transport address reachability states, 4781 current receiver window size, 4782 current congestion window sizes, 4783 number of unacknowledged DATA chunks, 4784 number of DATA chunks pending receipt, 4785 primary path, 4786 most recent SRTT on primary path, 4787 RTO on primary path, 4788 SRTT and RTO on other destination addresses, etc. 4790 Mandatory attributes: 4792 o association id - local handle to the SCTP association 4794 Optional attributes: 4796 None. 4798 I) Change Heartbeat 4800 Format: CHANGEHEARTBEAT(association id, destination transport address, 4801 new state [,interval]) 4802 -> result 4804 Instructs the local endpoint to enable or disable heartbeat on the 4805 specified destination transport address. 4807 The result of attempting this operation shall be returned. 4809 Note: Even when enabled, heartbeat will not take place if the 4810 destination transport address is not idle. 4812 Mandatory attributes: 4814 o association id - local handle to the SCTP association 4816 o destination transport address - specified as one of the transport 4817 addresses of the peer endpoint. 4819 o new state - the new state of heartbeat for this destination 4820 transport address (either enabled or disabled). 4822 Optional attributes: 4824 o interval - if present, indicates the frequency of the heartbeat if 4825 this is to enable heartbeat on a destination transport 4826 address. Default interval is the RTO of the destination address. 4828 J) Request HeartBeat 4830 Format: REQUESTHEARTBEAT(association id, destination transport 4831 address) 4832 -> result 4834 Instructs the local endpoint to perform a HeartBeat on the specified 4835 destination transport address of the given association. The returned 4836 result should indicate whether the transmission of the HEARTBEAT 4837 chunk to the destination address is successful. 4839 Mandatory attributes: 4841 o association id - local handle to the SCTP association 4843 o destination transport address - the transport address of the 4844 association on which a heartbeat should be issued. 4846 K) Get SRTT Report 4848 Format: GETSRTTREPORT(association id, destination transport address) 4849 -> srtt result 4851 Instructs the local SCTP to report the current SRTT measurement on the 4852 specified destination transport address of the given association. The 4853 returned result can be an integer containing the most recent SRTT in 4854 milliseconds. 4856 Mandatory attributes: 4858 o association id - local handle to the SCTP association 4860 o destination transport address - the transport address of the 4861 association on which the SRTT measurement is to be reported. 4863 L) Set Failure Threshold 4865 Format: SETFAILURETHRESHOLD(association id, destination transport 4866 address, failure threshold) 4867 -> result 4869 This primitive allows the local SCTP to customize the reachability 4870 failure detection threshold 'Path.Max.Retrans' for the specified 4871 destination address. 4873 Mandatory attributes: 4875 o association id - local handle to the SCTP association 4877 o destination transport address - the transport address of the 4878 association on which the failure detection threshold is to be set. 4880 o failure threshold - the new value of 'Path.Max.Retrans' for the 4881 destination address. 4883 M) Set Protocol Parameters 4885 Format: SETPROTOCOLPARAMETERS(association id, [,destination transport 4886 address,] protocol parameter list) 4887 -> result 4889 This primitive allows the local SCTP to customize the protocol 4890 parameters. 4892 Mandatory attributes: 4894 o association id - local handle to the SCTP association 4896 o protocol parameter list - The specific names and values of the 4897 protocol parameters (e.g., Association.Max.Retrans [see Section 14]) 4898 that the SCTP user wishes to customize. 4900 Optional attributes: 4902 o destination transport address - some of the protocol parameters may 4903 be set on a per destination transport address basis. 4905 N) Receive unsent message 4907 Format: RECEIVE_UNSENT(data retrieval id, buffer address, buffer size 4908 [,stream id] [, stream sequence number] [,partial flag] 4909 [,payload protocol-id]) 4911 o data retrieval id - The identification passed to the ULP in the 4912 failure notification. 4914 o buffer address - the memory location indicated by the ULP to store 4915 the received message. 4917 o buffer size - the maximum size of data to be received, in bytes. 4919 Optional attributes: 4921 o stream id - this is a return value that is set to indicate 4922 which stream the data was sent to. 4924 o stream sequence number - this value is returned indicating 4925 the stream sequence number that was associated with the message. 4927 o partial flag - if this returned flag is set to 1, then this 4928 message is a partial delivery of the whole message. When 4929 this flag is set, the stream id and stream sequence number MUST 4930 accompany this receive. When this flag is set to 0, it indicates 4931 that no more deliveries will be received for this stream sequence 4932 number. 4934 o payload protocol-id - The 32 bit unsigned integer that was sent to 4935 be sent to the peer indicating the type of payload protocol of the 4936 received data. 4938 O) Receive unacknowledged message 4940 Format: RECEIVE_UNACKED(data retrieval id, buffer address, buffer size, 4941 [,stream id] [, stream sequence number] [,partial flag] 4942 [,payload protocol-id]) 4944 o data retrieval id - The identification passed to the ULP in the 4945 failure notification. 4947 o buffer address - the memory location indicated by the ULP to store 4948 the received message. 4950 o buffer size - the maximum size of data to be received, in bytes. 4952 Optional attributes: 4954 o stream id - this is a return value that is set to indicate 4955 which stream the data was sent to. 4957 o stream sequence number - this value is returned indicating 4958 the stream sequence number that was associated with the message. 4960 o partial flag - if this returned flag is set to 1, then this 4961 message is a partial delivery of the whole message. When 4962 this flag is set, the stream id and stream sequence number MUST 4963 accompany this receive. When this flag is set to 0, it indicates 4964 that no more deliveries will be received for this stream sequence 4965 number. 4967 o payload protocol-id - The 32 bit unsigned integer that was sent to 4968 be sent to the peer indicating the type of payload protocol of the 4969 received data. 4971 P) Destroy SCTP instance 4973 Format: DESTROY(local SCTP instance name) 4975 o local SCTP instance name - this is the value that was 4976 passed to the application in the initialize primitive and 4977 it indicates which SCTP instance to be destroyed. 4979 10.2 SCTP-to-ULP 4981 It is assumed that the operating system or application environment 4982 provides a means for the SCTP to asynchronously signal the ULP 4983 process. When SCTP does signal an ULP process, certain information is 4984 passed to the ULP. 4986 IMPLEMENTATION NOTE: In some cases this may be done through a 4987 separate socket or error channel. 4989 A) DATA ARRIVE notification 4991 SCTP shall invoke this notification on the ULP when a user message is 4992 successfully received and ready for retrieval. 4994 The following may be optionally be passed with the notification: 4996 o association id - local handle to the SCTP association 4997 o stream id - to indicate which stream the data is received on. 4999 B) SEND FAILURE notification 5001 If a message can not be delivered SCTP shall invoke this notification 5002 on the ULP. 5004 The following may be optionally be passed with the notification: 5006 o association id - local handle to the SCTP association 5008 o data retrieval id - an identification used to retrieve 5009 unsent and unacknowledged data. 5011 o cause code - indicating the reason of the failure, e.g., size too 5012 large, message life-time expiration, etc. 5014 o context - optional information associated with this message (see 5015 D in Section 10.1). 5017 C) NETWORK STATUS CHANGE notification 5019 When a destination transport address is marked inactive (e.g., when 5020 SCTP detects a failure), or marked active (e.g., when SCTP detects a 5021 recovery), SCTP shall invoke this notification on the ULP. 5023 The following shall be passed with the notification: 5025 o association id - local handle to the SCTP association 5027 o destination transport address - This indicates the destination 5028 transport address of the peer endpoint affected by the change; 5030 o new-status - This indicates the new status. 5032 D) COMMUNICATION UP notification 5034 This notification is used when SCTP becomes ready to send or receive 5035 user messages, or when a lost communication to an endpoint is 5036 restored. 5038 IMPLEMENTATION NOTE: If ASSOCIATE primitive is implemented as a 5039 blocking function call, the association parameters are returned as a 5040 result of the ASSOCIATE primitive itself. In that case, 5041 COMMUNICATION UP notification is optional at the association 5042 initiator's side. 5044 The following shall be passed with the notification: 5046 o association id - local handle to the SCTP association 5048 o status - This indicates what type of event has occurred 5050 o destination transport address list - the complete set of transport 5051 addresses of the peer 5053 o outbound stream count - the maximum number of streams allowed to be 5054 used in this association by the ULP 5056 o inbound stream count - the number of streams the peer endpoint 5057 has requested with this association (this may not be the same 5058 number as 'outbound stream count'). 5060 E) COMMUNICATION LOST notification 5062 When SCTP loses communication to an endpoint completely (e.g., via 5063 Heartbeats) or detects that the endpoint has performed an abort 5064 operation, it shall invoke this notification on the ULP. 5066 The following shall be passed with the notification: 5068 o association id - local handle to the SCTP association 5070 o status - This indicates what type of event has occurred; 5071 The status may indicate a failure OR a normal 5072 termination event occurred in response to a 5073 shutdown or abort request. 5075 The following may be passed with the notification: 5077 o data retrieval id - an identification used to retrieve 5078 unsent and unacknowledged data. 5080 o last-acked - the TSN last acked by that peer endpoint; 5082 o last-sent - the TSN last sent to that peer endpoint; 5084 F) COMMUNICATION ERROR notification 5086 When SCTP receives an ERROR chunk from its peer and decides to notify 5087 its ULP, it can invoke this notification on the ULP. 5089 The following can be passed with the notification: 5091 o association id - local handle to the SCTP association 5093 o error info - this indicates the type of error and optionally some 5094 additional information received through the ERROR chunk. 5096 G) RESTART notification 5098 When SCTP detects that the peer has restarted, it may send 5099 this notification to its ULP. 5101 The following can be passed with the notification: 5103 o association id - local handle to the SCTP association 5105 H) SHUTDOWN COMPLETE notification 5107 When SCTP completes the shutdown procedures (section 9.2) this 5108 notification is passed to the upper layer. 5110 The following can be passed with the notification: 5112 o association id - local handle to the SCTP association 5114 11. Security Considerations 5116 11.1 Security Objectives 5118 As a common transport protocol designed to reliably carry time- 5119 sensitive user messages, such as billing or signaling messages for 5120 telephony services, between two networked endpoints, SCTP has the 5121 following security objectives. 5123 - availability of reliable and timely data transport services 5124 - integrity of the user-to-user information carried by SCTP 5126 11.2 SCTP Responses To Potential Threats 5128 SCTP may potentially be used in a wide variety of risk situations. It 5129 is important for operator(s) of systems running SCTP to analyze their 5130 particular situations and decide on the appropriate counter-measures. 5132 Operators of systems running SCTP should consult [RFC2196] for 5133 guidance in securing their site. 5135 11.2.1 Countering Insider Attacks 5137 The principles of [RFC2196] should be applied to minimize the risk of 5138 theft of information or sabotage by insiders. Such procedures include 5139 publication of security policies, control of access at the physical, 5140 software, and network levels, and separation of services. 5142 11.2.2 Protecting against Data Corruption in the Network 5144 Where the risk of undetected errors in datagrams delivered by the lower 5145 layer transport services is considered to be too great, additional 5146 integrity protection is required. If this additional protection were 5147 provided in the application-layer, the SCTP header would remain 5148 vulnerable to deliberate integrity attacks. While the existing SCTP 5149 mechanisms for detection of packet replays are considered sufficient 5150 for normal operation, stronger protections are needed to protect SCTP 5151 when the operating environment contains significant risk of deliberate 5152 attacks from a sophisticated adversary. 5154 In order to promote software code-reuse, to avoid re-inventing the 5155 wheel, and to avoid gratuitous complexity to SCTP, the IP 5156 Authentication Header [RFC2402] SHOULD be used when the threat 5157 environment requires stronger integrity protections, but does not 5158 require confidentiality. 5160 A widely implemented BSD Sockets API extension exists for applications 5161 to request IP security services, such as AH or ESP from an operating 5162 system kernel. Applications can use such an API to request AH whenever 5163 AH use is appropriate. 5165 11.2.3 Protecting Confidentiality 5167 In most cases, the risk of breach of confidentiality applies to the 5168 signaling data payload, not to the SCTP or lower-layer protocol 5169 overheads. If that is true, encryption of the SCTP user data only might 5170 be considered. As with the supplementary checksum service, user data 5171 encryption MAY be performed by the SCTP user application. Alternately, 5172 the user application MAY use an implementation-specific API to request 5173 that the IP Encapsulating Security Payload (ESP) [RFC2406] be used to 5174 provide confidentiality and integrity. 5176 Particularly for mobile users, the requirement for confidentiality 5177 might include the masking of IP addresses and ports. In this case ESP 5178 SHOULD be used instead of application-level confidentiality. If ESP is 5179 used to protect confidentiality of SCTP traffic, an ESP cryptographic 5180 transform that includes cryptographic integrity protection MUST be 5181 used, because if there is a confidentiality threat there will also be a 5182 strong integrity threat. 5184 Whenever ESP is in use, application-level encryption is not generally 5185 required. 5187 Regardless of where confidentiality is provided, the ISAKMP [RFC2408] 5188 and the Internet Key Exchange (IKE) [RFC2409] SHOULD be used for key 5189 management. 5191 Operators should consult [RFC2401] for more information on the security 5192 services available at and immediately above the Internet Protocol 5193 layer. 5195 11.2.4 Protecting against Blind Denial of Service Attacks 5197 A blind attack is one where the attacker is unable to intercept or 5198 otherwise see the content of data flows passing to and from the target 5199 SCTP node. Blind denial of service attacks may take the form of 5200 flooding, masquerade, or improper monopolization of services. 5202 11.2.4.1 Flooding 5204 The objective of flooding is to cause loss of service and incorrect 5205 behavior at target systems through resource exhaustion, interference 5206 with legitimate transactions, and exploitation of buffer-related 5207 software bugs. Flooding may be directed either at the SCTP node or at 5208 resources in the intervening IP Access Links or the Internet. 5209 Where the latter entities are the target, flooding will manifest 5210 itself as loss of network services, including potentially the breach 5211 of any firewalls in place. 5213 In general, protection against flooding begins at the equipment 5214 design level, where it includes measures such as: 5216 - avoiding commitment of limited resources before determining that 5217 the request for service is legitimate 5218 - giving priority to completion of processing in progress over the 5219 acceptance of new work 5220 - identification and removal of duplicate or stale queued requests 5221 for service. 5222 - not responding to unexpected packets sent to non-unicast 5223 addresses. 5225 Network equipment should be capable of generating an alarm and log 5226 if a suspicious increase in traffic occurs. The log should provide 5227 information such as the identity of the incoming link and source 5228 address(es) used which will help the network or SCTP system operator 5229 to take protective measures. Procedures should be in place for the 5230 operator to act on such alarms if a clear pattern of abuse emerges. 5232 The design of SCTP is resistant to flooding attacks, particularly in 5233 its use of a four-way start-up handshake, its use of a cookie to 5234 defer commitment of resources at the responding SCTP node until the 5235 handshake is completed, and its use of a Verification Tag to prevent 5236 insertion of extraneous packets into the flow of an established 5237 association. 5239 The IP Authentication Header and Encapsulating Security Payload might 5240 be useful in reducing the risk of certain kinds of denial of service 5241 attacks." 5243 The use of the Host Name feature in the INIT chunk could be used to 5244 flood a target DNS server. A large backlog of DNS queries, resolving 5245 the Host Name received in the INIT chunk to IP addresses, could be 5246 accomplished by sending INIT's to multiple hosts in a given domain. 5247 In addition, an attacker could use the Host Name feature in an indirect 5248 attack on a third party by sending large numbers of INITs to random 5249 hosts containing the host name of the target. In addition to the 5250 strain on DNS resources, this could also result in large numbers of 5251 INIT ACKs being sent to the target. One method to protect against this 5252 type of attack is to verify that the IP addresses received from DNS 5253 include the source IP address of the original INIT. If the list of IP 5254 addresses received from DNS does not include the source IP address of 5255 the INIT, the endpoint MAY silently discard the INIT. This last option 5256 will not protect against the attack against the DNS. 5258 11.2.4.2 Blind Masquerade 5259 Masquerade can be used to deny service in several ways: 5261 - by tying up resources at the target SCTP node to which the 5262 impersonated node has limited access. For example, the target node 5263 may by policy permit a maximum of one SCTP association with the 5264 impersonated SCTP node. The masquerading attacker may attempt to 5265 establish an association purporting to come from the impersonated 5266 node so that the latter cannot do so when it requires it. 5267 - by deliberately allowing the impersonation to be detected, 5268 thereby provoking counter-measures which cause the impersonated node 5269 to be locked out of the target SCTP node. 5270 - by interfering with an established association by inserting 5271 extraneous content such as a SHUTDOWN request. 5273 SCTP reduces the risk of blind masquerade attacks through IP spoofing 5274 by use of the four-way startup handshake. Man-in-the-middle masqurade 5275 attacks are discussed in Section 11.3 below. Because the initial exchange 5276 is memoryless, no lockout mechanism is triggered by blind masquerade attacks. 5277 In addition, the INIT ACK containing the State Cookie is transmitted 5278 back to the IP address from which it received the INIT. Thus the 5279 attacker would not receive the INIT ACK containing the State Cookie. 5280 SCTP protects against insertion of extraneous packets into the flow of 5281 an established association by use of the Verification Tag. 5283 Logging of received INIT requests and abnormalities such as 5284 unexpected INIT ACKs might be considered as a way to detect patterns 5285 of hostile activity. However, the potential usefulness of such 5286 logging must be weighed against the increased SCTP startup 5287 processing it implies, rendering the SCTP node more vulnerable to 5288 flooding attacks. Logging is pointless without the establishment of 5289 operating procedures to review and analyze the logs on a routine 5290 basis. 5292 11.2.4.3 Improper Monopolization of Services 5294 Attacks under this heading are performed openly and legitimately by 5295 the attacker. They are directed against fellow users of the target 5296 SCTP node or of the shared resources between the attacker and the 5297 target node. Possible attacks include the opening of a large number 5298 of associations between the attacker's node and the target, or 5299 transfer of large volumes of information within a legitimately- 5300 established association. 5302 Policy limits should be placed on the number of associations per 5303 adjoining SCTP node. SCTP user applications should be capable of 5304 detecting large volumes of illegitimate or "no-op" messages within a 5305 given association and either logging or terminating the association as 5306 a result, based on local policy. 5308 11.3 Protection against Fraud and Repudiation 5310 The objective of fraud is to obtain services without authorization 5311 and specifically without paying for them. In order to achieve this 5312 objective, the attacker must induce the SCTP user application at the 5313 target SCTP node to provide the desired service while accepting 5314 invalid billing data or failing to collect it. Repudiation is a 5315 related problem, since it may occur as a deliberate act of fraud or 5316 simply because the repudiating party kept inadequate records of 5317 service received. 5319 Potential fraudulent attacks include interception and misuse of 5320 authorizing information such as credit card numbers, blind 5321 masquerade and replay, and man-in-the middle attacks which modify 5322 the packets passing through a target SCTP association in real time. 5324 The interception attack is countered by the confidentiality measures 5325 discussed in Section 11.2.3 above. 5327 Section 11.2.4.2 describes how SCTP is resistant to blind masquerade 5328 attacks, as a result of the four-way startup handshake and the 5329 Verification Tag. The Verification Tag and TSN together are 5330 protections against blind replay attacks, where the replay is into an 5331 existing association. 5333 However, SCTP does not protect against man-in-the-middle attacks 5334 where the attacker is able to intercept and alter the packets sent 5335 and received in an association. For example, the INIT ACK will have 5336 sufficient information sent on the wire for an adversary in the middle 5337 to hijack an existing SCTP association. Where a significant possibility 5338 of such attacks is seen to exist, or where possible repudiation is an 5339 issue, the use of the IPSEC AH service is recommended to ensure both 5340 the integrity and the authenticity of the SCTP packets passed. 5342 SCTP also provides no protection against attacks originating at or 5343 beyond the SCTP node and taking place within the context of an 5344 existing association. Prevention of such attacks should be covered 5345 by appropriate security policies at the host site, as discussed in 5346 Section 11.2.1. 5348 12. Recommended Transmission Control Block (TCB) Parameters 5350 This section details a recommended set of parameters that should 5351 be contained within the TCB for an implementation. This section is 5352 for illustrative purposes and should not be deemed as requirements 5353 on an implementation or as an exhaustive list of all parameters 5354 inside an SCTP TCB. Each implementation may need its own additional 5355 parameters for optimization. 5357 12.1 Parameters necessary for the SCTP instance 5359 Associations: A list of current associations and mappings to the 5360 data consumers for each association. This may be in 5361 the form of a hash table or other implementation 5362 dependent structure. The data consumers may be process 5363 identification information such as file descriptors, 5364 named pipe pointer, or table pointers dependent on how 5365 SCTP is implemented. 5367 Secret Key: A secret key used by this endpoint to compute the MAC. 5369 This SHOULD be a cryptographic quality random number with 5370 a sufficient length. Discussion in [RFC1750] can be 5371 helpful in selection of the key. 5373 Address List: The list of IP addresses that this instance has bound. 5374 This information is passed to one's peer(s) in INIT and 5375 INIT ACK chunks. 5377 SCTP Port: The local SCTP port number the endpoint is bound to. 5379 12.2 Parameters necessary per association (i.e. the TCB) 5381 Peer : Tag value to be sent in every packet and is received 5382 Verification: in the INIT or INIT ACK chunk. 5383 Tag : 5385 My : Tag expected in every inbound packet and sent in the 5386 Verification: INIT or INIT ACK chunk. 5387 Tag : 5389 State : A state variable indicating what state the association is 5390 : in, i.e. COOKIE-WAIT, COOKIE-ECHOED, ESTABLISHED, 5391 : SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED, 5392 : SHUTDOWN-ACK-SENT. 5394 Note: No "CLOSED" state is illustrated since if a 5395 association is "CLOSED" its TCB SHOULD be removed. 5397 Peer : A list of SCTP transport addresses that the peer is 5398 Transport : bound to. This information is derived from the INIT or 5399 Address : INIT ACK and is used to associate an inbound packet 5400 List : with a given association. Normally this information is 5401 : hashed or keyed for quick lookup and access of the TCB. 5403 Primary : This is the current primary destination transport 5404 Path : address of the peer endpoint. It may also specify a 5405 : source transport address on this endpoint. 5407 Overall : The overall association error count. 5408 Error Count : 5410 Overall : The threshold for this association that if the Overall 5411 Error : Error Count reaches will cause this association to be 5412 Threshold : torn down. 5414 Peer Rwnd : Current calculated value of the peer's rwnd. 5416 Next TSN : The next TSN number to be assigned to a new DATA chunk. 5417 : This is sent in the INIT or INIT ACK chunk to the peer 5418 : and incremented each time a DATA chunk is assigned a 5419 : TSN (normally just prior to transmit or during 5420 : fragmentation). 5422 Last Rcvd : This is the last TSN received in sequence. This value is 5423 TSN : set initially by taking the peer's Initial TSN, 5424 : received in the INIT or INIT ACK chunk, and 5425 : subtracting one from it. 5427 Mapping : An array of bits or bytes indicating which out of 5428 Array : order TSN's have been received (relative to the 5429 : Last Rcvd TSN). If no gaps exist, i.e. no out of order 5430 : packets have been received, this array will be set to all 5431 : zero. This structure may be in the form of a circular 5432 : buffer or bit array. 5434 Ack State : This flag indicates if the next received packet 5435 : is to be responded to with a SACK. This is initialized 5436 : to 0. When a packet is received it is incremented. 5437 : If this value reaches 2 or more, a SACK is sent and the 5438 : value is reset to 0. Note: This is used only when no DATA 5439 : chunks are received out of order. When DATA chunks are 5440 : out of order, SACK's are not delayed (see Section 6). 5442 Inbound : An array of structures to track the inbound streams. 5443 Streams : Normally including the next sequence number expected 5444 : and possibly the stream number. 5446 Outbound : An array of structures to track the outbound streams. 5447 Streams : Normally including the next sequence number to 5448 : be sent on the stream. 5450 Reasm Queue : A re-assembly queue. 5452 Local : The list of local IP addresses bound in to this 5453 Transport : association. 5454 Address : 5455 List : 5457 Association : The smallest PMTU discovered for all of the 5458 PMTU : peer's transport addresses. 5460 12.3 Per Transport Address Data 5462 For each destination transport address in the peer's address list 5463 derived from the INIT or INIT ACK chunk, a number of data elements 5464 needs to be maintained including: 5466 Error count : The current error count for this destination. 5468 Error : Current error threshold for this destination i.e. 5469 Threshold : what value marks the destination down if Error count 5470 : reaches this value. 5472 cwnd : The current congestion window. 5474 ssthresh : The current ssthresh value. 5476 RTO : The current retransmission timeout value. 5478 SRTT : The current smoothed round trip time. 5480 RTTVAR : The current RTT variation. 5482 partial : The tracking method for increase of cwnd when in 5483 bytes acked : congestion avoidance mode (see Section 6.2.2) 5485 state : The current state of this destination, i.e. DOWN, UP, 5486 : ALLOW-HB, NO-HEARTBEAT, etc. 5488 PMTU : The current known path MTU. 5490 Per : A timer used by each destination. 5491 Destination : 5492 Timer : 5494 RTO-Pending : A flag used to track if one of the DATA chunks sent to 5495 this address is currently being used to compute a RTT. If 5496 this flag is 0, the next DATA chunk sent to this 5497 destination should be used to compute a RTT and this flag 5498 should be set. Every time the RTT calculation 5499 completes (i.e. the DATA chunk is SACK'd) clear this flag. 5501 last-time : The time this destination was last sent to. This can be 5502 used : used to determine if a HEARTBEAT is needed. 5504 12.4 General Parameters Needed 5506 Out Queue : A queue of outbound DATA chunks. 5508 In Queue : A queue of inbound DATA chunks. 5510 13. IANA Consideration 5512 This protocol will require port reservation like TCP for the use of 5513 "well known" servers within the Internet. All current TCP ports shall 5514 be automatically reserved in the SCTP port address space. New requests 5515 should follow IANA's current mechanisms for TCP. 5517 This protocol may also be extended through IANA in three ways: 5518 -- through definition of additional chunk types, 5519 -- through definition of additional parameter types, or 5520 -- through definition of additional cause codes within 5521 ERROR chunks 5523 In the case where a particular ULP using SCTP desires to have its own 5524 ports, the ULP should be responsible for registering with IANA for 5525 getting its ports assigned. 5527 13.1 IETF-defined Chunk Extension 5528 The definition and use of new chunk types is an integral part of 5529 SCTP. Thus, new chunk types are assigned by IANA through an 5530 IETF Consensus action as defined in [RFC2434]. 5532 The documentation for a new chunk code type must include the following 5533 information: 5534 (a) A long and short name for the new chunk type; 5535 (b) A detailed description of the structure of the chunk, which MUST 5536 conform to the basic structure defined in Section 3.2; 5537 (c) A detailed definition and description of intended use of each field 5538 within the chunk, including the chunk flags if any; 5539 (d) A detailed procedural description of the use of the new chunk type 5540 within the operation of the protocol. 5542 The last chunk type (255) is reserved for future extension if 5543 necessary. 5545 13.2 IETF-defined Chunk Parameter Extension 5547 The assignment of new chunk parameter type codes is done through an 5548 IETF Consensus action as defined in [RFC2434]. Documentation of the 5549 chunk parameter MUST contain the following information: 5551 (a) Name of the parameter type. 5552 (b) Detailed description of the structure of the parameter field. This 5553 structure MUST conform to the general type-length-value format 5554 described in Section 3.2.1. 5555 (c) Detailed definition of each component of the parameter value. 5556 (d) Detailed description of the intended use of this parameter type, 5557 and an indication of whether and under what circumstances 5558 multiple instances of this parameter type may be found within the 5559 same chunk. 5561 13.3 IETF-defined Additional Error Causes 5563 Additional cause codes may be allocated in the range 11 to 65535 5564 through a Specification Required action as defined in [RFC2434]. 5565 Provided documentation must include the following information: 5567 (a) Name of the error condition. 5568 (b) Detailed description of the conditions under which an SCTP 5569 endpoint should issue an ERROR (or ABORT) with this cause code. 5570 (c) Expected action by the SCTP endpoint which receives an ERROR 5571 (or ABORT) chunk containing this cause code. 5572 (d) Detailed description of the structure and content of data fields 5573 which accompany this cause code. 5575 The initial word (32 bits) of a cause code parameter MUST conform to 5576 the format shown in Section 3.3.10, i.e.: 5577 -- first two bytes contain the cause code value 5578 -- last two bytes contain length of the Cause Parameter. 5580 13.3 Payload Protocol Identifiers 5581 Except for value 0 which is reserved by SCTP to indicate an 5582 unspecified payload protocol identifier in a DATA chunk, SCTP will 5583 not be responsible for standardizing or verifying any payload protocol 5584 identifiers; SCTP simply receives the identifier from the upper layer 5585 and carries it with the corresponding payload data. 5587 The upper layer, i.e., the SCTP user, SHOULD standardize any specific 5588 protocol identifier with IANA if it is so desired. The use of any 5589 specific payload protocol identifier is out of the scope of SCTP. 5591 14. Suggested SCTP Protocol Parameter Values 5593 The following protocol parameters are RECOMMENDED: 5595 RTO.Initial - 3 seconds 5596 RTO.Min - 1 second 5597 RTO.Max - 60 seconds 5598 RTO.Alpha - 1/8 5599 RTO.Beta - 1/4 5600 Valid.Cookie.Life - 60 seconds 5601 Association.Max.Retrans - 10 attempts 5602 Path.Max.Retrans - 5 attempts (per destination address) 5603 Max.Init.Retransmits - 8 attempts 5604 HB.interval - 30 seconds 5606 IMPLEMENTATION NOTE: The SCTP implementation may allow ULP to 5607 customize some of these protocol parameters (see Section 10). 5609 Note: RTO.Min SHOULD be set as recommended above. 5611 15. Acknowledgements 5613 The authors wish to thank Mark Allman, R.J.Atkinson, Richard Band, 5614 Scott Bradner, Steve Bellovin, Ram Dantu, R. Ezhirpavai, Mike Fisk, 5615 Sally Floyd, Atsushi Fukumoto ,Matt Holdrege, Henry Houh, Christian 5616 Huitema, Gary Lehecka, Jonathan Lee, David Lehmann, John Loughney, 5617 Daniel Luan, Thomas Narten, Erik Nordmark, Lyndon Ong, Shyamal Prasad, 5618 Kelvin Porter, Heinz Prantner, Jarno Rajahalme, Raymond E. Reeves, 5619 Renee Revis, Ivan Arias Rodriguez, A. Sankar, Greg Sidebottom, Brian 5620 Wyld, La Monte Yarroll, and many others for their invaluable comments. 5622 16. Authors' Addresses 5624 Randall R. Stewart Tel: +1-815-479-8536 5625 24 Burning Bush Trail. EMail: rstewart@flashcom.net 5626 Crystal Lake, IL 60012 5627 USA 5629 Qiaobing Xie Tel: +1-847-632-3028 5630 Motorola, Inc. EMail: qxie1@email.mot.com 5631 1501 W. Shure Drive, #2309 5632 Arlington Heights, IL 60004 5633 USA 5635 Ken Morneault Tel: +1-703-484-3323 5636 Cisco Systems Inc. EMail: kmorneau@cisco.com 5637 13615 Dulles Technology Drive 5638 Herndon, VA. 20171 5639 USA 5641 Chip Sharp Tel: +1-919-392-3121 5642 Cisco Systems Inc. EMail:chsharp@cisco.com 5643 7025 Kit Creek Road 5644 Research Triangle Park, NC 27709 5645 USA 5647 Hanns Juergen Schwarzbauer Tel: +49-89-722-24236 5648 SIEMENS AG 5649 Hofmannstr. 51 5650 81359 Munich 5651 Germany 5652 EMail: HannsJuergen.Schwarzbauer@icn.siemens.de 5654 Tom Taylor Tel: +1-613-736-0961 5655 Nortel Networks 5656 1852 Lorraine Ave. 5657 Ottawa, Ontario 5658 Canada K1H 6Z8 5659 EMail:taylor@nortelnetworks.com 5661 Ian Rytina Tel: +61-3-9301-6164 5662 Ericsson Australia EMail:ian.rytina@ericsson.com 5663 37/360 Elizabeth Street 5664 Melbourne, Victoria 3000 5665 Australia 5667 Malleswar Kalla Tel: +1-973-829-5212 5668 Telcordia Technologies 5669 MCC 1J211R 5670 445 South Street 5671 Morristown, NJ 07960 5672 USA 5673 EMail: kalla@research.telcordia.com 5675 Lixia Zhang Tel: +1-310-825-2695 5676 UCLA Computer Science Department EMail: lixia@cs.ucla.edu 5677 4531G Boelter Hall 5678 Los Angeles, CA 90095-1596 5679 USA 5681 Vern Paxson Tel: +1-510-642-4274 x 302 5682 ACIRI EMail: vern@aciri.org 5683 1947 Center St., Suite 600, 5684 Berkeley, CA 94704-1198 5685 USA 5686 17. References 5688 [RFC768] Postel, J. (ed.), "User Datagram Protocol", RFC 768, August 5689 1980. 5691 [RFC793] Postel, J. (ed.), "Transmission Control Protocol", RFC 793, 5692 September 1981. 5694 [RFC1123] Braden, R., "Requirements for Internet hosts - application 5695 and support.", RFC 1123, October 1989. 5697 [RFC1191] Mogul, J., and Deering, S., "Path MTU Discovery", RFC 1191, 5698 November 1990. 5700 [RFC1700] Reynolds, J., and Postel, J. (ed.), "Assigned Numbers", 5701 RFC 1700, 5703 [RFC1981] McCann, J., Deering, S., and Mogul, J., "Path MTU Discovery 5704 for IP version 6", RFC 1981, August 1996. 5706 [RFC1982] Elz, R., Bush, R., "Serial Number Arithmetic", RFC 1982, 5707 August 1996. 5709 [RFC2026] Bradner, S., "The Internet Standards Process -- Revision 3", 5710 RFC 2026, October 1996. 5712 [RFC2119] Bradner, S. "Key words for use in RFCs to Indicate 5713 Requirement Levels", BCP 14, RFC 2119, March 1997. 5715 [RFC2401] Kent, S., and Atkinson, R., "Security Architecture for the 5716 Internet Protocol", RFC 2401, November 1998. 5718 [RFC2402] S. Kent, R. Atkinson., "IP Authentication Header.", 5719 RFC 2402, November 1998. 5721 [RFC2406] S. Kent, R. Atkinson., "IP Encapsulating Security Payload 5722 (ESP)." RFC-2406, November 1998. 5724 [RFC2408] D. Maughan, M. Schertler, M. Schneider, J. Turner., 5725 "Internet Security Association and Key Management Protocol" 5726 RFC 2408, November 1998. 5728 [RFC2409] D. Harkins, D. Carrel, "The Internet Key Exchange (IKE)", 5729 RFC 2409, November 1998. 5731 [RFC2434] T. Narten, and H. Avestrand, "Guidelines for Writing an IANA 5732 Considerations Section in RFCs.", RFC2434, October 1998. 5734 [RFC2460] Deering, S., and R. Hinden, "Internet Protocol, Version 5735 6 (IPv6) Specification", RFC 2460, December 1998. 5737 [RFC2581] Allman, M., Paxson, V., and Stevens, W., "TCP Congestion 5738 Control", RFC 2581, April 1999. October 1994. 5740 18. Bibliography 5742 [ALLMAN99] Allman, M., and Paxson, V., "On Estimating End-to-End 5743 Network Path Properties", Proc. SIGCOMM'99, 1999. 5745 [FALL96] Fall, K., and Floyd, S., Simulation-based Comparisons of 5746 Tahoe, Reno, and SACK TCP, Computer Communications Review, 5747 V. 26 N. 3, July 1996, pp. 5-21. 5749 [RFC1750] Eastlake , D. (ed.), "Randomness Recommendations for 5750 Security", RFC 1750, December 1994. 5752 [RFC1950] Deutsch P., Gailly J-L., "ZLIB Compressed Data Format 5753 Specification version 3.3" , RFC1950, May 1996. 5755 [RFC2104] Krawczyk, H., Bellare, M., Canetti, R., "HMAC: Keyed-Hashing 5756 for Message Authentication", RFC 2104, March 1997. 5758 [RFC2196] Fraser, B. (ed.), "Site Security Handbook", RFC 2196, 5759 September 1997. 5761 [RFC2522] Karn, P., and Simpson, W., "Photuris: Session-Key Management 5762 Protocol", RFC 2522, March 1999. 5764 [SAVAGE99] Savage, S., Cardwell, N., Wetherall, D., and Anderson, T., 5765 "TCP Congestion Control with a Misbehaving Receiver", ACM 5766 Computer Communication Review, 29(5), October 1999. 5768 Appendix A: Explicit Congestion Notification 5770 ECN (Ramakrishnan, k., Floyd, S., "Explicit Congestion Notification", 5771 RFC 2481, January 1999) describes a proposed extension to IP that 5772 details a method to become aware of congestion outside of datagram 5773 loss. This is an optional feature that an implementation MAY choose to 5774 add to SCTP. This appendix details the minor differences implementers 5775 will need to be aware of if they choose to implement this feature. 5776 In general RFC 2481 should be followed with the following exceptions. 5778 Negotiation: 5780 RFC2481 details negotiation of ECN during the SYN and SYN-ACK stages 5781 of a TCP connection. The sender of the SYN sets two bits in the 5782 TCP flags, and the sender of the SYN-ACK sets only 1 bit. The reasoning 5783 behind this is to assure both sides are truly ECN capable. For SCTP 5784 this is not necessary. To indicate that an endpoint is ECN capable 5785 an endpoint SHOULD add to the INIT and or INIT ACK chunk the TLV 5786 reserved for ECN. This TLV contains no parameters, and thus has 5787 the following format: 5789 0 1 2 3 5790 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 5791 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5792 | Parameter Type = 32768 | Parameter Length = 4 | 5793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5795 ECN-Echo: 5797 RFC 2481 details a specific bit for a receiver to send back in its 5798 TCP acknowledgements to notify the sender of the Congestion Experienced 5799 (CE) bit having arrived from the network. For SCTP this same indication 5800 is made by including the ECNE chunk. This chunk contains one data 5801 element, i.e. the lowest TSN associated with the IP datagram marked 5802 with the CE bit, and looks as follows: 5804 0 1 2 3 5805 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 5806 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5807 | Chunk Type=12 | Flags=00000000| Chunk Length = 8 | 5808 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5809 | Lowest TSN Number | 5810 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5812 Note: The ECNE is considered a Control chunk. 5814 CWR: 5816 RFC 2481 details a specific bit for a sender to send in the header of 5817 its next outbound TCP segment to indicate to its peer that it has 5818 reduced its congestion window. This is termed the CWR bit. For 5819 SCTP the same indication is made by including the CWR chunk. 5820 This chunk contains one data element, i.e. the TSN number that 5821 was sent in the ECN-Echo. This element represents the lowest 5822 TSN number in the datagram that was originally marked with the 5823 CE bit. 5825 0 1 2 3 5826 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 5827 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5828 | Chunk Type=13 | Flags=00000000| Chunk Length = 8 | 5829 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5830 | Lowest TSN Number | 5831 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5833 Note: The CWR is considered a Control chunk. 5835 Appendix B Alder 32 bit checksum calculation 5837 The Adler-32 checksum calculation given in this appendix is copied from 5838 [RFC1950]. 5840 Adler-32 is composed of two sums accumulated per byte: s1 is the sum 5841 of all bytes, s2 is the sum of all s1 values. Both sums are done 5842 modulo 65521. s1 is initialized to 1, s2 to zero. The Adler-32 5843 checksum is stored as s2*65536 + s1 in network byte order. 5845 The following C code computes the Adler-32 checksum of a data buffer. 5846 It is written for clarity, not for speed. The sample code is in the 5847 ANSI C programming language. Non C users may find it easier to read 5848 with these hints: 5850 & Bitwise AND operator. 5851 >> Bitwise right shift operator. When applied to an 5852 unsigned quantity, as here, right shift inserts zero bit(s) 5853 at the left. 5854 << Bitwise left shift operator. Left shift inserts zero 5855 bit(s) at the right. 5856 ++ "n++" increments the variable n. 5857 % modulo operator: a % b is the remainder of a divided by b. 5858 #define BASE 65521 /* largest prime smaller than 65536 */ 5859 /* 5860 Update a running Adler-32 checksum with the bytes buf[0..len-1] 5861 and return the updated checksum. The Adler-32 checksum should be 5863 initialized to 1. 5865 Usage example: 5867 unsigned long adler = 1L; 5869 while (read_buffer(buffer, length) != EOF) { 5870 adler = update_adler32(adler, buffer, length); 5871 } 5872 if (adler != original_adler) error(); 5873 */ 5874 unsigned long update_adler32(unsigned long adler, 5875 unsigned char *buf, int len) 5876 { 5877 unsigned long s1 = adler & 0xffff; 5878 unsigned long s2 = (adler >> 16) & 0xffff; 5879 int n; 5881 for (n = 0; n < len; n++) { 5882 s1 = (s1 + buf[n]) % BASE; 5883 s2 = (s2 + s1) % BASE; 5884 } 5885 return (s2 << 16) + s1; 5886 } 5888 /* Return the adler32 of the bytes buf[0..len-1] */ 5889 unsigned long adler32(unsigned char *buf, int len) 5890 { 5891 return update_adler32(1L, buf, len); 5892 } 5894 --------------C8B28CFEABDEB33581C4E752--