idnits 2.17.1 draft-ietf-tsvwg-2960bis-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 17. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 6793. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 6804. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 6811. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 6817. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([RFC2960], [RFC3309]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. == There are 1 instance of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. -- The draft header indicates that this document obsoletes RFC3309, but the abstract doesn't seem to directly say this. It does mention RFC3309 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == Line 6428 has weird spacing: '...ed long crc_c...' == Line 6552 has weird spacing: '...ed long crc_c...' == 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). == 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 'MUST not' in this paragraph: o When cwnd is less than or equal to ssthresh, an SCTP endpoint MUST use the slow start algorithm to increase cwnd only if the current congestion window is being fully utilized, an incoming SACK advances the Cumulative TSN Ack Point, and the data sender is not in Fast Recovery. Only when these three conditions are met can the cwnd be increased; otherwise, the cwnd MUST not be increased. If these conditions are met, then cwnd MUST be increased by, at most, the lesser of 1) the total size of the previously outstanding DATA chunk(s) acknowledged, and 2) the destination's path MTU. This upper bound protects against the ACK-Splitting attack outlined in [SAVAGE99]. -- 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.) -- The document date (June 12, 2007) is 6161 days in the past. Is this intentional? -- 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: 'ASSOCIATE' is mentioned on line 2363, but not defined == Missing Reference: 'SHUTDOWN' is mentioned on line 2397, but not defined == Missing Reference: 'ABORT' is mentioned on line 2357, but not defined -- Looks like a reference, but probably isn't: '256' on line 6552 == Unused Reference: 'RFC1191' is defined on line 6657, but no explicit reference was found in the text == Unused Reference: 'RFC1981' is defined on line 6660, but no explicit reference was found in the text == Unused Reference: 'RFC2460' is defined on line 6673, but no explicit reference was found in the text == Unused Reference: 'RFC4302' is defined on line 6689, but no explicit reference was found in the text == Unused Reference: 'RFC2367' is defined on line 6736, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'ITU32' ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 1981 (Obsoleted by RFC 8201) ** 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) ** Obsolete normative reference: RFC 4306 (Obsoleted by RFC 5996) -- Obsolete informational reference (is this intentional?): RFC 813 (Obsoleted by RFC 7805) -- Obsolete informational reference (is this intentional?): RFC 2960 (Obsoleted by RFC 4960) -- Obsolete informational reference (is this intentional?): RFC 3309 (Obsoleted by RFC 4960) -- Obsolete informational reference (is this intentional?): RFC 4460 (Obsoleted by RFC 9260) Summary: 8 errors (**), 0 flaws (~~), 15 warnings (==), 15 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group R. Stewart 3 Internet-Draft Editor 4 Obsoletes: 2960,3309 June 12, 2007 5 (if approved) 6 Intended status: Standards Track 7 Expires: December 14, 2007 9 Stream Control Transmission Protocol 10 draft-ietf-tsvwg-2960bis-05.txt 12 Status of this Memo 14 By submitting this Internet-Draft, each author represents that any 15 applicable patent or other IPR claims of which he or she is aware 16 have been or will be disclosed, and any of which he or she becomes 17 aware will be disclosed, in accordance with Section 6 of BCP 79. 19 Internet-Drafts are working documents of the Internet Engineering 20 Task Force (IETF), its areas, and its working groups. Note that 21 other groups may also distribute working documents as Internet- 22 Drafts. 24 Internet-Drafts are draft documents valid for a maximum of six months 25 and may be updated, replaced, or obsoleted by other documents at any 26 time. It is inappropriate to use Internet-Drafts as reference 27 material or to cite them other than as "work in progress." 29 The list of current Internet-Drafts can be accessed at 30 http://www.ietf.org/ietf/1id-abstracts.txt. 32 The list of Internet-Draft Shadow Directories can be accessed at 33 http://www.ietf.org/shadow.html. 35 This Internet-Draft will expire on December 14, 2007. 37 Copyright Notice 39 Copyright (C) The IETF Trust (2007). 41 Abstract 43 This document obsoletes RFC2960 [RFC2960] and RFC3309 [RFC3309] it 44 describes the Stream Control Transmission Protocol (SCTP). SCTP is 45 designed to transport PSTN signaling messages over IP networks, but 46 is capable of broader applications. 48 SCTP is a reliable transport protocol operating on top of a 49 connectionless packet network such as IP. It offers the following 50 services to its users: 52 -- acknowledged error-free non-duplicated transfer of user data, 53 -- data fragmentation to conform to discovered path MTU size, 54 -- sequenced delivery of user messages within multiple streams, with 55 an option for order-of-arrival delivery of individual user 56 messages, 57 -- optional bundling of multiple user messages into a single SCTP 58 packet, and 59 -- network-level fault tolerance through supporting of multi- homing 60 at either or both ends of an association. 62 The design of SCTP includes appropriate congestion avoidance behavior 63 and resistance to flooding and masquerade attacks. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 68 1.1. Motivation . . . . . . . . . . . . . . . . . . . . . . . 6 69 1.2. Architectural View of SCTP . . . . . . . . . . . . . . . 6 70 1.3. Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 7 71 1.4. Abbreviations . . . . . . . . . . . . . . . . . . . . . . 11 72 1.5. Functional View of SCTP . . . . . . . . . . . . . . . . . 11 73 1.5.1. Association Startup and Takedown . . . . . . . . . . 12 74 1.5.2. Sequenced Delivery within Streams . . . . . . . . . . 13 75 1.5.3. User Data Fragmentation . . . . . . . . . . . . . . . 13 76 1.5.4. Acknowledgement and Congestion Avoidance . . . . . . 13 77 1.5.5. Chunk Bundling . . . . . . . . . . . . . . . . . . . 14 78 1.5.6. Packet Validation . . . . . . . . . . . . . . . . . . 14 79 1.5.7. Path Management . . . . . . . . . . . . . . . . . . . 14 80 1.6. Serial Number Arithmetic . . . . . . . . . . . . . . . . 15 81 1.7. Changes from RFC2960 . . . . . . . . . . . . . . . . . . 16 82 2. Conventions . . . . . . . . . . . . . . . . . . . . . . . . . 16 83 3. SCTP packet Format . . . . . . . . . . . . . . . . . . . . . 16 84 3.1. SCTP Common Header Field Descriptions . . . . . . . . . . 17 85 3.2. Chunk Field Descriptions . . . . . . . . . . . . . . . . 18 86 3.2.1. Optional/Variable-length Parameter Format . . . . . . 20 87 3.2.2. Reporting of Unrecognized Parameters . . . . . . . . 22 88 3.3. SCTP Chunk Definitions . . . . . . . . . . . . . . . . . 23 89 3.3.1. Payload Data (DATA) (0) . . . . . . . . . . . . . . . 23 90 3.3.2. Initiation (INIT) (1) . . . . . . . . . . . . . . . . 25 91 3.3.3. Initiation Acknowledgement (INIT ACK) (2): . . . . . 31 92 3.3.4. Selective Acknowledgement (SACK) (3): . . . . . . . . 35 93 3.3.5. Heartbeat Request (HEARTBEAT) (4): . . . . . . . . . 39 94 3.3.6. Heartbeat Acknowledgement (HEARTBEAT ACK) (5): . . . 40 95 3.3.7. Abort Association (ABORT) (6): . . . . . . . . . . . 41 96 3.3.8. Shutdown Association (SHUTDOWN) (7): . . . . . . . . 42 97 3.3.9. Shutdown Acknowledgement (SHUTDOWN ACK) (8): . . . . 42 98 3.3.10. Operation Error (ERROR) (9): . . . . . . . . . . . . 43 99 3.3.10.1. Invalid Stream Identifier (1) . . . . . . . . . 45 100 3.3.10.2. Missing Mandatory Parameter (2) . . . . . . . . 45 101 3.3.10.3. Stale Cookie Error (3) . . . . . . . . . . . . . 46 102 3.3.10.4. Out of Resource (4) . . . . . . . . . . . . . . 46 103 3.3.10.5. Unresolvable Address (5) . . . . . . . . . . . . 47 104 3.3.10.6. Unrecognized Chunk Type (6) . . . . . . . . . . 47 105 3.3.10.7. Invalid Mandatory Parameter (7) . . . . . . . . 48 106 3.3.10.8. Unrecognized Parameters (8) . . . . . . . . . . 48 107 3.3.10.9. No User Data (9) . . . . . . . . . . . . . . . . 48 108 3.3.10.10. Cookie Received While Shutting Down (10) . . . . 49 109 3.3.10.11. Restart of an Association with New Addresses 110 (11) . . . . . . . . . . . . . . . . . . . . . . 49 111 3.3.10.12. User-Initiated Abort (12) . . . . . . . . . . . 50 112 3.3.10.13. Protocol Violation (13) . . . . . . . . . . . . 50 113 3.3.11. Cookie Echo (COOKIE ECHO) (10): . . . . . . . . . . . 51 114 3.3.12. Cookie Acknowledgement (COOKIE ACK) (11): . . . . . . 52 115 3.3.13. Shutdown Complete (SHUTDOWN COMPLETE) (14): . . . . . 52 116 4. SCTP Association State Diagram . . . . . . . . . . . . . . . 53 117 5. Association Initialization . . . . . . . . . . . . . . . . . 56 118 5.1. Normal Establishment of an Association . . . . . . . . . 57 119 5.1.1. Handle Stream Parameters . . . . . . . . . . . . . . 58 120 5.1.2. Handle Address Parameters . . . . . . . . . . . . . . 59 121 5.1.3. Generating State Cookie . . . . . . . . . . . . . . . 61 122 5.1.4. State Cookie Processing . . . . . . . . . . . . . . . 62 123 5.1.5. State Cookie Authentication . . . . . . . . . . . . . 62 124 5.1.6. An Example of Normal Association Establishment . . . 63 125 5.2. Handle Duplicate or Unexpected INIT, INIT ACK, COOKIE 126 ECHO, and COOKIE ACK . . . . . . . . . . . . . . . . . . 65 127 5.2.1. INIT received in COOKIE-WAIT or COOKIE-ECHOED 128 State (Item B) . . . . . . . . . . . . . . . . . . . 65 129 5.2.2. Unexpected INIT in States Other than CLOSED, 130 COOKIE-ECHOED,COOKIE-WAIT and SHUTDOWN-ACK-SENT . . . 66 131 5.2.3. Unexpected INIT ACK . . . . . . . . . . . . . . . . . 67 132 5.2.4. Handle a COOKIE ECHO when a TCB exists . . . . . . . 67 133 5.2.5. Handle Duplicate COOKIE-ACK. . . . . . . . . . . . . 71 134 5.2.6. Handle Stale COOKIE Error . . . . . . . . . . . . . . 71 135 5.3. Other Initialization Issues . . . . . . . . . . . . . . . 71 136 5.3.1. Selection of Tag Value . . . . . . . . . . . . . . . 71 137 5.4. Path Verification . . . . . . . . . . . . . . . . . . . . 72 138 6. User Data Transfer . . . . . . . . . . . . . . . . . . . . . 73 139 6.1. Transmission of DATA Chunks . . . . . . . . . . . . . . . 75 140 6.2. Acknowledgement on Reception of DATA Chunks . . . . . . . 77 141 6.2.1. Processing a Received SACK . . . . . . . . . . . . . 80 142 6.3. Management of Retransmission Timer . . . . . . . . . . . 82 143 6.3.1. RTO Calculation . . . . . . . . . . . . . . . . . . . 82 144 6.3.2. Retransmission Timer Rules . . . . . . . . . . . . . 83 145 6.3.3. Handle T3-rtx Expiration . . . . . . . . . . . . . . 85 146 6.4. Multi-homed SCTP Endpoints . . . . . . . . . . . . . . . 86 147 6.4.1. Failover from Inactive Destination Address . . . . . 87 148 6.5. Stream Identifier and Stream Sequence Number . . . . . . 87 149 6.6. Ordered and Unordered Delivery . . . . . . . . . . . . . 87 150 6.7. Report Gaps in Received DATA TSNs . . . . . . . . . . . . 88 151 6.8. CRC32c Checksum Calculation . . . . . . . . . . . . . . . 89 152 6.9. Fragmentation and Reassembly . . . . . . . . . . . . . . 90 153 6.10. Bundling . . . . . . . . . . . . . . . . . . . . . . . . 91 154 7. Congestion control . . . . . . . . . . . . . . . . . . . . . 92 155 7.1. SCTP Differences from TCP Congestion control . . . . . . 93 156 7.2. SCTP Slow-Start and Congestion Avoidance . . . . . . . . 94 157 7.2.1. Slow-Start . . . . . . . . . . . . . . . . . . . . . 95 158 7.2.2. Congestion Avoidance . . . . . . . . . . . . . . . . 96 159 7.2.3. Congestion Control . . . . . . . . . . . . . . . . . 97 160 7.2.4. Fast Retransmit on Gap Reports . . . . . . . . . . . 97 161 7.3. Path MTU Discovery . . . . . . . . . . . . . . . . . . . 99 162 8. Fault Management . . . . . . . . . . . . . . . . . . . . . . 99 163 8.1. Endpoint Failure Detection . . . . . . . . . . . . . . . 99 164 8.2. Path Failure Detection . . . . . . . . . . . . . . . . . 100 165 8.3. Path Heartbeat . . . . . . . . . . . . . . . . . . . . . 101 166 8.4. Handle "Out of the blue" Packets . . . . . . . . . . . . 103 167 8.5. Verification Tag . . . . . . . . . . . . . . . . . . . . 104 168 8.5.1. Exceptions in Verification Tag Rules . . . . . . . . 104 169 9. Termination of Association . . . . . . . . . . . . . . . . . 105 170 9.1. Abort of an Association . . . . . . . . . . . . . . . . . 106 171 9.2. Shutdown of an Association . . . . . . . . . . . . . . . 106 172 10. Interface with Upper Layer . . . . . . . . . . . . . . . . . 109 173 10.1. ULP-to-SCTP . . . . . . . . . . . . . . . . . . . . . . . 109 174 10.2. SCTP-to-ULP . . . . . . . . . . . . . . . . . . . . . . . 120 175 11. Security Considerations . . . . . . . . . . . . . . . . . . . 123 176 11.1. Security Objectives . . . . . . . . . . . . . . . . . . . 123 177 11.2. SCTP Responses To Potential Threats . . . . . . . . . . . 123 178 11.2.1. Countering Insider Attacks . . . . . . . . . . . . . 124 179 11.2.2. Protecting against Data Corruption in the Network . . 124 180 11.2.3. Protecting Confidentiality . . . . . . . . . . . . . 124 181 11.2.4. Protecting against Blind Denial of Service Attacks . 125 182 11.2.4.1. Flooding . . . . . . . . . . . . . . . . . . . . 125 183 11.2.4.2. Blind Masquerade . . . . . . . . . . . . . . . . 126 184 11.2.4.3. Improper Monopolization of Services . . . . . . 127 185 11.3. SCTP Interactions with Firewalls . . . . . . . . . . . . 127 186 11.4. Protection of Non-SCTP Capable Hosts. . . . . . . . . . . 127 187 12. Network Management Considerations . . . . . . . . . . . . . . 128 188 13. Recommended Transmission Control Block (TCB) Parameters . . . 128 189 13.1. Parameters necessary for the SCTP instance . . . . . . . 129 190 13.2. Parameters necessary per association (i.e. the TCB) . . . 129 191 13.3. Per Transport Address Data . . . . . . . . . . . . . . . 131 192 13.4. General Parameters Needed . . . . . . . . . . . . . . . . 132 193 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 133 194 14.1. IETF-defined Chunk Extension . . . . . . . . . . . . . . 133 195 14.2. IETF-defined Chunk Parameter Extension . . . . . . . . . 133 196 14.3. IETF-defined Additional Error Causes . . . . . . . . . . 134 197 14.4. Payload Protocol Identifiers . . . . . . . . . . . . . . 134 198 15. Suggested SCTP Protocol Parameter Values . . . . . . . . . . 135 199 16. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 135 200 Appendix A. Explicit Congestion Notification . . . . . . . . . . 136 201 Appendix B. CRC32c Checksum Calculation . . . . . . . . . . . . 138 202 Appendix C. ICMP Handling . . . . . . . . . . . . . . . . . . . 140 203 17. References . . . . . . . . . . . . . . . . . . . . . . . . . 146 204 17.1. Normative references . . . . . . . . . . . . . . . . . . 146 205 17.2. Informative References . . . . . . . . . . . . . . . . . 147 206 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 148 207 Intellectual Property and Copyright Statements . . . . . . . . . 150 209 1. Introduction 211 This section explains the reasoning behind the development of the 212 Stream Control Transmission Protocol (SCTP), the services it offers, 213 and the basic concepts needed to understand the detailed description 214 of the protocol. 216 1.1. Motivation 218 TCP [RFC0793] has performed immense service as the primary means of 219 reliable data transfer in IP networks. However, an increasing number 220 of recent applications have found TCP too limiting, and have 221 incorporated their own reliable data transfer protocol on top of UDP 222 [RFC0768]. The limitations which users have wished to bypass include 223 the following: 225 -- TCP provides both reliable data transfer and strict order-of- 226 transmission delivery of data. Some applications need reliable 227 transfer without sequence maintenance, while others would be 228 satisfied with partial ordering of the data. In both of these 229 cases the head-of-line blocking offered by TCP causes unnecessary 230 delay. 232 -- The stream-oriented nature of TCP is often an inconvenience. 233 Applications must add their own record marking to delineate their 234 messages, and must make explicit use of the push facility to 235 ensure that a complete message is transferred in a reasonable 236 time. 238 -- The limited scope of TCP sockets complicates the task of 239 providing highly-available data transfer capability using multi- 240 homed hosts. 242 -- TCP is relatively vulnerable to denial of service attacks, such 243 as SYN attacks. 245 Transport of PSTN signaling across the IP network is an application 246 for which all of these limitations of TCP are relevant. While this 247 application directly motivated the development of SCTP, other 248 applications may find SCTP a good match to their requirements. 250 1.2. Architectural View of SCTP 252 SCTP is viewed as a layer between the SCTP user application ("SCTP 253 user" for short) and a connectionless packet network service such as 254 IP. The remainder of this document assumes SCTP runs on top of IP. 255 The basic service offered by SCTP is the reliable transfer of user 256 messages between peer SCTP users. It performs this service within 257 the context of an association between two SCTP endpoints. Section 10 258 of this document sketches the API which should exist at the boundary 259 between the SCTP and the SCTP user layers. 261 SCTP is connection-oriented in nature, but the SCTP association is a 262 broader concept than the TCP connection. SCTP provides the means for 263 each SCTP endpoint (Section 1.3) to provide the other endpoint 264 (during association startup) with a list of transport addresses 265 (i.e., multiple IP addresses in combination with an SCTP port) 266 through which that endpoint can be reached and from which it will 267 originate SCTP packets. The association spans transfers over all of 268 the possible source/destination combinations which may be generated 269 from each endpoint's lists. 271 _____________ _____________ 272 | SCTP User | | SCTP User | 273 | Application | | Application | 274 |-------------| |-------------| 275 | SCTP | | SCTP | 276 | Transport | | Transport | 277 | Service | | Service | 278 |-------------| |-------------| 279 | |One or more ---- One or more| | 280 | IP Network |IP address \/ IP address| IP Network | 281 | Service |appearances /\ appearances| Service | 282 |_____________| ---- |_____________| 284 SCTP Node A |<-------- Network transport ------->| SCTP Node B 286 Figure 1: An SCTP Association 288 1.3. Key Terms 290 Some of the language used to describe SCTP has been introduced in the 291 previous sections. This section provides a consolidated list of the 292 key terms and their definitions. 294 o Active destination transport address: A transport address on a 295 peer endpoint which a transmitting endpoint considers available 296 for receiving user messages. 298 o Bundling: An optional multiplexing operation, whereby more than 299 one user message may be carried in the same SCTP packet. Each 300 user message occupies its own DATA chunk. 302 o Chunk: A unit of information within an SCTP packet, consisting of 303 a chunk header and chunk-specific content. 305 o Congestion Window (cwnd): An SCTP variable that limits the data, 306 in number of bytes, a sender can send to a particular destination 307 transport address before receiving an acknowledgement. 309 o Cumulative TSN Ack Point: The TSN of the last DATA chunk 310 acknowledged via the Cumulative TSN Ack field of a SACK. 312 o Idle destination address: An address that has not had user 313 messages sent to it within some length of time, normally the 314 HEARTBEAT interval or greater. 316 o Inactive destination transport address: An address which is 317 considered inactive due to errors and unavailable to transport 318 user messages. 320 o Message = user message: Data submitted to SCTP by the Upper Layer 321 Protocol (ULP). 323 o Message Authentication Code (MAC): An integrity check mechanism 324 based on cryptographic hash functions using a secret key. 325 Typically, message authentication codes are used between two 326 parties that share a secret key in order to validate information 327 transmitted between these parties. In SCTP it is used by an 328 endpoint to validate the State Cookie information that is returned 329 from the peer in the COOKIE ECHO chunk. The term "MAC" has 330 different meanings in different contexts. SCTP uses this term 331 with the same meaning as in [RFC2104]. 333 o Network Byte Order: Most significant byte first, a.k.a., Big 334 Endian. 336 o Ordered Message: A user message that is delivered in order with 337 respect to all previous user messages sent within the stream the 338 message was sent on. 340 o Outstanding TSN (at an SCTP endpoint): A TSN (and the associated 341 DATA chunk) that has been sent by the endpoint but for which it 342 has not yet received an acknowledgement. 344 o Path: The route taken by the SCTP packets sent by one SCTP 345 endpoint to a specific destination transport address of its peer 346 SCTP endpoint. Sending to different destination transport 347 addresses does not necessarily guarantee getting separate paths. 349 o Primary Path: The primary path is the destination and source 350 address that will be put into a packet outbound to the peer 351 endpoint by default. The definition includes the source address 352 since an implementation MAY wish to specify both destination and 353 source address to better control the return path taken by reply 354 chunks and on which interface the packet is transmitted when the 355 data sender is multi-homed. 357 o Receiver Window (rwnd): An SCTP variable a data sender uses to 358 store the most recently calculated receiver window of its peer, in 359 number of bytes. This gives the sender an indication of the space 360 available in the receiver's inbound buffer. 362 o SCTP association: A protocol relationship between SCTP endpoints, 363 composed of the two SCTP endpoints and protocol state information 364 including Verification Tags and the currently active set of 365 Transmission Sequence Numbers (TSNs), etc. An association can be 366 uniquely identified by the transport addresses used by the 367 endpoints in the association. Two SCTP endpoints MUST NOT have 368 more than one SCTP association between them at any given time. 370 o SCTP endpoint: The logical sender/receiver of SCTP packets. On a 371 multi-homed host, an SCTP endpoint is represented to its peers as 372 a combination of a set of eligible destination transport addresses 373 to which SCTP packets can be sent and a set of eligible source 374 transport addresses from which SCTP packets can be received. All 375 transport addresses used by an SCTP endpoint must use the same 376 port number, but can use multiple IP addresses. A transport 377 address used by an SCTP endpoint must not be used by another SCTP 378 endpoint. In other words, a transport address is unique to an 379 SCTP endpoint. 381 o SCTP packet (or packet): The unit of data delivery across the 382 interface between SCTP and the connectionless packet network 383 (e.g., IP). An SCTP packet includes the common SCTP header, 384 possible SCTP control chunks, and user data encapsulated within 385 SCTP DATA chunks. 387 o SCTP user application (SCTP user): The logical higher-layer 388 application entity which uses the services of SCTP, also called 389 the Upper-layer Protocol (ULP). 391 o Slow Start Threshold (ssthresh): An SCTP variable. This is the 392 threshold which the endpoint will use to determine whether to 393 perform slow start or congestion avoidance on a particular 394 destination transport address. Ssthresh is in number of bytes. 396 o Stream: A uni-directional logical channel established from one to 397 another associated SCTP endpoint, within which all user messages 398 are delivered in sequence except for those submitted to the 399 unordered delivery service. 401 Note: The relationship between stream numbers in opposite directions 402 is strictly a matter of how the applications use them. It is the 403 responsibility of the SCTP user to create and manage these 404 correlations if they are so desired. 406 o Stream Sequence Number: A 16-bit sequence number used internally 407 by SCTP to assure sequenced delivery of the user messages within a 408 given stream. One stream sequence number is attached to each user 409 message. 411 o Tie-Tags: Two 32-bit random numbers that together make a 64- bit 412 nonce. These Tags are used within a State Cookie and TCB so that 413 a newly restarting association can be linked to the original 414 association within the endpoint that did not restart and yet not 415 reveal the true Verification Tags of an existing association. 417 o Transmission Control Block (TCB): An internal data structure 418 created by an SCTP endpoint for each of its existing SCTP 419 associations to other SCTP endpoints. TCB contains all the status 420 and operational information for the endpoint to maintain and 421 manage the corresponding association. 423 o Transmission Sequence Number (TSN): A 32-bit sequence number used 424 internally by SCTP. One TSN is attached to each chunk containing 425 user data to permit the receiving SCTP endpoint to acknowledge its 426 receipt and detect duplicate deliveries. 428 o Transport address: A Transport Address is traditionally defined by 429 Network Layer address, Transport Layer protocol and Transport 430 Layer port number. In the case of SCTP running over IP, a 431 transport address is defined by the combination of an IP address 432 and an SCTP port number (where SCTP is the Transport protocol). 434 o Unacknowledged TSN (at an SCTP endpoint): A TSN (and the 435 associated DATA chunk) which has been received by the endpoint but 436 for which an acknowledgement has not yet been sent. Or in the 437 opposite case, for a packet that has been sent but no 438 acknowledgement has been received. 440 o Unordered Message: Unordered messages are "unordered" with respect 441 to any other message, this includes both other unordered messages 442 as well as other ordered messages. An unordered message might be 443 delivered prior to or later than ordered messages sent on the same 444 stream. 446 o User message: The unit of data delivery across the interface 447 between SCTP and its user. 449 o Verification Tag: A 32 bit unsigned integer that is randomly 450 generated. The Verification Tag provides a key that allows a 451 receiver to verify that the SCTP packet belongs to the current 452 association and is not an old or stale packet from a previous 453 association. 455 1.4. Abbreviations 457 MAC - Message Authentication Code [RFC2104] 459 RTO - Retransmission Time-out 461 RTT - Round-trip Time 463 RTTVAR - Round-trip Time Variation 465 SCTP - Stream Control Transmission Protocol 467 SRTT - Smoothed RTT 469 TCB - Transmission Control Block 471 TLV - Type-Length-Value Coding Format 473 TSN - Transmission Sequence Number 475 ULP - Upper-layer Protocol 477 1.5. Functional View of SCTP 479 The SCTP transport service can be decomposed into a number of 480 functions. These are depicted in Figure 2 and explained in the 481 remainder of this section. 483 SCTP User Application 485 ----------------------------------------------------- 486 _____________ ____________________ 487 | | | Sequenced delivery | 488 | Association | | within streams | 489 | | |____________________| 490 | startup | 491 | | ____________________________ 492 | and | | User Data Fragmentation | 493 | | |____________________________| 494 | takedown | 495 | | ____________________________ 496 | | | Acknowledgement | 497 | | | and | 498 | | | Congestion Avoidance | 499 | | |____________________________| 500 | | 501 | | ____________________________ 502 | | | Chunk Bundling | 503 | | |____________________________| 504 | | 505 | | ________________________________ 506 | | | Packet Validation | 507 | | |________________________________| 508 | | 509 | | ________________________________ 510 | | | Path Management | 511 |_____________| |________________________________| 513 Figure 2: Functional View of the SCTP Transport Service 515 1.5.1. Association Startup and Takedown 517 An association is initiated by a request from the SCTP user (see the 518 description of the ASSOCIATE (or SEND) primitive in Section 10). 520 A cookie mechanism, similar to one described by Karn and Simpson in 521 [RFC2522] , is employed during the initialization to provide 522 protection against synchronization attacks. The cookie mechanism 523 uses a four-way handshake, the last two legs of which are allowed to 524 carry user data for fast setup. The startup sequence is described in 525 Section 5 of this document. 527 SCTP provides for graceful close (i.e., shutdown) of an active 528 association on request from the SCTP user. See the description of 529 the SHUTDOWN primitive in Section 10. SCTP also allows ungraceful 530 close (i.e., abort), either on request from the user (ABORT 531 primitive) or as a result of an error condition detected within the 532 SCTP layer. Section 9 describes both the graceful and the ungraceful 533 close procedures. 535 SCTP does not support a half-open state (like TCP) wherein one side 536 may continue sending data while the other end is closed. When either 537 endpoint performs a shutdown, the association on each peer will stop 538 accepting new data from its user and only deliver data in queue at 539 the time of the graceful close (see Section 9 ). 541 1.5.2. Sequenced Delivery within Streams 543 The term "stream" is used in SCTP to refer to a sequence of user 544 messages that are to be delivered to the upper-layer protocol in 545 order with respect to other messages within the same stream. This is 546 in contrast to its usage in TCP, where it refers to a sequence of 547 bytes (in this document a byte is assumed to be eight bits). 549 The SCTP user can specify at association startup time the number of 550 streams to be supported by the association. This number is 551 negotiated with the remote end (see Section 5.1.1). User messages 552 are associated with stream numbers (SEND, RECEIVE primitives, 553 Section 10). Internally, SCTP assigns a stream sequence number to 554 each message passed to it by the SCTP user. On the receiving side, 555 SCTP ensures that messages are delivered to the SCTP user in sequence 556 within a given stream. However, while one stream may be blocked 557 waiting for the next in-sequence user message, delivery from other 558 streams may proceed. 560 SCTP provides a mechanism for bypassing the sequenced delivery 561 service. User messages sent using this mechanism are delivered to 562 the SCTP user as soon as they are received. 564 1.5.3. User Data Fragmentation 566 When needed, SCTP fragments user messages to ensure that the SCTP 567 packet passed to the lower layer conforms to the path MTU. On 568 receipt, fragments are reassembled into complete messages before 569 being passed to the SCTP user. 571 1.5.4. Acknowledgement and Congestion Avoidance 573 SCTP assigns a Transmission Sequence Number (TSN) to each user data 574 fragment or unfragmented message. The TSN is independent of any 575 stream sequence number assigned at the stream level. The receiving 576 end acknowledges all TSNs received, even if there are gaps in the 577 sequence. In this way, reliable delivery is kept functionally 578 separate from sequenced stream delivery. 580 The acknowledgement and congestion avoidance function is responsible 581 for packet retransmission when timely acknowledgement has not been 582 received. Packet retransmission is conditioned by congestion 583 avoidance procedures similar to those used for TCP. See Section 6 584 and Section 7 for a detailed description of the protocol procedures 585 associated with this function. 587 1.5.5. Chunk Bundling 589 As described in Section 3, the SCTP packet as delivered to the lower 590 layer consists of a common header followed by one or more chunks. 591 Each chunk may contain either user data or SCTP control information. 592 The SCTP user has the option to request bundling of more than one 593 user messages into a single SCTP packet. The chunk bundling function 594 of SCTP is responsible for assembly of the complete SCTP packet and 595 its disassembly at the receiving end. 597 During times of congestion an SCTP implementation MAY still perform 598 bundling even if the user has requested that SCTP not bundle. The 599 user's disabling of bundling only affects SCTP implementations that 600 may delay a small period of time before transmission (to attempt to 601 encourage bundling). When the user layer disables bundling, this 602 small delay is prohibited but not bundling that is performed during 603 congestion or retransmission. 605 1.5.6. Packet Validation 607 A mandatory Verification Tag field and a 32 bit checksum field (see 608 Appendix B for a description of the CRC32c checksum) are included in 609 the SCTP common header. The Verification Tag value is chosen by each 610 end of the association during association startup. Packets received 611 without the expected Verification Tag value are discarded, as a 612 protection against blind masquerade attacks and against stale SCTP 613 packets from a previous association. The CRC32c checksum should be 614 set by the sender of each SCTP packet to provide additional 615 protection against data corruption in the network. The receiver of 616 an SCTP packet with an invalid CRC32c checksum silently discards the 617 packet. 619 1.5.7. Path Management 621 The sending SCTP user is able to manipulate the set of transport 622 addresses used as destinations for SCTP packets through the 623 primitives described in Section 10. The SCTP path management 624 function chooses the destination transport address for each outgoing 625 SCTP packet based on the SCTP user's instructions and the currently 626 perceived reachability status of the eligible destination set. The 627 path management function monitors reachability through heartbeats 628 when other packet traffic is inadequate to provide this information 629 and advises the SCTP user when reachability of any far-end transport 630 address changes. The path management function is also responsible 631 for reporting the eligible set of local transport addresses to the 632 far end during association startup, and for reporting the transport 633 addresses returned from the far end to the SCTP user. 635 At association start-up, a primary path is defined for each SCTP 636 endpoint, and is used for normal sending of SCTP packets. 638 On the receiving end, the path management is responsible for 639 verifying the existence of a valid SCTP association to which the 640 inbound SCTP packet belongs before passing it for further processing. 642 Note: Path Management and Packet Validation are done at the same 643 time, so although described separately above, in reality they cannot 644 be performed as separate items. 646 1.6. Serial Number Arithmetic 648 It is essential to remember that the actual Transmission Sequence 649 Number space is finite, though very large. This space ranges from 0 650 to 2**32 - 1. Since the space is finite, all arithmetic dealing with 651 Transmission Sequence Numbers must be performed modulo 2**32. This 652 unsigned arithmetic preserves the relationship of sequence numbers as 653 they cycle from 2**32 - 1 to 0 again. There are some subtleties to 654 computer modulo arithmetic, so great care should be taken in 655 programming the comparison of such values. When referring to TSNs, 656 the symbol "=<" means "less than or equal"(modulo 2**32). 658 Comparisons and arithmetic on TSNs in this document SHOULD use Serial 659 Number Arithmetic as defined in [RFC1982] where SERIAL_BITS = 32. 661 An endpoint SHOULD NOT transmit a DATA chunk with a TSN that is more 662 than 2**31 - 1 above the beginning TSN of its current send window. 663 Doing so will cause problems in comparing TSNs. 665 Transmission Sequence Numbers wrap around when they reach 2**32 - 1. 666 That is, the next TSN a DATA chunk MUST use after transmitting TSN = 667 2*32 - 1 is TSN = 0. 669 Any arithmetic done on Stream Sequence Numbers SHOULD use Serial 670 Number Arithmetic as defined in [RFC1982] where SERIAL_BITS = 16. 671 All other arithmetic and comparisons in this document uses normal 672 arithmetic. 674 1.7. Changes from RFC2960 676 SCTP was originally defined in [RFC2960] which this document 677 obsoletes. Readers interested in the details of the various changes 678 that this document incorporates are asked to consult [RFC4460]. 680 2. Conventions 682 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 683 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 684 document are to be interpreted as described in RFC2119 [RFC2119]. 686 3. SCTP packet Format 688 An SCTP packet is composed of a common header and chunks. A chunk 689 contains either control information or user data. 691 The SCTP packet format is shown below: 693 0 1 2 3 694 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 695 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 696 | Common Header | 697 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 698 | Chunk #1 | 699 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 700 | ... | 701 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 702 | Chunk #n | 703 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 705 Multiple chunks can be bundled into one SCTP packet up to the MTU 706 size, except for the INIT, INIT ACK, and SHUTDOWN COMPLETE chunks. 707 These chunks MUST NOT be bundled with any other chunk in a packet. 708 See Section 6.10 for more details on chunk bundling. 710 If a user data message doesn't fit into one SCTP packet it can be 711 fragmented into multiple chunks using the procedure defined in 712 Section 6.9. 714 All integer fields in an SCTP packet MUST be transmitted in network 715 byte order, unless otherwise stated. 717 3.1. SCTP Common Header Field Descriptions 719 SCTP Common Header Format 721 0 1 2 3 722 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 723 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 724 | Source Port Number | Destination Port Number | 725 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 726 | Verification Tag | 727 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 728 | Checksum | 729 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 731 Source Port Number: 16 bits (unsigned integer) 733 This is the SCTP sender's port number. It can be used by the 734 receiver in combination with the source IP address, the SCTP 735 destination port and possibly the destination IP address to 736 identify the association to which this packet belongs. The port 737 number 0 MUST NOT be used. 739 Destination Port Number: 16 bits (unsigned integer) 741 This is the SCTP port number to which this packet is destined. 742 The receiving host will use this port number to de-multiplex the 743 SCTP packet to the correct receiving endpoint/application. The 744 port number 0 MUST NOT be used. 746 Verification Tag: 32 bits (unsigned integer) 748 The receiver of this packet uses the Verification Tag to validate 749 the sender of this SCTP packet. On transmit, the value of this 750 Verification Tag MUST be set to the value of the Initiate Tag 751 received from the peer endpoint during the association 752 initialization, with the following exceptions: 753 - A packet containing an INIT chunk MUST have a zero Verification 754 Tag. 756 - A packet containing a SHUTDOWN-COMPLETE chunk with the T-bit 757 set MUST have the Verification Tag copied from the packet with 758 the SHUTDOWN-ACK chunk. 760 - A packet containing an ABORT chunk may have the verification 761 tag copied from the packet which caused the ABORT to be sent. 762 For details see Section 8.4 and Section 8.5. 763 An INIT chunk MUST be the only chunk in the SCTP packet carrying 764 it. 766 Checksum: 32 bits (unsigned integer) 768 This field contains the checksum of this SCTP packet. Its 769 calculation is discussed in Section 6.8. SCTP uses the CRC32c 770 algorithm as described in Appendix B for calculating the checksum 772 3.2. Chunk Field Descriptions 774 The figure below illustrates the field format for the chunks to be 775 transmitted in the SCTP packet. Each chunk is formatted with a Chunk 776 Type field, a chunk-specific Flag field, a Chunk Length field, and a 777 Value field. 779 0 1 2 3 780 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 781 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 782 | Chunk Type | Chunk Flags | Chunk Length | 783 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 784 \ \ 785 / Chunk Value / 786 \ \ 787 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 789 Chunk Type: 8 bits (unsigned integer) 791 This field identifies the type of information contained in the 792 Chunk Value field. It takes a value from 0 to 254. The value of 793 255 is reserved for future use as an extension field. 794 The values of Chunk Types are defined as follows: 796 ID Value Chunk Type 797 ----- ---------- 798 0 - Payload Data (DATA) 799 1 - Initiation (INIT) 800 2 - Initiation Acknowledgement (INIT ACK) 801 3 - Selective Acknowledgement (SACK) 802 4 - Heartbeat Request (HEARTBEAT) 803 5 - Heartbeat Acknowledgement (HEARTBEAT ACK) 804 6 - Abort (ABORT) 805 7 - Shutdown (SHUTDOWN) 806 8 - Shutdown Acknowledgement (SHUTDOWN ACK) 807 9 - Operation Error (ERROR) 808 10 - State Cookie (COOKIE ECHO) 809 11 - Cookie Acknowledgement (COOKIE ACK) 810 12 - Reserved for Explicit Congestion Notification Echo (ECNE) 811 13 - Reserved for Congestion Window Reduced (CWR) 812 14 - Shutdown Complete (SHUTDOWN COMPLETE) 813 15 to 62 - reserved by IETF 814 63 - IETF-defined Chunk Extensions 815 64 to 126 - reserved by IETF 816 127 - IETF-defined Chunk Extensions 817 128 to 190 - reserved by IETF 818 191 - IETF-defined Chunk Extensions 819 192 to 254 - reserved by IETF 820 255 - IETF-defined Chunk Extensions 822 Chunk Types are encoded such that the highest-order two bits 823 specify the action that must be taken if the processing endpoint 824 does not recognize the Chunk Type. 826 00 - Stop processing this SCTP packet and discard it, do not 827 process any further chunks within it. 829 01 - Stop processing this SCTP packet and discard it, do not 830 process any further chunks within it, and report the 831 unrecognized chunk in an 'Unrecognized Chunk Type'. 833 10 - Skip this chunk and continue processing. 835 11 - Skip this chunk and continue processing, but report in an 836 ERROR Chunk using the 'Unrecognized Chunk Type' cause of 837 error. 838 Note: The ECNE and CWR chunk types are reserved for future use of 839 Explicit Congestion Notification (ECN) - see Appendix A. 841 Chunk Flags: 8 bits 842 The usage of these bits depends on the chunk type as given by the 843 Chunk Type. Unless otherwise specified, they are set to zero on 844 transmit and are ignored on receipt. 846 Chunk Length: 16 bits (unsigned integer) 848 This value represents the size of the chunk in bytes, including 849 the Chunk Type, Chunk Flags, Chunk Length, and Chunk Value fields. 850 Therefore, if the Chunk Value field is zero-length, the Length 851 field will be set to 4. The Chunk Length field does not count any 852 chunk padding. 854 Chunks (including Type, Length, and Value fields) are padded out 855 by the sender with all zero bytes to be a multiple of 4 bytes 856 long. This padding MUST NOT be more than 3 bytes in total. The 857 Chunk Length value does not include terminating padding of the 858 chunk. However, it does include padding of any variable-length 859 parameter except the last parameter in the chunk. The receiver 860 MUST ignore the padding. 862 Note: A robust implementation should accept the Chunk whether or 863 not the final padding has been included in the Chunk Length. 865 Chunk Value: variable length 867 The Chunk Value field contains the actual information to be 868 transferred in the chunk. The usage and format of this field is 869 dependent on the Chunk Type. 871 The total length of a chunk (including Type, Length, and Value 872 fields) MUST be a multiple of 4 bytes. If the length of the chunk is 873 not a multiple of 4 bytes, the sender MUST pad the chunk with all 874 zero bytes, and this padding is not included in the chunk length 875 field. The sender MUST NOT pad with more than 3 bytes. The receiver 876 MUST ignore the padding bytes. 878 SCTP defined chunks are described in detail in Section 3.3. The 879 guidelines for IETF-defined chunk extensions can be found in 880 Section 14.1 of this document. 882 3.2.1. Optional/Variable-length Parameter Format 884 Chunk values of SCTP control chunks consist of a chunk-type-specific 885 header of required fields, followed by zero or more parameters. The 886 optional and variable-length parameters contained in a chunk are 887 defined in a Type-Length-Value format as shown below. 889 0 1 2 3 890 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 891 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 892 | Parameter Type | Parameter Length | 893 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 894 \ \ 895 / Parameter Value / 896 \ \ 897 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 899 Chunk Parameter Type: 16 bits (unsigned integer) 901 The Type field is a 16 bit identifier of the type of parameter. 902 It takes a value of 0 to 65534. 904 The value of 65535 is reserved for IETF-defined extensions. 905 Values other than those defined in specific SCTP chunk description 906 are reserved for use by IETF. 908 Chunk Parameter Length: 16 bits (unsigned integer) 910 The Parameter Length field contains the size of the parameter in 911 bytes, including the Parameter Type, Parameter Length, and 912 Parameter Value fields. Thus, a parameter with a zero-length 913 Parameter Value field would have a Length field of 4. The 914 Parameter Length does not include any padding bytes. 916 Chunk Parameter Value: variable-length. 918 The Parameter Value field contains the actual information to be 919 transferred in the parameter. 921 The total length of a parameter (including Type, Parameter Length 922 and Value fields) MUST be a multiple of 4 bytes. If the length of 923 the parameter is not a multiple of 4 bytes, the sender pads the 924 Parameter at the end (i.e., after the Parameter Value field) with 925 all zero bytes. The length of the padding is not included in the 926 parameter length field. A sender MUST NOT pad with more than 3 927 bytes. The receiver MUST ignore the padding bytes. 929 The Parameter Types are encoded such that the highest-order two 930 bits specify the action that must be taken if the processing 931 endpoint does not recognize the Parameter Type. 932 00 - Stop processing this parameter; do not process any further 933 parameters within this chunk. 935 01 - Stop processing this parameter, do not process any further 936 parameters within this chunk, and report the unrecognized 937 parameter in an 'Unrecognized Parameter', as described in 938 Section 3.2.2. 940 10 - Skip this parameter and continue processing. 942 11 - Skip this parameter and continue processing but report the 943 unrecognized parameter in an 'Unrecognized Parameter', as 944 described in Section 3.2.2. 946 Please note that in all four cases an INIT-ACK or COOKIE-ECHO chunk 947 is sent. In the 00 or 01 case the processing of the parameters after 948 the unknown parameter is canceled, but no processing already done is 949 rolled back. 951 The actual SCTP parameters are defined in the specific SCTP chunk 952 sections. The rules for IETF-defined parameter extensions are 953 defined in Section 14.2. Note that a parameter type MUST be unique 954 across all chunks. For example, the parameter type '5' is used to 955 represent an IPv4 address (see Section 3.2.2). The value '5' then is 956 reserved across all chunks to represent an IPv4 address and MUST NOT 957 be reused with a different meaning in any other chunk. 959 3.2.2. Reporting of Unrecognized Parameters 961 If the receiver of an INIT chunk detects unrecognized parameters and 962 has to report them according to Section 3.2.1, it MUST put the 963 'Unrecognized Parameter' parameter(s) in the INIT-ACK chunk sent in 964 response to the INIT-chunk. Note that if the receiver of the INIT 965 chunk is NOT going to establish an association (e.g., due to lack of 966 resources), an 'Unrecognized Parameter' would NOT be included with 967 any ABORT being sent to the sender of the INIT. 969 If the receiver of an INIT-ACK chunk detects unrecognized parameters 970 and has to report them according to Section 3.2.1, it SHOULD bundle 971 the ERROR chunk containing the 'Unrecognized Parameters' error cause 972 with the COOKIE-ECHO chunk sent in response to the INIT-ACK chunk. 973 If the receiver of the INIT-ACK cannot bundle the COOKIE-ECHO chunk 974 with the ERROR chunk, the ERROR chunk MAY be sent separately but not 975 before the COOKIE-ACK has been received. 977 Note: Any time a COOKIE-ECHO is sent in a packet, it MUST be the 978 first chunk. 980 3.3. SCTP Chunk Definitions 982 This section defines the format of the different SCTP chunk types. 984 3.3.1. Payload Data (DATA) (0) 986 The following format MUST be used for the DATA chunk: 988 0 1 2 3 989 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 990 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 991 | Type = 0 | Reserved|U|B|E| Length | 992 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 993 | TSN | 994 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 995 | Stream Identifier S | Stream Sequence Number n | 996 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 997 | Payload Protocol Identifier | 998 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 999 \ \ 1000 / User Data (seq n of Stream S) / 1001 \ \ 1002 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1004 Reserved: 5 bits 1006 Should be set to all '0's and ignored by the receiver. 1008 U bit: 1 bit 1010 The (U)nordered bit, if set to '1', indicates that this is an 1011 unordered DATA chunk, and there is no Stream Sequence Number 1012 assigned to this DATA chunk. Therefore, the receiver MUST ignore 1013 the Stream Sequence Number field. 1015 After re-assembly (if necessary), unordered DATA chunks MUST be 1016 dispatched to the upper layer by the receiver without any attempt 1017 to re-order. 1019 If an unordered user message is fragmented, each fragment of the 1020 message MUST have its U bit set to '1'. 1022 B bit: 1 bit 1024 The (B)eginning fragment bit, if set, indicates the first fragment 1025 of a user message. 1027 E bit: 1 bit 1029 The (E)nding fragment bit, if set, indicates the last fragment of 1030 a user message. 1032 An unfragmented user message shall have both the B and E bits set to 1033 '1'. Setting both B and E bits to '0' indicates a middle fragment of 1034 a multi-fragment user message, as summarized in the following table: 1036 B E Description 1037 ============================================================ 1038 | 1 0 | First piece of a fragmented user message | 1039 +----------------------------------------------------------+ 1040 | 0 0 | Middle piece of a fragmented user message | 1041 +----------------------------------------------------------+ 1042 | 0 1 | Last piece of a fragmented user message | 1043 +----------------------------------------------------------+ 1044 | 1 1 | Unfragmented Message | 1045 ============================================================ 1046 | Table 1: Fragment Description Flags | 1047 ============================================================ 1049 When a user message is fragmented into multiple chunks, the TSNs are 1050 used by the receiver to reassemble the message. This means that the 1051 TSNs for each fragment of a fragmented user message MUST be strictly 1052 sequential. 1054 Length: 16 bits (unsigned integer) 1056 This field indicates the length of the DATA chunk in bytes from 1057 the beginning of the type field to the end of the user data field 1058 excluding any padding. A DATA chunk with one byte of user data 1059 will have Length set to 17 (indicating 17 bytes). 1061 A DATA chunk with a user data field of length L will have the 1062 length field set to (16 + L) (indicating 16+L bytes) where L MUST 1063 be greater than 0. 1065 TSN : 32 bits (unsigned integer) 1067 This value represents the TSN for this DATA chunk. The valid 1068 range of TSN is from 0 to 4294967295 (2**32 - 1). TSN wraps back 1069 to 0 after reaching 4294967295. 1071 Stream Identifier S: 16 bits (unsigned integer) 1072 Identifies the stream to which the following user data belongs. 1074 Stream Sequence Number n: 16 bits (unsigned integer) 1076 This value represents the stream sequence number of the following 1077 user data within the stream S. Valid range is 0 to 65535. 1079 When a user message is fragmented by SCTP for transport, the same 1080 stream sequence number MUST be carried in each of the fragments of 1081 the message. 1083 Payload Protocol Identifier: 32 bits (unsigned integer) 1085 This value represents an application (or upper layer) specified 1086 protocol identifier. This value is passed to SCTP by its upper 1087 layer and sent to its peer. This identifier is not used by SCTP 1088 but can be used by certain network entities, as well as by the 1089 peer application, to identify the type of information being 1090 carried in this DATA chunk. This field must be sent even in 1091 fragmented DATA chunks (to make sure it is available for agents in 1092 the middle of the network). Note that this field is NOT touched 1093 by an SCTP implementation, therefore its byte order is NOT 1094 necessarily Big Endian. The upper layer is responsible for any 1095 byte order conversions to this field. 1097 The value 0 indicates no application identifier is specified by 1098 the upper layer for this payload data. 1100 User Data: variable length 1102 This is the payload user data. The implementation MUST pad the 1103 end of the data to a 4 byte boundary with all-zero bytes. Any 1104 padding MUST NOT be included in the length field. A sender MUST 1105 never add more than 3 bytes of padding. 1107 3.3.2. Initiation (INIT) (1) 1109 This chunk is used to initiate a SCTP association between two 1110 endpoints. The format of the INIT chunk is shown below: 1112 0 1 2 3 1113 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 1114 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1115 | Type = 1 | Chunk Flags | Chunk Length | 1116 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1117 | Initiate Tag | 1118 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1119 | Advertised Receiver Window Credit (a_rwnd) | 1120 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1121 | Number of Outbound Streams | Number of Inbound Streams | 1122 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1123 | Initial TSN | 1124 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1125 \ \ 1126 / Optional/Variable-Length Parameters / 1127 \ \ 1128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1130 The INIT chunk contains the following parameters. Unless otherwise 1131 noted, each parameter MUST only be included once in the INIT chunk. 1133 Fixed Parameters Status 1134 ---------------------------------------------- 1135 Initiate Tag Mandatory 1136 Advertised Receiver Window Credit Mandatory 1137 Number of Outbound Streams Mandatory 1138 Number of Inbound Streams Mandatory 1139 Initial TSN Mandatory 1141 Variable Parameters Status Type Value 1142 ------------------------------------------------------------- 1143 IPv4 Address (Note 1) Optional 5 1144 IPv6 Address (Note 1) Optional 6 1145 Cookie Preservative Optional 9 1146 Reserved for ECN Capable (Note 2) Optional 32768 (0x8000) 1147 Host Name Address (Note 3) Optional 11 1148 Supported Address Types (Note 4) Optional 12 1150 Note 1: The INIT chunks can contain multiple addresses that can be 1151 IPv4 and/or IPv6 in any combination. 1153 Note 2: The ECN capable field is reserved for future use of Explicit 1154 Congestion Notification. 1156 Note 3: An INIT chunk MUST NOT contain more than one Host Name 1157 address parameter. Moreover, the sender of the INIT MUST NOT combine 1158 any other address types with the Host Name address in the INIT. The 1159 receiver of INIT MUST ignore any other address types if the Host Name 1160 address parameter is present in the received INIT chunk. 1162 Note 4: This parameter, when present, specifies all the address types 1163 the sending endpoint can support. The absence of this parameter 1164 indicates that the sending endpoint can support any address type. 1166 IMPLEMENTATION NOTE: If an INIT chunk is received with known 1167 parameters that are not optional parameters of the INIT chunk then 1168 the receiver SHOULD process the INIT chunk and send back an INIT-ACK. 1169 The receiver of the INIT chunk MAY bundle an ERROR chunk with the 1170 COOKIE-ACK chunk later. However, restrictive implementations MAY 1171 send back an ABORT chunk in response to the INIT chunk. 1173 The Chunk Flags field in INIT is reserved and all bits in it should 1174 be set to 0 by the sender and ignored by the receiver. The sequence 1175 of parameters within an INIT can be processed in any order. 1177 Initiate Tag: 32 bits (unsigned integer) 1179 The receiver of the INIT (the responding end) records the value of 1180 the Initiate Tag parameter. This value MUST be placed into the 1181 Verification Tag field of every SCTP packet that the receiver of 1182 the INIT transmits within this association. 1184 The Initiate Tag is allowed to have any value except 0. See 1185 Section 5.3.1 for more on the selection of the tag value. 1187 If the value of the Initiate Tag in a received INIT chunk is found 1188 to be 0, the receiver MUST treat it as an error and close the 1189 association by transmitting an ABORT. 1191 Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned 1192 integer) 1194 This value represents the dedicated buffer space, in number of 1195 bytes, the sender of the INIT has reserved in association with 1196 this window. During the life of the association this buffer space 1197 SHOULD not be lessened (i.e. dedicated buffers taken away from 1198 this association); however, an endpoint MAY change the value of 1199 a_rwnd it sends in SACK chunks. 1201 Number of Outbound Streams (OS): 16 bits (unsigned integer) 1202 Defines the number of outbound streams the sender of this INIT 1203 chunk wishes to create in this association. The value of 0 MUST 1204 NOT be used. 1206 Note: A receiver of an INIT with the OS value set to 0 SHOULD 1207 abort the association. 1209 Number of Inbound Streams (MIS) : 16 bits (unsigned integer) 1211 Defines the maximum number of streams the sender of this INIT 1212 chunk allows the peer end to create in this association. The 1213 value 0 MUST NOT be used. 1215 Note: There is no negotiation of the actual number of streams but 1216 instead the two endpoints will use the min(requested, offered). 1217 See Section 5.1.1 for details. 1219 Note: A receiver of an INIT with the MIS value of 0 SHOULD abort 1220 the association. 1222 Initial TSN (I-TSN) : 32 bits (unsigned integer) 1224 Defines the initial TSN that the sender will use. The valid range 1225 is from 0 to 4294967295. This field MAY be set to the value of 1226 the Initiate Tag field. 1228 3.3.2.1. Optional/Variable Length Parameters in INIT 1230 The following parameters follow the Type-Length-Value format as 1231 defined in Section 3.2.1. Any Type-Length-Value fields MUST come 1232 after the fixed-length fields defined in the previous section. 1234 IPv4 Address Parameter (5) 1236 0 1 2 3 1237 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 1238 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1239 | Type = 5 | Length = 8 | 1240 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1241 | IPv4 Address | 1242 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1244 IPv4 Address: 32 bits (unsigned integer) 1245 Contains an IPv4 address of the sending endpoint. It is binary 1246 encoded. 1248 IPv6 Address Parameter (6) 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 1252 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1253 | Type = 6 | Length = 20 | 1254 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1255 | | 1256 | IPv6 Address | 1257 | | 1258 | | 1259 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1261 IPv6 Address: 128 bits (unsigned integer) 1263 Contains an IPv6 address of the sending endpoint. It is binary 1264 encoded. 1266 Note: A sender MUST NOT use an IPv4-mapped IPv6 address [RFC4291]. 1267 but should instead use an IPv4 Address Parameter for an IPv4 1268 address. 1270 Combined with the Source Port Number in the SCTP common header, 1271 the value passed in an IPv4 or IPv6 Address parameter indicates a 1272 transport address the sender of the INIT will support for the 1273 association being initiated. That is, during the lifetime of this 1274 association, this IP address can appear in the source address 1275 field of an IP datagram sent from the sender of the INIT, and can 1276 be used as a destination address of an IP datagram sent from the 1277 receiver of the INIT. 1279 More than one IP Address parameter can be included in an INIT 1280 chunk when the INIT sender is multi-homed. Moreover, a multi- 1281 homed endpoint may have access to different types of network, thus 1282 more than one address type can be present in one INIT chunk, i.e., 1283 IPv4 and IPv6 addresses are allowed in the same INIT chunk. 1285 If the INIT contains at least one IP Address parameter, then the 1286 source address of the IP datagram containing the INIT chunk and 1287 any additional address(es) provided within the INIT can be used as 1288 destinations by the endpoint receiving the INIT. If the INIT does 1289 not contain any IP Address parameters, the endpoint receiving the 1290 INIT MUST use the source address associated with the received IP 1291 datagram as its sole destination address for the association. 1293 Note that not using any IP address parameters in the INIT and 1294 INIT-ACK is an alternative to make an association more likely to 1295 work across a NAT box. 1297 Cookie Preservative (9) 1299 The sender of the INIT shall use this parameter to suggest to the 1300 receiver of the INIT for a longer life-span of the State Cookie. 1302 0 1 2 3 1303 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 1304 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1305 | Type = 9 | Length = 8 | 1306 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1307 | Suggested Cookie Life-span Increment (msec.) | 1308 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1310 Suggested Cookie Life-span Increment: 32 bits (unsigned integer) 1312 This parameter indicates to the receiver how much increment in 1313 milliseconds the sender wishes the receiver to add to its default 1314 cookie life-span. 1316 This optional parameter should be added to the INIT chunk by the 1317 sender when it re-attempts establishing an association with a peer 1318 to which its previous attempt of establishing the association 1319 failed due to a stale cookie operation error. The receiver MAY 1320 choose to ignore the suggested cookie life-span increase for its 1321 own security reasons. 1323 Host Name Address (11) 1325 The sender of INIT uses this parameter to pass its Host Name (in 1326 place of its IP addresses) to its peer. The peer is responsible for 1327 resolving the name. Using this parameter might make it more likely 1328 for the association to work across a NAT box. 1330 0 1 2 3 1331 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 1332 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1333 | Type = 11 | Length | 1334 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1335 / Host Name / 1336 \ \ 1337 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1339 Host Name: variable length 1341 This field contains a host name in "host name syntax" per RFC1123 1342 Section 2.1 [RFC1123]. The method for resolving the host name is 1343 out of scope of SCTP. 1345 Note: At least one null terminator is included in the Host Name 1346 string and must be included in the length. 1348 Supported Address Types (12) 1350 The sender of INIT uses this parameter to list all the address types 1351 it can support. 1353 0 1 2 3 1354 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 1355 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1356 | Type = 12 | Length | 1357 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1358 | Address Type #1 | Address Type #2 | 1359 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1360 | ...... | 1361 +-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+ 1363 Address Type: 16 bits (unsigned integer) 1365 This is filled with the type value of the corresponding address 1366 TLV (e.g., IPv4 = 5, IPv6 = 6, Hostname = 11). 1368 3.3.3. Initiation Acknowledgement (INIT ACK) (2): 1370 The INIT ACK chunk is used to acknowledge the initiation of an SCTP 1371 association. 1373 The parameter part of INIT ACK is formatted similarly to the INIT 1374 chunk. It uses two extra variable parameters: The State Cookie and 1375 the Unrecognized Parameter: 1377 The format of the INIT ACK chunk is shown below: 1379 0 1 2 3 1380 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 1381 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1382 | Type = 2 | Chunk Flags | Chunk Length | 1383 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1384 | Initiate Tag | 1385 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1386 | Advertised Receiver Window Credit | 1387 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1388 | Number of Outbound Streams | Number of Inbound Streams | 1389 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1390 | Initial TSN | 1391 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1392 \ \ 1393 / Optional/Variable-Length Parameters / 1394 \ \ 1395 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1397 Initiate Tag: 32 bits (unsigned integer) 1399 The receiver of the INIT ACK records the value of the Initiate Tag 1400 parameter. This value MUST be placed into the Verification Tag 1401 field of every SCTP packet that the INIT ACK receiver transmits 1402 within this association. 1404 The Initiate Tag MUST NOT take the value 0. See Section 5.3.1 for 1405 more on the selection of the Initiate Tag value. 1407 If the value of the Initiate Tag in a received INIT ACK chunk is 1408 found to be 0, the receiver MUST destroy the association 1409 discarding its TCB. The receiver MAY send an ABORT for debugging 1410 purpose. 1412 Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned 1413 integer) 1415 This value represents the dedicated buffer space, in number of 1416 bytes, the sender of the INIT ACK has reserved in association with 1417 this window. During the life of the association this buffer space 1418 SHOULD not be lessened (i.e. dedicated buffers taken away from 1419 this association). 1421 Number of Outbound Streams (OS): 16 bits (unsigned integer) 1423 Defines the number of outbound streams the sender of this INIT ACK 1424 chunk wishes to create in this association. The value of 0 MUST 1425 NOT be used, and the value MUST NOT be greater than the MIS value 1426 sent in the INIT chunk. 1428 Note: A receiver of an INIT ACK with the OS value set to 0 SHOULD 1429 destroy the association discarding its TCB. 1431 Number of Inbound Streams (MIS) : 16 bits (unsigned integer) 1433 Defines the maximum number of streams the sender of this INIT ACK 1434 chunk allows the peer end to create in this association. The 1435 value 0 MUST NOT be used. 1437 Note: There is no negotiation of the actual number of streams but 1438 instead the two endpoints will use the min(requested, offered). 1439 See Section 5.1.1 for details. 1441 Note: A receiver of an INIT ACK with the MIS value set to 0 SHOULD 1442 destroy the association discarding its TCB. 1444 Initial TSN (I-TSN) : 32 bits (unsigned integer) 1446 Defines the initial TSN that the INIT-ACK sender will use. The 1447 valid range is from 0 to 4294967295. This field MAY be set to the 1448 value of the Initiate Tag field. 1450 Fixed Parameters Status 1451 ---------------------------------------------- 1452 Initiate Tag Mandatory 1453 Advertised Receiver Window Credit Mandatory 1454 Number of Outbound Streams Mandatory 1455 Number of Inbound Streams Mandatory 1456 Initial TSN Mandatory 1458 Variable Parameters Status Type Value 1459 ------------------------------------------------------------- 1460 State Cookie Mandatory 7 1461 IPv4 Address (Note 1) Optional 5 1462 IPv6 Address (Note 1) Optional 6 1463 Unrecognized Parameter Optional 8 1464 Reserved for ECN Capable (Note 2) Optional 32768 (0x8000) 1465 Host Name Address (Note 3) Optional 11 1467 Note 1: The INIT ACK chunks can contain any number of IP address 1468 parameters that can be IPv4 and/or IPv6 in any combination. 1470 Note 2: The ECN capable field is reserved for future use of Explicit 1471 Congestion Notification. 1473 Note 3: The INIT ACK chunks MUST NOT contain more than one Host Name 1474 address parameter. Moreover, the sender of the INIT ACK MUST NOT 1475 combine any other address types with the Host Name address in the 1476 INIT ACK. The receiver of the INIT ACK MUST ignore any other address 1477 types if the Host Name address parameter is present. 1479 IMPLEMENTATION NOTE: An implementation MUST be prepared to receive a 1480 INIT ACK that is quite large (more than 1500 bytes) due to the 1481 variable size of the state cookie AND the variable address list. For 1482 example if a responder to the INIT has 1000 IPv4 addresses it wishes 1483 to send, it would need at least 8,000 bytes to encode this in the 1484 INIT ACK. 1486 IMPLEMENTATION NOTE: If an INIT-ACK chunk is received with known 1487 parameters that are not optional parameters of the INIT-ACK chunk, 1488 then the receiver SHOULD process the INIT-ACK chunk and send back a 1489 COOKIE-ECHO. The receiver of the INIT-ACK chunk MAY bundle an ERROR 1490 chunk with the COOKIE-ECHO chunk. However, restrictive 1491 implementations MAY send back an ABORT chunk in response to the INIT- 1492 ACK chunk. 1494 In combination with the Source Port carried in the SCTP common 1495 header, each IP Address parameter in the INIT ACK indicates to the 1496 receiver of the INIT ACK a valid transport address supported by the 1497 sender of the INIT ACK for the lifetime of the association being 1498 initiated. 1500 If the INIT ACK contains at least one IP Address parameter, then the 1501 source address of the IP datagram containing the INIT ACK and any 1502 additional address(es) provided within the INIT ACK may be used as 1503 destinations by the receiver of the INIT-ACK. If the INIT ACK does 1504 not contain any IP Address parameters, the receiver of the INIT-ACK 1505 MUST use the source address associated with the received IP datagram 1506 as its sole destination address for the association. 1508 The State Cookie and Unrecognized Parameters use the Type-Length- 1509 Value format as defined in Section 3.2.1 and are described below. 1510 The other fields are defined the same as their counterparts in the 1511 INIT chunk. 1513 3.3.3.1. Optional or Variable Length Parameters 1515 State Cookie 1517 Parameter Type Value: 7 1519 Parameter Length: variable size, depending on Size of Cookie 1521 Parameter Value: 1523 This parameter value MUST contain all the necessary state and 1524 parameter information required for the sender of this INIT ACK to 1525 create the association, along with a Message Authentication Code 1526 (MAC). See Section 5.1.3 for details on State Cookie definition. 1528 Unrecognized Parameter: 1530 Parameter Type Value: 8 1532 Parameter Length: Variable Size. 1534 Parameter Value: 1535 This parameter is returned to the originator of the INIT chunk 1536 when the INIT contains an unrecognized parameter which has a value 1537 that indicates that it should be reported to the sender. This 1538 parameter value field will contain unrecognized parameters copied 1539 from the INIT chunk complete with Parameter Type, Length and Value 1540 fields. 1542 3.3.4. Selective Acknowledgement (SACK) (3): 1544 This chunk is sent to the peer endpoint to acknowledge received DATA 1545 chunks and to inform the peer endpoint of gaps in the received 1546 subsequences of DATA chunks as represented by their TSNs. 1548 The SACK MUST contain the Cumulative TSN Ack, Advertised Receiver 1549 Window Credit (a_rwnd), Number of Gap Ack Blocks, and Number of 1550 Duplicate TSNs fields. 1552 By definition, the value of the Cumulative TSN Ack parameter is the 1553 last TSN received before a break in the sequence of received TSNs 1554 occurs; the next TSN value following this one has not yet been 1555 received at the endpoint sending the SACK. This parameter therefore 1556 acknowledges receipt of all TSNs less than or equal to its value. 1558 The handling of a_rwnd by the receiver of the SACK is discussed in 1559 detail in Section 6.2.1. 1561 The SACK also contains zero or more Gap Ack Blocks. Each Gap Ack 1562 Block acknowledges a subsequence of TSNs received following a break 1563 in the sequence of received TSNs. By definition, all TSNs 1564 acknowledged by Gap Ack Blocks are greater than the value of the 1565 Cumulative TSN Ack. 1567 0 1 2 3 1568 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 1569 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1570 | Type = 3 |Chunk Flags | Chunk Length | 1571 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1572 | Cumulative TSN Ack | 1573 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1574 | Advertised Receiver Window Credit (a_rwnd) | 1575 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1576 | Number of Gap Ack Blocks = N | Number of Duplicate TSNs = X | 1577 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1578 | Gap Ack Block #1 Start | Gap Ack Block #1 End | 1579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1580 / / 1581 \ ... \ 1582 / / 1583 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1584 | Gap Ack Block #N Start | Gap Ack Block #N End | 1585 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1586 | Duplicate TSN 1 | 1587 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1588 / / 1589 \ ... \ 1590 / / 1591 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1592 | Duplicate TSN X | 1593 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1595 Chunk Flags: 8 bits 1597 Set to all zeros on transmit and ignored on receipt. 1599 Cumulative TSN Ack: 32 bits (unsigned integer) 1601 This parameter contains the TSN of the last DATA chunk received in 1602 sequence before a gap. In the case where no DATA chunk has been 1603 received, this value is set to the peer's Initial TSN minus one. 1605 Advertised Receiver Window Credit (a_rwnd): 32 bits (unsigned 1606 integer) 1607 This field indicates the updated receive buffer space in bytes of 1608 the sender of this SACK, see Section 6.2.1 for details. 1610 Number of Gap Ack Blocks: 16 bits (unsigned integer) 1612 Indicates the number of Gap Ack Blocks included in this SACK. 1614 Number of Duplicate TSNs: 16 bit 1616 This field contains the number of duplicate TSNs the endpoint has 1617 received. Each duplicate TSN is listed following the Gap Ack 1618 Block list. 1620 Gap Ack Blocks: 1622 These fields contain the Gap Ack Blocks. They are repeated for 1623 each Gap Ack Block up to the number of Gap Ack Blocks defined in 1624 the Number of Gap Ack Blocks field. All DATA chunks with TSNs 1625 greater than or equal to (Cumulative TSN Ack + Gap Ack Block 1626 Start) and less than or equal to (Cumulative TSN Ack + Gap Ack 1627 Block End) of each Gap Ack Block are assumed to have been received 1628 correctly. 1630 Gap Ack Block Start: 16 bits (unsigned integer) 1632 Indicates the Start offset TSN for this Gap Ack Block. To 1633 calculate the actual TSN number the Cumulative TSN Ack is added to 1634 this offset number. This calculated TSN identifies the first TSN 1635 in this Gap Ack Block that has been received. 1637 Gap Ack Block End: 16 bits (unsigned integer) 1639 Indicates the End offset TSN for this Gap Ack Block. To calculate 1640 the actual TSN number the Cumulative TSN Ack is added to this 1641 offset number. This calculated TSN identifies the TSN of the last 1642 DATA chunk received in this Gap Ack Block. 1644 For example, assume the receiver has the following DATA chunks newly 1645 arrived at the time when it decides to send a Selective ACK, 1646 ---------- 1647 | TSN=17 | 1648 ---------- 1649 | | <- still missing 1650 ---------- 1651 | TSN=15 | 1652 ---------- 1653 | TSN=14 | 1654 ---------- 1655 | | <- still missing 1656 ---------- 1657 | TSN=12 | 1658 ---------- 1659 | TSN=11 | 1660 ---------- 1661 | TSN=10 | 1662 ---------- 1664 then, the parameter part of the SACK MUST be constructed as follows 1665 (assuming the new a_rwnd is set to 4660 by the sender): 1667 +--------------------------------+ 1668 | Cumulative TSN Ack = 12 | 1669 +--------------------------------+ 1670 | a_rwnd = 4660 | 1671 +----------------+---------------+ 1672 | num of block=2 | num of dup=0 | 1673 +----------------+---------------+ 1674 |block #1 strt=2 |block #1 end=3 | 1675 +----------------+---------------+ 1676 |block #2 strt=5 |block #2 end=5 | 1677 +----------------+---------------+ 1679 Duplicate TSN: 32 bits (unsigned integer) 1681 Indicates the number of times a TSN was received in duplicate 1682 since the last SACK was sent. Every time a receiver gets a 1683 duplicate TSN (before sending the SACK) it adds it to the list of 1684 duplicates. The duplicate count is re-initialized to zero after 1685 sending each SACK. 1687 For example, if a receiver were to get the TSN 19 three times it 1688 would list 19 twice in the outbound SACK. After sending the SACK if 1689 it received yet one more TSN 19 it would list 19 as a duplicate once 1690 in the next outgoing SACK. 1692 3.3.5. Heartbeat Request (HEARTBEAT) (4): 1694 An endpoint should send this chunk to its peer endpoint to probe the 1695 reachability of a particular destination transport address defined in 1696 the present association. 1698 The parameter field contains the Heartbeat Information which is a 1699 variable length opaque data structure understood only by the sender. 1701 0 1 2 3 1702 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 1703 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1704 | Type = 4 | Chunk Flags | Heartbeat Length | 1705 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1706 \ \ 1707 / Heartbeat Information TLV (Variable-Length) / 1708 \ \ 1709 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1711 Chunk Flags: 8 bits 1713 Set to zero on transmit and ignored on receipt. 1715 Heartbeat Length: 16 bits (unsigned integer) 1717 Set to the size of the chunk in bytes, including the chunk header 1718 and the Heartbeat Information field. 1720 Heartbeat Information: variable length 1722 Defined as a variable-length parameter using the format described 1723 in Section 3.2.1, i.e.: 1725 Variable Parameters Status Type Value 1726 ------------------------------------------------------------- 1727 Heartbeat Info Mandatory 1 1729 0 1 2 3 1730 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 1731 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1732 | Heartbeat Info Type=1 | HB Info Length | 1733 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1734 / Sender-specific Heartbeat Info / 1735 \ \ 1736 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1738 The Sender-specific Heartbeat Info field should normally include 1739 information about the sender's current time when this HEARTBEAT 1740 chunk is sent and the destination transport address to which this 1741 HEARTBEAT is sent (see Section 8.3). This information is simply 1742 reflected back by the receiver in the HEARTBEAT ACK message (see 1743 Section 3.3.6). Note also that the HEARTBEAT message is both for 1744 reachability checking and for Path Verification (see Section 5.4). 1745 When a HEARTBEAT chunk is being used for path verification 1746 purposes it MUST hold a 64 bit random nonce. 1748 3.3.6. Heartbeat Acknowledgement (HEARTBEAT ACK) (5): 1750 An endpoint should send this chunk to its peer endpoint as a response 1751 to a HEARTBEAT chunk (see Section 8.3). A HEARTBEAT ACK is always 1752 sent to the source IP address of the IP datagram containing the 1753 HEARTBEAT chunk to which this ack is responding. 1755 The parameter field contains a variable length opaque data structure. 1757 0 1 2 3 1758 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 1759 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1760 | Type = 5 | Chunk Flags | Heartbeat Ack Length | 1761 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1762 \ \ 1763 / Heartbeat Information TLV (Variable-Length) / 1764 \ \ 1765 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1767 Chunk Flags: 8 bits 1769 Set to zero on transmit and ignored on receipt. 1771 Heartbeat Ack Length: 16 bits (unsigned integer) 1773 Set to the size of the chunk in bytes, including the chunk header 1774 and the Heartbeat Information field. 1776 Heartbeat Information: variable length 1778 This field MUST contain the Heartbeat Information parameter of the 1779 Heartbeat Request to which this Heartbeat Acknowledgement is 1780 responding. 1782 Variable Parameters Status Type Value 1783 ------------------------------------------------------------- 1784 Heartbeat Info Mandatory 1 1786 3.3.7. Abort Association (ABORT) (6): 1788 The ABORT chunk is sent to the peer of an association to close the 1789 association. The ABORT chunk may contain Cause Parameters to inform 1790 the receiver about the reason of the abort. DATA chunks MUST NOT be 1791 bundled with ABORT. Control chunks (except for INIT, INIT ACK and 1792 SHUTDOWN COMPLETE) MAY be bundled with an ABORT but they MUST be 1793 placed before the ABORT in the SCTP packet, or they will be ignored 1794 by the receiver. 1796 If an endpoint receives an ABORT with a format error or no TCB is 1797 found, it MUST silently discard it. Moreover, under any 1798 circumstances, an endpoint that receives an ABORT MUST NOT respond to 1799 that ABORT by sending an ABORT of its own. 1801 0 1 2 3 1802 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 1803 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1804 | Type = 6 |Reserved |T| Length | 1805 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1806 \ \ 1807 / zero or more Error Causes / 1808 \ \ 1809 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1811 Chunk Flags: 8 bits 1813 Reserved: 7 bits 1815 Set to 0 on transmit and ignored on receipt. 1817 T bit: 1 bit 1819 The T bit is set to 0 if the sender filled in the Verification Tag 1820 expected by the peer. If the Verification Tag is reflected, the T 1821 bit MUST be set to 1. Reflecting means that the sent Verification 1822 Tag is the same as the received one. 1824 Note: Special rules apply to this chunk for verification, please 1825 see Section 8.5.1 for details. 1827 Length: 16 bits (unsigned integer) 1829 Set to the size of the chunk in bytes, including the chunk header 1830 and all the Error Cause fields present. 1832 See Section 3.3.10 for Error Cause definitions. 1834 3.3.8. Shutdown Association (SHUTDOWN) (7): 1836 An endpoint in an association MUST use this chunk to initiate a 1837 graceful close of the association with its peer. This chunk has the 1838 following format. 1840 0 1 2 3 1841 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 1842 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1843 | Type = 7 | Chunk Flags | Length = 8 | 1844 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1845 | Cumulative TSN Ack | 1846 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1848 Chunk Flags: 8 bits 1850 Set to zero on transmit and ignored on receipt. 1852 Length: 16 bits (unsigned integer) 1854 Indicates the length of the parameter. Set to 8. 1856 Cumulative TSN Ack: 32 bits (unsigned integer) 1858 This parameter contains the TSN of the last chunk received in 1859 sequence before any gaps. 1861 Note: Since the SHUTDOWN message does not contain Gap Ack Blocks, 1862 it cannot be used to acknowledge TSNs received out of order. In a 1863 SACK, lack of Gap Ack Blocks that were previously included 1864 indicates that the data receiver reneged on the associated DATA 1865 chunks. Since SHUTDOWN does not contain Gap Ack Blocks, the 1866 receiver of the SHUTDOWN shouldn't interpret the lack of a Gap Ack 1867 Block as a renege. (see Section 6.2 for information on reneging) 1869 3.3.9. Shutdown Acknowledgement (SHUTDOWN ACK) (8): 1871 This chunk MUST be used to acknowledge the receipt of the SHUTDOWN 1872 chunk at the completion of the shutdown process, see Section 9.2 for 1873 details. 1875 The SHUTDOWN ACK chunk has no parameters. 1877 0 1 2 3 1878 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 1879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1880 | Type = 8 |Chunk Flags | Length = 4 | 1881 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1883 Chunk Flags: 8 bits 1885 Set to zero on transmit and ignored on receipt. 1887 3.3.10. Operation Error (ERROR) (9): 1889 An endpoint sends this chunk to its peer endpoint to notify it of 1890 certain error conditions. It contains one or more error causes. An 1891 Operation Error is not considered fatal in and of itself, but may be 1892 used with an ABORT chunk to report a fatal condition. It has the 1893 following parameters: 1895 0 1 2 3 1896 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 1897 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1898 | Type = 9 | Chunk Flags | Length | 1899 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1900 \ \ 1901 / one or more Error Causes / 1902 \ \ 1903 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1905 Chunk Flags: 8 bits 1907 Set to zero on transmit and ignored on receipt. 1909 Length: 16 bits (unsigned integer) 1911 Set to the size of the chunk in bytes, including the chunk header 1912 and all the Error Cause fields present. 1914 Error causes are defined as variable-length parameters using the 1915 format described in 3.2.1, i.e.: 1917 0 1 2 3 1918 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 1919 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1920 | Cause Code | Cause Length | 1921 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1922 / Cause-specific Information / 1923 \ \ 1924 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1926 Cause Code: 16 bits (unsigned integer) 1928 Defines the type of error conditions being reported. 1930 Cause Code 1931 Value Cause Code 1932 --------- ---------------- 1933 1 Invalid Stream Identifier 1934 2 Missing Mandatory Parameter 1935 3 Stale Cookie Error 1936 4 Out of Resource 1937 5 Unresolvable Address 1938 6 Unrecognized Chunk Type 1939 7 Invalid Mandatory Parameter 1940 8 Unrecognized Parameters 1941 9 No User Data 1942 10 Cookie Received While Shutting Down 1943 11 Restart of an Association with New Addresses 1944 12 User Initiated Abort 1945 13 Protocol Violation 1947 Cause Length: 16 bits (unsigned integer) 1949 Set to the size of the parameter in bytes, including the Cause 1950 Code, Cause Length, and Cause-Specific Information fields. 1952 Cause-specific Information: variable length 1954 This field carries the details of the error condition. 1956 Section 3.3.10.1 - Section 3.3.10.13 define error causes for SCTP. 1957 Guidelines for the IETF to define new error cause values are 1958 discussed in Section 14.3. 1960 3.3.10.1. Invalid Stream Identifier (1) 1962 Cause of error 1964 --------------- 1966 Invalid Stream Identifier: Indicates endpoint received a DATA chunk 1967 sent to a nonexistent stream. 1969 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1970 | Cause Code=1 | Cause Length=8 | 1971 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1972 | Stream Identifier | (Reserved) | 1973 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1975 Stream Identifier: 16 bits (unsigned integer) 1977 Contains the Stream Identifier of the DATA chunk received in 1978 error. 1980 Reserved: 16 bits 1982 This field is reserved. It is set to all 0's on transmit and 1983 Ignored on receipt. 1985 3.3.10.2. Missing Mandatory Parameter (2) 1987 Cause of error 1989 --------------- 1991 Missing Mandatory Parameter: Indicates that one or more mandatory TLV 1992 parameters are missing in a received INIT or INIT ACK. 1994 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1995 | Cause Code=2 | Cause Length=8+N*2 | 1996 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1997 | Number of missing params=N | 1998 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1999 | Missing Param Type #1 | Missing Param Type #2 | 2000 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2001 | Missing Param Type #N-1 | Missing Param Type #N | 2002 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2004 Number of Missing params: 32 bits (unsigned integer) 2005 This field contains the number of parameters contained in the 2006 Cause-specific Information field. 2008 Missing Param Type: 16 bits (unsigned integer) 2010 Each field will contain the missing mandatory parameter number. 2012 3.3.10.3. Stale Cookie Error (3) 2014 Cause of error 2016 -------------- 2018 Stale Cookie Error: Indicates the receipt of a valid State Cookie 2019 that has expired. 2021 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2022 | Cause Code=3 | Cause Length=8 | 2023 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2024 | Measure of Staleness (usec.) | 2025 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2027 Measure of Staleness: 32 bits (unsigned integer) 2029 This field contains the difference, in microseconds, between the 2030 current time and the time the State Cookie expired. 2032 The sender of this error cause MAY choose to report how long past 2033 expiration the State Cookie is by including a non-zero value in 2034 the Measure of Staleness field. If the sender does not wish to 2035 provide this information it should set the Measure of Staleness 2036 field to the value of zero. 2038 3.3.10.4. Out of Resource (4) 2040 Cause of error 2042 --------------- 2044 Out of Resource: Indicates that the sender is out of resource. This 2045 is usually sent in combination with or within an ABORT. 2047 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2048 | Cause Code=4 | Cause Length=4 | 2049 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2051 3.3.10.5. Unresolvable Address (5) 2053 Cause of error 2055 --------------- 2057 Unresolvable Address: Indicates that the sender is not able to 2058 resolve the specified address parameter (e.g., type of address is not 2059 supported by the sender). This is usually sent in combination with 2060 or within an ABORT. 2062 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2063 | Cause Code=5 | Cause Length | 2064 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2065 / Unresolvable Address / 2066 \ \ 2067 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2069 Unresolvable Address: variable length 2071 The unresolvable address field contains the complete Type, Length 2072 and Value of the address parameter (or Host Name parameter) that 2073 contains the unresolvable address or host name. 2075 3.3.10.6. Unrecognized Chunk Type (6) 2077 Cause of error 2079 --------------- 2081 Unrecognized Chunk Type: This error cause is returned to the 2082 originator of the chunk if the receiver does not understand the chunk 2083 and the upper bits of the 'Chunk Type' are set to 01 or 11. 2085 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2086 | Cause Code=6 | Cause Length | 2087 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2088 / Unrecognized Chunk / 2089 \ \ 2090 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2092 Unrecognized Chunk: variable length 2094 The Unrecognized Chunk field contains the unrecognized Chunk from 2095 the SCTP packet complete with Chunk Type, Chunk Flags and Chunk 2096 Length. 2098 3.3.10.7. Invalid Mandatory Parameter (7) 2100 Cause of error 2102 --------------- 2104 Invalid Mandatory Parameter: This error cause is returned to the 2105 originator of an INIT or INIT ACK chunk when one of the mandatory 2106 parameters is set to a invalid value. 2108 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2109 | Cause Code=7 | Cause Length=4 | 2110 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2112 3.3.10.8. Unrecognized Parameters (8) 2114 Cause of error 2116 --------------- 2118 Unrecognized Parameters: This error cause is returned to the 2119 originator of the INIT ACK chunk if the receiver does not recognize 2120 one or more Optional TLV parameters in the INIT ACK chunk. 2122 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2123 | Cause Code=8 | Cause Length | 2124 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2125 / Unrecognized Parameters / 2126 \ \ 2127 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2129 Unrecognized Parameters: variable length 2131 The Unrecognized Parameters field contains the unrecognized 2132 parameters copied from the INIT ACK chunk complete with TLV. This 2133 error cause is normally contained in an ERROR chunk bundled with 2134 the COOKIE ECHO chunk when responding to the INIT ACK, when the 2135 sender of the COOKIE ECHO chunk wishes to report unrecognized 2136 parameters. 2138 3.3.10.9. No User Data (9) 2140 Cause of error 2142 --------------- 2144 No User Data: This error cause is returned to the originator of a 2145 DATA chunk if a received DATA chunk has no user data. 2147 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2148 | Cause Code=9 | Cause Length=8 | 2149 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2150 / TSN value / 2151 \ \ 2152 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2154 TSN value: 32 bits (+unsigned integer) 2156 The TSN value field contains the TSN of the DATA chunk received 2157 with no user data field. 2159 This cause code is normally returned in an ABORT chunk (see 2160 Section 6.2) 2162 3.3.10.10. Cookie Received While Shutting Down (10) 2164 Cause of error 2166 --------------- 2168 Cookie Received While Shutting Down: A COOKIE ECHO was received While 2169 the endpoint was in SHUTDOWN-ACK-SENT state. This error is usually 2170 returned in an ERROR chunk bundled with the retransmitted SHUTDOWN 2171 ACK. 2173 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2174 | Cause Code=10 | Cause Length=4 | 2175 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2177 3.3.10.11. Restart of an Association with New Addresses (11) 2179 Cause of error 2181 -------------- 2183 Restart of an association with new addresses: An INIT was received on 2184 an existing association. But the INIT added addresses to the 2185 association that were previously NOT part of the association. The 2186 new addresses are listed in the error code. This ERROR is normally 2187 sent as part of an ABORT refusing the INIT (see Section 5.2). 2189 0 1 2 3 2190 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 2191 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2192 | Cause Code=11 | Cause Length=Variable | 2193 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2194 / New Address TLVs / 2195 \ \ 2196 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2198 Note: Each New Address TLV is an exact copy of the TLV that was found 2199 in the INIT chunk that was new, including the Parameter Type and the 2200 Parameter length. 2202 3.3.10.12. User-Initiated Abort (12) 2204 Cause of error 2206 -------------- 2208 This error cause MAY be included in ABORT chunks that are sent 2209 because of an upper layer request. The upper layer can specify an 2210 Upper Layer Abort Reason that is transported by SCTP transparently 2211 and MAY be delivered to the upper layer protocol at the peer. 2213 0 1 2 3 2214 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 2215 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2216 | Cause Code=12 | Cause Length=Variable | 2217 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2218 / Upper Layer Abort Reason / 2219 \ \ 2220 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2222 3.3.10.13. Protocol Violation (13) 2224 Cause of error 2226 -------------- 2228 This error cause MAY be included in ABORT chunks that are sent 2229 because an SCTP endpoint detects a protocol violation of the peer 2230 that is not covered by the error causes described in Section 3.3.10.1 2231 to Section 3.3.10.12. An implementation MAY provide additional 2232 information specifying what kind of protocol violation has been 2233 detected. 2235 0 1 2 3 2236 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 2237 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2238 | Cause Code=13 | Cause Length=Variable | 2239 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2240 / Additional Information / 2241 \ \ 2242 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2244 3.3.11. Cookie Echo (COOKIE ECHO) (10): 2246 This chunk is used only during the initialization of an association. 2247 It is sent by the initiator of an association to its peer to complete 2248 the initialization process. This chunk MUST precede any DATA chunk 2249 sent within the association, but MAY be bundled with one or more DATA 2250 chunks in the same packet. 2252 0 1 2 3 2253 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 2254 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2255 | Type = 10 |Chunk Flags | Length | 2256 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2257 / Cookie / 2258 \ \ 2259 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2261 Chunk Flags: 8 bit 2263 Set to zero on transmit and ignored on receipt. 2265 Length: 16 bits (unsigned integer) 2267 Set to the size of the chunk in bytes, including the 4 bytes of 2268 the chunk header and the size of the Cookie. 2270 Cookie: variable size 2272 This field must contain the exact cookie received in the State 2273 Cookie parameter from the previous INIT ACK. 2275 An implementation SHOULD make the cookie as small as possible to 2276 insure interoperability. 2278 Note: A Cookie Echo does NOT contain a State Cookie Parameter; 2279 instead, the data within the State Cookie's Parameter Value 2280 becomes the data within the Cookie Echo's Chunk Value. This 2281 allows an implementation to change only the first two bytes of the 2282 State Cookie parameter to become a Cookie Echo Chunk. 2284 3.3.12. Cookie Acknowledgement (COOKIE ACK) (11): 2286 This chunk is used only during the initialization of an association. 2287 It is used to acknowledge the receipt of a COOKIE ECHO chunk. This 2288 chunk MUST precede any DATA or SACK chunk sent within the 2289 association, but MAY be bundled with one or more DATA chunks or SACK 2290 chunk in the same SCTP packet. 2292 0 1 2 3 2293 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 2294 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2295 | Type = 11 |Chunk Flags | Length = 4 | 2296 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2298 Chunk Flags: 8 bits 2300 Set to zero on transmit and ignored on receipt. 2302 3.3.13. Shutdown Complete (SHUTDOWN COMPLETE) (14): 2304 This chunk MUST be used to acknowledge the receipt of the SHUTDOWN 2305 ACK chunk at the completion of the shutdown process, see Section 9.2 2306 for details. 2308 The SHUTDOWN COMPLETE chunk has no parameters. 2310 0 1 2 3 2311 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 2312 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2313 | Type = 14 |Reserved |T| Length = 4 | 2314 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2316 Chunk Flags: 8 bits 2318 Reserved: 7 bits 2320 Set to 0 on transmit and ignored on receipt. 2322 T bit: 1 bit 2324 The T bit is set to 0 if the sender filled in the Verification Tag 2325 expected by the peer. If the Verification Tag is reflected, the T 2326 bit MUST be set to 1. Reflecting means that the sent Verification 2327 Tag is the same as the received one. 2329 Note: Special rules apply to this chunk for verification, please see 2330 Section 8.5.1 for details. 2332 4. SCTP Association State Diagram 2334 During the lifetime of an SCTP association, the SCTP endpoint's 2335 association progress from one state to another in response to various 2336 events. The events that may potentially advance an association's 2337 state include: 2339 o SCTP user primitive calls, e.g., [ASSOCIATE], [SHUTDOWN], [ABORT], 2341 o Reception of INIT, COOKIE ECHO, ABORT, SHUTDOWN, etc., control 2342 chunks, or 2344 o Some timeout events. 2346 The state diagram in the figures below illustrates state changes, 2347 together with the causing events and resulting actions. Note that 2348 some of the error conditions are not shown in the state diagram. 2349 Full description of all special cases are found in the text. 2351 Note: Chunk names are given in all capital letters, while parameter 2352 names have the first letter capitalized, e.g., COOKIE ECHO chunk type 2353 vs. State Cookie parameter. If more than one event/message can occur 2354 which causes a state transition it is labeled (A), (B) etc. 2356 ----- -------- (from any state) 2357 / \ / rcv ABORT [ABORT] 2358 rcv INIT | | | ---------- or ---------- 2359 --------------- | v v delete TCB snd ABORT 2360 generate Cookie \ +---------+ delete TCB 2361 snd INIT ACK ---| CLOSED | 2362 +---------+ 2363 / \ [ASSOCIATE] 2364 / \ --------------- 2365 | | create TCB 2366 | | snd INIT 2367 | | strt init timer 2368 rcv valid | | 2370 COOKIE ECHO | v 2371 (1) ---------------- | +------------+ 2372 create TCB | | COOKIE-WAIT| (2) 2373 snd COOKIE ACK | +------------+ 2374 | | 2375 | | rcv INIT ACK 2376 | | ----------------- 2377 | | snd COOKIE ECHO 2378 | | stop init timer 2379 | | strt cookie timer 2380 | v 2381 | +--------------+ 2382 | | COOKIE-ECHOED| (3) 2383 | +--------------+ 2384 | | 2385 | | rcv COOKIE ACK 2386 | | ----------------- 2387 | | stop cookie timer 2388 v v 2389 +---------------+ 2390 | ESTABLISHED | 2391 +---------------+ 2393 (from the ESTABLISHED state only) 2394 | 2395 | 2396 /--------+--------\ 2397 [SHUTDOWN] / \ 2398 -------------------| | 2399 check outstanding | | 2400 DATA chunks | | 2401 v | 2402 +---------+ | 2403 |SHUTDOWN-| | rcv SHUTDOWN 2404 |PENDING | |------------------ 2405 +---------+ | check outstanding 2406 | | DATA chunks 2407 No more outstanding | | 2408 ---------------------| | 2409 snd SHUTDOWN | | 2410 strt shutdown timer | | 2411 v v 2412 +---------+ +-----------+ 2413 (4) |SHUTDOWN-| | SHUTDOWN- | (5,6) 2414 |SENT | | RECEIVED | 2415 +---------+ +-----------+ 2416 | \ | 2418 (A) rcv SHUTDOWN ACK | \ | 2419 ----------------------| \ | 2420 stop shutdown timer | \rcv:SHUTDOWN | 2421 send SHUTDOWN COMPLETE| \ (B) | 2422 delete TCB | \ | 2423 | \ | No more outstanding 2424 | \ |----------------- 2425 | \ | send SHUTDOWN ACK 2426 (B)rcv SHUTDOWN | \ | strt shutdown timer 2427 ----------------------| \ | 2428 send SHUTDOWN ACK | \ | 2429 start shutdown timer | \ | 2430 move to SHUTDOWN- | \ | 2431 ACK-SENT | | | 2432 | v | 2433 | +-----------+ 2434 | | SHUTDOWN- | (7) 2435 | | ACK-SENT | 2436 | +----------+- 2437 | | (C)rcv SHUTDOWN COMPLETE 2438 | |----------------- 2439 | | stop shutdown timer 2440 | | delete TCB 2441 | | 2442 | | (D)rcv SHUTDOWN ACK 2443 | |-------------- 2444 | | stop shutdown timer 2445 | | send SHUTDOWN COMPLETE 2446 | | delete TCB 2447 | | 2448 \ +---------+ / 2449 \-->| CLOSED |<--/ 2450 +---------+ 2452 Figure 3: State Transition Diagram of SCTP 2454 Notes: 2456 1) If the State Cookie in the received COOKIE ECHO is invalid (i.e., 2457 failed to pass the integrity check), the receiver MUST silently 2458 discard the packet. Or, if the received State Cookie is expired 2459 (see Section 5.1.5), the receiver MUST send back an ERROR chunk. 2460 In either case, the receiver stays in the CLOSED state. 2462 2) If the T1-init timer expires, the endpoint MUST retransmit INIT 2463 and re-start the T1-init timer without changing state. This MUST 2464 be repeated up to 'Max.Init.Retransmits' times. After that, the 2465 endpoint MUST abort the initialization process and report the 2466 error to SCTP user. 2468 3) If the T1-cookie timer expires, the endpoint MUST retransmit 2469 COOKIE ECHO and re-start the T1-cookie timer without changing 2470 state. This MUST be repeated up to 'Max.Init.Retransmits' times. 2471 After that, the endpoint MUST abort the initialization process 2472 and report the error to SCTP user. 2474 4) In SHUTDOWN-SENT state the endpoint MUST acknowledge any received 2475 DATA chunks without delay. 2477 5) In SHUTDOWN-RECEIVED state, the endpoint MUST NOT accept any new 2478 send request from its SCTP user. 2480 6) In SHUTDOWN-RECEIVED state, the endpoint MUST transmit or 2481 retransmit data and leave this state when all data in queue is 2482 transmitted. 2484 7) In SHUTDOWN-ACK-SENT state, the endpoint MUST NOT accept any new 2485 send request from its SCTP user. 2487 The CLOSED state is used to indicate that an association is not 2488 created (i.e., doesn't exist). 2490 5. Association Initialization 2492 Before the first data transmission can take place from one SCTP 2493 endpoint ("A") to another SCTP endpoint ("Z"), the two endpoints must 2494 complete an initialization process in order to set up an SCTP 2495 association between them. 2497 The SCTP user at an endpoint should use the ASSOCIATE primitive to 2498 initialize an SCTP association to another SCTP endpoint. 2500 IMPLEMENTATION NOTE: From an SCTP-user's point of view, an 2501 association may be implicitly opened, without an ASSOCIATE primitive 2502 (see Section 10.1 B) being invoked, by the initiating endpoint's 2503 sending of the first user data to the destination endpoint. The 2504 initiating SCTP will assume default values for all mandatory and 2505 optional parameters for the INIT/INIT ACK. 2507 Once the association is established, unidirectional streams are open 2508 for data transfer on both ends (see Section 5.1.1). 2510 5.1. Normal Establishment of an Association 2512 The initialization process consists of the following steps (assuming 2513 that SCTP endpoint "A" tries to set up an association with SCTP 2514 endpoint "Z" and "Z" accepts the new association): 2516 A) "A" first sends an INIT chunk to "Z". In the INIT, "A" must 2517 provide its Verification Tag (Tag_A) in the Initiate Tag field. 2518 Tag_A SHOULD be a random number in the range of 1 to 4294967295 2519 (see Section 5.3.1 for Tag value selection). After sending the 2520 INIT, "A" starts the T1-init timer and enters the COOKIE-WAIT 2521 state. 2523 B) "Z" shall respond immediately with an INIT ACK chunk. The 2524 destination IP address of the INIT ACK MUST be set to the source 2525 IP address of the INIT to which this INIT ACK is responding. In 2526 the response, besides filling in other parameters, "Z" must set 2527 the Verification Tag field to Tag_A, and also provide its own 2528 Verification Tag (Tag_Z) in the Initiate Tag field. 2530 Moreover, "Z" MUST generate and send along with the INIT ACK a 2531 State Cookie. See Section 5.1.3 for State Cookie generation. 2533 Note: After sending out INIT ACK with the State Cookie parameter, 2534 "Z" MUST NOT allocate any resources, nor keep any states for the 2535 new association. Otherwise, "Z" will be vulnerable to resource 2536 attacks. 2538 C) Upon reception of the INIT ACK from "Z", "A" shall stop the T1- 2539 init timer and leave COOKIE-WAIT state. "A" shall then send the 2540 State Cookie received in the INIT ACK chunk in a COOKIE ECHO 2541 chunk, start the T1-cookie timer, and enter the COOKIE-ECHOED 2542 state. 2544 Note: The COOKIE ECHO chunk can be bundled with any pending 2545 outbound DATA chunks, but it MUST be the first chunk in the packet 2546 and until the COOKIE ACK is returned the sender MUST NOT send any 2547 other packets to the peer. 2549 D) Upon reception of the COOKIE ECHO chunk, Endpoint "Z" will reply 2550 with a COOKIE ACK chunk after building a TCB and moving to the 2551 ESTABLISHED state. A COOKIE ACK chunk may be bundled with any 2552 pending DATA chunks (and/or SACK chunks), but the COOKIE ACK chunk 2553 MUST be the first chunk in the packet. 2555 IMPLEMENTATION NOTE: An implementation may choose to send the 2556 Communication Up notification to the SCTP user upon reception of a 2557 valid COOKIE ECHO chunk. 2559 E) Upon reception of the COOKIE ACK, endpoint "A" will move from the 2560 COOKIE-ECHOED state to the ESTABLISHED state, stopping the T1- 2561 cookie timer. It may also notify its ULP about the successful 2562 establishment of the association with a Communication Up 2563 notification (see Section 10). 2565 An INIT or INIT ACK chunk MUST NOT be bundled with any other chunk. 2566 They MUST be the only chunks present in the SCTP packets that carry 2567 them. 2569 An endpoint MUST send the INIT ACK to the IP address from which it 2570 received the INIT. 2572 Note: T1-init timer and T1-cookie timer shall follow the same rules 2573 given in Section 6.3. 2575 If an endpoint receives an INIT, INIT ACK, or COOKIE ECHO chunk but 2576 decides not to establish the new association due to missing mandatory 2577 parameters in the received INIT or INIT ACK, invalid parameter 2578 values, or lack of local resources, it SHOULD respond with an ABORT 2579 chunk. It SHOULD also specify the cause of abort, such as the type 2580 of the missing mandatory parameters, etc., by including the error 2581 cause parameters with the ABORT chunk. The Verification Tag field in 2582 the common header of the outbound SCTP packet containing the ABORT 2583 chunk MUST be set to the Initiate Tag value of the peer. 2585 Note that a COOKIE ECHO chunk that does NOT pass the integrity check 2586 is NOT considered an 'invalid parameter' and requires special 2587 handling see Section 5.1 2589 After the reception of the first DATA chunk in an association the 2590 endpoint MUST immediately respond with a SACK to acknowledge the DATA 2591 chunk. Subsequent acknowledgements should be done as described in 2592 Section 6.2. 2594 When the TCB is created, each endpoint MUST set its internal 2595 Cumulative TSN Ack Point to the value of its transmitted Initial TSN 2596 minus one. 2598 IMPLEMENTATION NOTE: The IP addresses and SCTP port are generally 2599 used as the key to find the TCB within an SCTP instance. 2601 5.1.1. Handle Stream Parameters 2603 In the INIT and INIT ACK chunks, the sender of the chunk MUST 2604 indicate the number of outbound streams (OS) it wishes to have in the 2605 association, as well as the maximum inbound streams (MIS) it will 2606 accept from the other endpoint. 2608 After receiving the stream configuration information from the other 2609 side, each endpoint MUST perform the following check: If the peer's 2610 MIS is less than the endpoint's OS, meaning that the peer is 2611 incapable of supporting all the outbound streams the endpoint wants 2612 to configure, the endpoint MUST use MIS outbound streams and MAY 2613 report any shortage to the upper layer. The upper layer can then 2614 choose to abort the association if the resource shortage is 2615 unacceptable. 2617 After the association is initialized, the valid outbound stream 2618 identifier range for either endpoint shall be 0 to min(local OS, 2619 remote MIS)-1. 2621 5.1.2. Handle Address Parameters 2623 During the association initialization, an endpoint shall use the 2624 following rules to discover and collect the destination transport 2625 address(es) of its peer. 2627 A) If there are no address parameters present in the received INIT or 2628 INIT ACK chunk, the endpoint shall take the source IP address from 2629 which the chunk arrives and record it, in combination with the 2630 SCTP source port number, as the only destination transport address 2631 for this peer. 2633 B) If there is a Host Name parameter present in the received INIT or 2634 INIT ACK chunk, the endpoint shall resolve that host name to a 2635 list of IP address(es) and derive the transport address(es) of 2636 this peer by combining the resolved IP address(es) with the SCTP 2637 source port. 2639 The endpoint MUST ignore any other IP address parameters if they 2640 are also present in the received INIT or INIT ACK chunk. 2642 The time at which the receiver of an INIT resolves the host name 2643 has potential security implications to SCTP. If the receiver of 2644 an INIT resolves the host name upon the reception of the chunk, 2645 and the mechanism the receiver uses to resolve the host name 2646 involves potential long delay (e.g. DNS query), the receiver may 2647 open itself up to resource attacks for the period of time while it 2648 is waiting for the name resolution results before it can build the 2649 State Cookie and release local resources. 2651 Therefore, in cases where the name translation involves potential 2652 long delay, the receiver of the INIT MUST postpone the name 2653 resolution till the reception of the COOKIE ECHO chunk from the 2654 peer. In such a case, the receiver of the INIT SHOULD build the 2655 State Cookie using the received Host Name (instead of destination 2656 transport addresses) and send the INIT ACK to the source IP 2657 address from which the INIT was received. 2659 The receiver of an INIT ACK shall always immediately attempt to 2660 resolve the name upon the reception of the chunk. 2662 The receiver of the INIT or INIT ACK MUST NOT send user data 2663 (piggy-backed or stand-alone) to its peer until the host name is 2664 successfully resolved. 2666 If the name resolution is not successful, the endpoint MUST 2667 immediately send an ABORT with "Unresolvable Address" error cause 2668 to its peer. The ABORT shall be sent to the source IP address 2669 from which the last peer packet was received. 2671 C) If there are only IPv4/IPv6 addresses present in the received INIT 2672 or INIT ACK chunk, the receiver MUST derive and record all the 2673 transport addresses from the received chunk AND the source IP 2674 address that sent the INIT or INIT ACK. The transport addresses 2675 are derived by the combination of SCTP source port (from the 2676 common header) and the IP address parameter(s) carried in the INIT 2677 or INIT ACK chunk and the source IP address of the IP datagram. 2678 The receiver should use only these transport addresses as 2679 destination transport addresses when sending subsequent packets to 2680 its peer. 2681 D) An INIT or INIT ACK chunk MUST be treated as belonging to an 2682 already established association (or one in the process of being 2683 established) if the use of any of the valid address parameters 2684 contained within the chunk would identify an existing TCB. 2686 IMPLEMENTATION NOTE: In some cases (e.g., when the implementation 2687 doesn't control the source IP address that is used for transmitting), 2688 an endpoint might need to include in its INIT or INIT ACK all 2689 possible IP addresses from which packets to the peer could be 2690 transmitted. 2692 After all transport addresses are derived from the INIT or INIT ACK 2693 chunk using the above rules, the endpoint shall select one of the 2694 transport addresses as the initial primary path. 2696 Note: The INIT-ACK MUST be sent to the source address of the INIT. 2698 The sender of INIT may include a 'Supported Address Types' parameter 2699 in the INIT to indicate what types of address are acceptable. When 2700 this parameter is present, the receiver of INIT (initiatee) MUST 2701 either use one of the address types indicated in the Supported 2702 Address Types parameter when responding to the INIT, or abort the 2703 association with an "Unresolvable Address" error cause if it is 2704 unwilling or incapable of using any of the address types indicated by 2705 its peer. 2707 IMPLEMENTATION NOTE: In the case that the receiver of an INIT ACK 2708 fails to resolve the address parameter due to an unsupported type, it 2709 can abort the initiation process and then attempt a re-initiation by 2710 using a 'Supported Address Types' parameter in the new INIT to 2711 indicate what types of address it prefers. 2713 IMPLEMENTATION NOTE: If an SCTP endpoint that only supports either 2714 IPv4 or IPv6 receives IPv4 and IPv6 addresses in an INIT or INIT- ACK 2715 chunk from its peer, it MUST use all the addresses belonging to the 2716 supported address family. The other addresses MAY be ignored. The 2717 endpoint SHOULD NOT respond with any kind of error indication. 2719 IMPLEMENTATION NOTE: If an SCTP endpoint lists in the 'Supported 2720 Address Types' parameter either IPv4 or IPv6, but uses the other 2721 family for sending the packet containing the INIT chunk, or if it 2722 also lists addresses of the other family in the INIT chunk, then the 2723 address family that is not listed in the 'Supported Address Types' 2724 parameter SHOULD also be considered as supported by the receiver of 2725 the INIT chunk. The receiver of the INIT chunk SHOULD NOT respond 2726 with any kind of error indication. 2728 5.1.3. Generating State Cookie 2730 When sending an INIT ACK as a response to an INIT chunk, the sender 2731 of INIT ACK creates a State Cookie and sends it in the State Cookie 2732 parameter of the INIT ACK. Inside this State Cookie, the sender 2733 should include a MAC (see [RFC2104] for an example), a time stamp on 2734 when the State Cookie is created, and the lifespan of the State 2735 Cookie, along with all the information necessary for it to establish 2736 the association. 2738 The following steps SHOULD be taken to generate the State Cookie: 2740 1) Create an association TCB using information from both the 2741 received INIT and the outgoing INIT ACK chunk, 2743 2) In the TCB, set the creation time to the current time of day, and 2744 the lifespan to the protocol parameter 'Valid.Cookie.Life' (see 2745 Section 15 ), 2747 3) From the TCB, identify and collect the minimal subset of 2748 information needed to re-create the TCB, and generate a MAC using 2749 this subset of information and a secret key (see [RFC2104] for an 2750 example of generating a MAC), and 2752 4) Generate the State Cookie by combining this subset of information 2753 and the resultant MAC. 2755 After sending the INIT ACK with the State Cookie parameter, the 2756 sender SHOULD delete the TCB and any other local resource related to 2757 the new association, so as to prevent resource attacks. 2759 The hashing method used to generate the MAC is strictly a private 2760 matter for the receiver of the INIT chunk. The use of a MAC is 2761 mandatory to prevent denial of service attacks. The secret key 2762 SHOULD be random ( [RFC4086] provides some information on randomness 2763 guidelines); it SHOULD be changed reasonably frequently, and the 2764 timestamp in the State Cookie MAY be used to determine which key 2765 should be used to verify the MAC. 2767 An implementation SHOULD make the cookie as small as possible to 2768 insure interoperability. 2770 5.1.4. State Cookie Processing 2772 When an endpoint (in the COOKIE WAIT state) receives an INIT ACK 2773 chunk with a State Cookie parameter, it MUST immediately send a 2774 COOKIE ECHO chunk to its peer with the received State Cookie. The 2775 sender MAY also add any pending DATA chunks to the packet after the 2776 COOKIE ECHO chunk. 2778 The endpoint shall also start the T1-cookie timer after sending out 2779 the COOKIE ECHO chunk. If the timer expires, the endpoint shall 2780 retransmit the COOKIE ECHO chunk and restart the T1-cookie timer. 2781 This is repeated until either a COOKIE ACK is received or 2782 'Max.Init.Retransmits' (see Section 15 is reached causing the peer 2783 endpoint to be marked unreachable (and thus the association enters 2784 the CLOSED state). 2786 5.1.5. State Cookie Authentication 2788 When an endpoint receives a COOKIE ECHO chunk from another endpoint 2789 with which it has no association, it shall take the following 2790 actions: 2792 1) Compute a MAC using the TCB data carried in the State Cookie and 2793 the secret key (note the timestamp in the State Cookie MAY be 2794 used to determine which secret key to use). Reference [RFC2104] 2795 can be used as a guideline for generating the MAC, 2797 2) Authenticate the State Cookie as one that it previously generated 2798 by comparing the computed MAC against the one carried in the 2799 State Cookie. If this comparison fails, the SCTP packet, 2800 including the COOKIE ECHO and any DATA chunks, should be silently 2801 discarded, 2803 3) Compare the port numbers and the Verification Tag contained 2804 within the COOKIE ECHO chunk to the actual port numbers and the 2805 Verification Tag within the SCTP common header of the received 2806 packet. If these values do not match, the packet MUST be 2807 silently discarded. 2809 4) Compare the creation timestamp in the State Cookie to the current 2810 local time. If the elapsed time is longer than the lifespan 2811 carried in the State Cookie, then the packet, including the 2812 COOKIE ECHO and any attached DATA chunks, SHOULD be discarded, 2813 and the endpoint MUST transmit an ERROR chunk with a "Stale 2814 Cookie" error cause to the peer endpoint. 2816 5) If the State Cookie is valid, create an association to the sender 2817 of the COOKIE ECHO chunk with the information in the TCB data 2818 carried in the COOKIE ECHO and enter the ESTABLISHED state. 2820 6) Send a COOKIE ACK chunk to the peer acknowledging receipt of the 2821 COOKIE ECHO. The COOKIE ACK MAY be bundled with an outbound DATA 2822 chunk or SACK chunk; however, the COOKIE ACK MUST be the first 2823 chunk in the SCTP packet. 2825 7) Immediately acknowledge any DATA chunk bundled with the COOKIE 2826 ECHO with a SACK (subsequent DATA chunk acknowledgement should 2827 follow the rules defined in Section 6.2). As mentioned in step 2828 5, if the SACK is bundled with the COOKIE ACK, the COOKIE ACK 2829 MUST appear first in the SCTP packet. 2831 If a COOKIE ECHO is received from an endpoint with which the receiver 2832 of the COOKIE ECHO has an existing association, the procedures in 2833 Section 5.2 should be followed. 2835 5.1.6. An Example of Normal Association Establishment 2837 In the following example, "A" initiates the association and then 2838 sends a user message to "Z", then "Z" sends two user messages to "A" 2839 later (assuming no bundling or fragmentation occurs): 2841 Endpoint A Endpoint Z 2842 {app sets association with Z} 2843 (build TCB) 2844 INIT [I-Tag=Tag_A 2845 & other info] ------\ 2846 (Start T1-init timer) \ 2847 (Enter COOKIE-WAIT state) \---> (compose temp TCB and Cookie_Z) 2848 /-- INIT ACK [Veri Tag=Tag_A, 2849 / I-Tag=Tag_Z, 2850 (Cancel T1-init timer) <------/ Cookie_Z, & other info] 2851 (destroy temp TCB) 2852 COOKIE ECHO [Cookie_Z] ------\ 2853 (Start T1-init timer) \ 2854 (Enter COOKIE-ECHOED state) \---> (build TCB enter ESTABLISHED 2855 state) 2856 /---- COOKIE-ACK 2857 / 2858 (Cancel T1-init timer, <-----/ 2859 Enter ESTABLISHED state) 2860 {app sends 1st user data; strm 0} 2861 DATA [TSN=initial TSN_A 2862 Strm=0,Seq=0 & user data]--\ 2863 (Start T3-rtx timer) \ 2864 \-> 2865 /----- SACK [TSN Ack=init 2866 / TSN_A,Block=0] 2867 (Cancel T3-rtx timer) <------/ 2868 ... 2869 {app sends 2 messages;strm 0} 2870 /---- DATA 2871 / [TSN=init TSN_Z 2872 <--/ Strm=0,Seq=0 & user data 1] 2873 SACK [TSN Ack=init TSN_Z, /---- DATA 2874 Block=0] --------\ / [TSN=init TSN_Z +1, 2875 \/ Strm=0,Seq=1 & user data 2] 2876 <------/\ 2877 \ 2878 \------> 2880 Figure 4: INITIATION Example 2882 If the T1-init timer expires at "A" after the INIT or COOKIE ECHO 2883 chunks are sent, the same INIT or COOKIE ECHO chunk with the same 2884 Initiate Tag (i.e., Tag_A) or State Cookie shall be retransmitted and 2886 the timer restarted. This shall be repeated Max.Init.Retransmits 2887 times before "A" considers "Z" unreachable and reports the failure to 2888 its upper layer (and thus the association enters the CLOSED state). 2890 When retransmitting the INIT, the endpoint MUST follow the rules 2891 defined in 6.3 to determine the proper timer value. 2893 5.2. Handle Duplicate or Unexpected INIT, INIT ACK, COOKIE ECHO, and 2894 COOKIE ACK 2896 During the lifetime of an association (in one of the possible 2897 states), an endpoint may receive from its peer endpoint one of the 2898 setup chunks (INIT, INIT ACK, COOKIE ECHO, and COOKIE ACK). The 2899 receiver shall treat such a setup chunk as a duplicate and process it 2900 as described in this section. 2902 Note: An endpoint will not receive the chunk unless the chunk was 2903 sent to a SCTP transport address and is from a SCTP transport address 2904 associated with this endpoint. Therefore, the endpoint processes 2905 such a chunk as part of its current association. 2907 The following scenarios can cause duplicated or unexpected chunks: 2909 A) The peer has crashed without being detected, re-started itself and 2910 sent out a new INIT chunk trying to restore the association, 2912 B) Both sides are trying to initialize the association at about the 2913 same time, 2915 C) The chunk is from a stale packet that was used to establish the 2916 present association or a past association that is no longer in 2917 existence, 2919 D) The chunk is a false packet generated by an attacker, or 2921 E) The peer never received the COOKIE ACK and is retransmitting its 2922 COOKIE ECHO. 2924 The rules in the following sections shall be applied in order to 2925 identify and correctly handle these cases. 2927 5.2.1. INIT received in COOKIE-WAIT or COOKIE-ECHOED State (Item B) 2929 This usually indicates an initialization collision, i.e., each 2930 endpoint is attempting, at about the same time, to establish an 2931 association with the other endpoint. 2933 Upon receipt of an INIT in the COOKIE-WAIT state, an endpoint MUST 2934 respond with an INIT ACK using the same parameters it sent in its 2935 original INIT chunk (including its Initiation Tag, unchanged). When 2936 responding, the endpoint MUST send the INIT ACK back to the same 2937 address that the original INIT (sent by this endpoint) was sent to. 2939 Upon receipt of an INIT in the COOKIE-ECHOED state, an endpoint MUST 2940 respond with an INIT ACK using the same parameters it sent in its 2941 original INIT chunk (including its Initiation Tag, unchanged), 2942 provided that no NEW address has been added to the forming 2943 association. If the INIT message indicates that a new address has 2944 been added to the association, then the entire INIT MUST be 2945 discarded, and NO changes should be made to the existing association. 2946 An ABORT SHOULD be sent in response that MAY include the error 2947 'Restart of an association with new addresses'. The error SHOULD 2948 list the addresses that were added to the restarting association. 2950 When responding in either state (COOKIE-WAIT or COOKIE-ECHOED) with 2951 an INIT ACK, the original parameters are combined with those from the 2952 newly received INIT chunk. The endpoint shall also generate a State 2953 Cookie with the INIT ACK. The endpoint uses the parameters sent in 2954 its INIT to calculate the State Cookie. 2956 After that, the endpoint MUST NOT change its state, the T1-init timer 2957 shall be left running and the corresponding TCB MUST NOT be 2958 destroyed. The normal procedures for handling State Cookies when a 2959 TCB exists will resolve the duplicate INITs to a single association. 2961 For an endpoint that is in the COOKIE-ECHOED state it MUST populate 2962 its Tie-Tags within both the association TCB and inside the State 2963 Cookie (see Section 5.2.2 for a description of the Tie-Tags). 2965 5.2.2. Unexpected INIT in States Other than CLOSED, COOKIE- 2966 ECHOED,COOKIE-WAIT and SHUTDOWN-ACK-SENT 2968 Unless otherwise stated, upon receipt of an unexpected INIT for this 2969 association, the endpoint shall generate an INIT ACK with a State 2970 Cookie. Before responding, the endpoint MUST check to see if the 2971 unexpected INIT adds new addresses to the association. If new 2972 addresses are added to the association, the endpoint MUST respond 2973 with an ABORT, copying the 'Initiation Tag' of the unexpected INIT 2974 into the 'Verification Tag' of the outbound packet carrying the 2975 ABORT. In the ABORT response, the cause of error MAY be set to 2976 'restart of an association with new addresses'. The error SHOULD 2977 list the addresses that were added to the restarting association. If 2978 no new addresses are added, when responding to the INIT in the 2979 outbound INIT ACK, the endpoint MUST copy its current Tie-Tags to a 2980 reserved place within the State Cookie and the association's TCB. We 2981 shall refer to these locations inside the cookie as the Peer's-Tie- 2982 Tag and the Local-Tie-Tag. We will refer to the copy within an 2983 association's TCB as the Local Tag and Peer's Tag. The outbound SCTP 2984 packet containing this INIT ACK MUST carry a Verification Tag value 2985 equal to the Initiation Tag found in the unexpected INIT. And the 2986 INIT ACK MUST contain a new Initiation Tag (randomly generated; see 2987 Section 5.3.1). Other parameters for the endpoint SHOULD be copied 2988 from the existing parameters of the association (e.g., number of 2989 outbound streams) into the INIT ACK and cookie. 2991 After sending out the INIT ACK or ABORT, the endpoint shall take no 2992 further actions; i.e., the existing association, including its 2993 current state, and the corresponding TCB MUST NOT be changed. 2995 Note: Only when a TCB exists and the association is not in a COOKIE- 2996 WAIT or SHUTDOWN-ACK-SENT state are the Tie-Tags populated with a 2997 value other than 0. For a normal association INIT (i.e., the 2998 endpoint is in the CLOSED state), the Tie-Tags MUST be set to 0 2999 (indicating that no previous TCB existed). 3001 5.2.3. Unexpected INIT ACK 3003 If an INIT ACK is received by an endpoint in any state other than the 3004 COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk. 3005 An unexpected INIT ACK usually indicates the processing of an old or 3006 duplicated INIT chunk. 3008 5.2.4. Handle a COOKIE ECHO when a TCB exists 3010 When a COOKIE ECHO chunk is received by an endpoint in any state for 3011 an existing association (i.e., not in the CLOSED state) the following 3012 rules shall be applied: 3014 1) Compute a MAC as described in Step 1 of Section 5.1.5, 3016 2) Authenticate the State Cookie as described in Step 2 of 3017 Section 5.1.5 (this is case C or D above). 3019 3) Compare the timestamp in the State Cookie to the current time. 3020 If the State Cookie is older than the lifespan carried in the 3021 State Cookie and the Verification Tags contained in the State 3022 Cookie do not match the current association's Verification Tags, 3023 the packet, including the COOKIE ECHO and any DATA chunks, should 3024 be discarded. The endpoint also MUST transmit an ERROR chunk 3025 with a "Stale Cookie" error cause to the peer endpoint (this is 3026 case C or D in Section 5.2). 3028 If both Verification Tags in the State Cookie match the 3029 Verification Tags of the current association, consider the State 3030 Cookie valid (this is case E of section 5.2) even if the lifespan 3031 is exceeded. 3033 4) If the State Cookie proves to be valid, unpack the TCB into a 3034 temporary TCB. 3035 5) Refer to Table 2 to determine the correct action to be taken. 3037 +------------+------------+---------------+--------------+-------------+ 3038 | Local Tag | Peer's Tag | Local-Tie-Tag |Peer's-Tie-Tag| Action/ | 3039 | | | | | Description | 3040 +------------+------------+---------------+--------------+-------------+ 3041 | X | X | M | M | (A) | 3042 +------------+------------+---------------+--------------+-------------+ 3043 | M | X | A | A | (B) | 3044 +------------+------------+---------------+--------------+-------------+ 3045 | M | 0 | A | A | (B) | 3046 +------------+------------+---------------+--------------+-------------+ 3047 | X | M | 0 | 0 | (C) | 3048 +------------+------------+---------------+--------------+-------------+ 3049 | M | M | A | A | (D) | 3050 +======================================================================+ 3051 | Table 2: Handling of a COOKIE ECHO when a TCB exists | 3052 +======================================================================+ 3054 Legend: 3056 X - Tag does not match the existing TCB 3057 M - Tag matches the existing TCB. 3058 0 - No Tie-Tag in Cookie (unknown). 3059 A - All cases, i.e. M, X or 0. 3061 Note: For any case not shown in Table 2, the cookie should be 3062 silently discarded. 3064 Action 3066 A) In this case, the peer may have restarted. When the endpoint 3067 recognizes this potential 'restart', the existing session is 3068 treated the same as if it received an ABORT followed by a new 3069 COOKIE ECHO with the following exceptions: 3071 - Any SCTP DATA Chunks MAY be retained (this is an implementation 3072 specific option). 3074 - A notification of RESTART SHOULD be sent to the ULP instead of 3075 a "COMMUNICATION LOST" notification. 3077 All the congestion control parameters (e.g., cwnd, ssthresh) 3078 related to this peer MUST be reset to their initial values (see 3079 Section 6.2.1). 3081 After this the endpoint shall enter the ESTABLISHED state. 3083 If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes 3084 the peer has restarted (Action A), it MUST NOT setup a new 3085 association but instead resend the SHUTDOWN ACK and send an ERROR 3086 chunk with a "Cookie Received while Shutting Down" error cause to 3087 its peer. 3089 B) In this case, both sides may be attempting to start an association 3090 at about the same time but the peer endpoint started its INIT 3091 after responding to the local endpoint's INIT. Thus it may have 3092 picked a new Verification Tag not being aware of the previous Tag 3093 it had sent this endpoint. The endpoint should stay in or enter 3094 the ESTABLISHED state but it MUST update its peer's Verification 3095 Tag from the State Cookie, stop any init or cookie timers that may 3096 running and send a COOKIE ACK. 3098 C) In this case, the local endpoint's cookie has arrived late. 3099 Before it arrived, the local endpoint sent an INIT and received an 3100 INIT-ACK and finally sent a COOKIE ECHO with the peer's same tag 3101 but a new tag of its own. The cookie should be silently 3102 discarded. The endpoint SHOULD NOT change states and should leave 3103 any timers running. 3105 D) When both local and remote tags match, the endpoint should enter 3106 the ESTABLISHED state, if it is in the COOKIE-ECHOED state. It 3107 should stop any cookie timer that may be running and send a COOKIE 3108 ACK. 3110 Note: The "peer's Verification Tag" is the tag received in the 3111 Initiate Tag field of the INIT or INIT ACK chunk. 3113 5.2.4.1. An Example of a Association Restart 3115 In the following example, "A" initiates the association after a 3116 restart has occurred. Endpoint "Z" had no knowledge of the restart 3117 until the exchange (i.e. Heartbeats had not yet detected the failure 3118 of "A"). (assuming no bundling or fragmentation occurs): 3120 Endpoint A Endpoint Z 3121 <-------------- Association is established----------------------> 3122 Tag=Tag_A Tag=Tag_Z 3123 <---------------------------------------------------------------> 3124 {A crashes and restarts} 3125 {app sets up a association with Z} 3126 (build TCB) 3127 INIT [I-Tag=Tag_A' 3128 & other info] --------\ 3129 (Start T1-init timer) \ 3130 (Enter COOKIE-WAIT state) \---> (find a existing TCB 3131 compose temp TCB and Cookie_Z 3132 with Tie-Tags to previous 3133 association) 3134 /--- INIT ACK [Veri Tag=Tag_A', 3135 / I-Tag=Tag_Z', 3136 (Cancel T1-init timer) <------/ Cookie_Z[TieTags= 3137 Tag_A,Tag_Z 3138 & other info] 3139 (destroy temp TCB,leave original 3140 in place) 3141 COOKIE ECHO [Veri=Tag_Z', 3142 Cookie_Z 3143 Tie=Tag_A, 3144 Tag_Z]----------\ 3145 (Start T1-init timer) \ 3146 (Enter COOKIE-ECHOED state) \---> (Find existing association, 3147 Tie-Tags match old tags, 3148 Tags do not match i.e., 3149 case X X M M above, 3150 Announce Restart to ULP 3151 and reset association). 3152 /---- COOKIE-ACK 3153 (Cancel T1-init timer, <------/ 3154 Enter ESTABLISHED state) 3155 {app sends 1st user data; strm 0} 3156 DATA [TSN=initial TSN_A 3157 Strm=0,Seq=0 & user data]--\ 3158 (Start T3-rtx timer) \ 3159 \-> 3160 /--- SACK [TSN Ack=init TSN_A,Block=0] 3161 (Cancel T3-rtx timer) <------/ 3163 Figure 5: A Restart Example 3165 5.2.5. Handle Duplicate COOKIE-ACK. 3167 At any state other than COOKIE-ECHOED, an endpoint should silently 3168 discard a received COOKIE ACK chunk. 3170 5.2.6. Handle Stale COOKIE Error 3172 Receipt of an ERROR chunk with a "Stale Cookie" error cause indicates 3173 one of a number of possible events: 3175 A) That the association failed to completely setup before the State 3176 Cookie issued by the sender was processed. 3178 B) An old State Cookie was processed after setup completed. 3180 C) An old State Cookie is received from someone that the receiver is 3181 not interested in having an association with and the ABORT chunk 3182 was lost. 3184 When processing an ERROR chunk with a "Stale Cookie" error cause an 3185 endpoint should first examine if an association is in the process of 3186 being setup, i.e. the association is in the COOKIE-ECHOED state. In 3187 all cases if the association is not in the COOKIE-ECHOED state, the 3188 ERROR chunk should be silently discarded. 3190 If the association is in the COOKIE-ECHOED state, the endpoint may 3191 elect one of the following three alternatives. 3193 1) Send a new INIT chunk to the endpoint to generate a new State 3194 Cookie and re-attempt the setup procedure. 3196 2) Discard the TCB and report to the upper layer the inability to 3197 setup the association. 3199 3) Send a new INIT chunk to the endpoint, adding a Cookie 3200 Preservative parameter requesting an extension to the lifetime of 3201 the State Cookie. When calculating the time extension, an 3202 implementation SHOULD use the RTT information measured based on 3203 the previous COOKIE ECHO / ERROR exchange, and should add no more 3204 than 1 second beyond the measured RTT, due to long State Cookie 3205 lifetimes making the endpoint more subject to a replay attack. 3207 5.3. Other Initialization Issues 3209 5.3.1. Selection of Tag Value 3211 Initiate Tag values should be selected from the range of 1 to 2**32 - 3212 1. It is very important that the Initiate Tag value be randomized to 3213 help protect against "man in the middle" and "sequence number" 3214 attacks. The methods described in [RFC4086] can be used for the 3215 Initiate Tag randomization. Careful selection of Initiate Tags is 3216 also necessary to prevent old duplicate packets from previous 3217 associations being mistakenly processed as belonging to the current 3218 association. 3220 Moreover, the Verification Tag value used by either endpoint in a 3221 given association MUST NOT change during the lifetime of an 3222 association. A new Verification Tag value MUST be used each time the 3223 endpoint tears-down and then re-establishes an association to the 3224 same peer. 3226 5.4. Path Verification 3228 During association establishment, the two peers exchange a list of 3229 addresses. In the predominant case, these lists accurately represent 3230 the addresses owned by each peer. However, it is possible that a 3231 misbehaving peer may supply addresses that it does not own. To 3232 prevent this, the following rules are applied to all addresses of the 3233 new association: 3234 1) Any address passed to the sender of the INIT by its upper layer 3235 is automatically considered to be CONFIRMED. 3236 2) For the receiver of the COOKIE-ECHO the only CONFIRMED address is 3237 the one that the INIT-ACK was sent to. 3238 3) All other addresses not covered by rules 1 and 2 are considered 3239 UNCONFIRMED and are subject to probing for verification. 3241 To probe an address for verification, an endpoint will send 3242 HEARTBEATs including a 64-bit random nonce and a path indicator (to 3243 identify the address that the HEARTBEAT is sent to) within the 3244 HEARTBEAT parameter. 3246 Upon receipt of the HEARTBEAT-ACK, a verification is made that the 3247 nonce included in the HEARTBEAT parameter is the one sent to the 3248 address indicated inside the HEARTBEAT parameter. When this match 3249 occurs, the address that the original HEARTBEAT was sent to is now 3250 considered CONFIRMED and available for normal data transfer. 3252 These probing procedures are started when an association moves to the 3253 ESTABLISHED state and are ended when all paths are confirmed. 3255 Each RTO a probe may be sent on an active UNCONFIRMED path in an 3256 attempt to move it to the CONFIRMED state. If during this probing 3257 the path becomes inactive, this rate is lowered to the normal 3258 HEARTBEAT rate. At the expiration of the RTO timer, the error 3259 counter of any path that was probed but not CONFIRMED is incremented 3260 by one and subjected to path failure detection, as defined in 3261 Section 8.2. When probing UNCONFIRMED addresses, however, the 3262 association overall error count is NOT incremented. 3264 The number of HEARTBEATS sent at each RTO SHOULD be limited by the 3265 HB.Max.Burst parameter. It is an implementation decision as to how 3266 to distribute HEARTBEATS to the peer's addresses for path 3267 verification. 3269 Whenever a path is confirmed, an indication MAY be given to the upper 3270 layer. 3272 An endpoint MUST NOT send any chunks to an UNCONFIRMED address, with 3273 the following exceptions: 3274 - A HEARTBEAT including a nonce MAY be sent to an UNCONFIRMED 3275 address. 3276 - A HEARTBEAT-ACK MAY be sent to an UNCONFIRMED address. 3277 - A COOKIE-ACK MAY be sent to an UNCONFIRMED address, but it MUST be 3278 bundled with a HEARTBEAT including a nonce. An implementation 3279 that does NOT support bundling MUST NOT send a COOKIE-ACK to an 3280 UNCONFIRMED address. 3281 - A COOKE-ECHO MAY be sent to an UNCONFIRMED address, but it MUST be 3282 bundled with a HEARTBEAT including a nonce, and the packet MUST 3283 NOT exceed the path MTU. If the implementation does NOT support 3284 bundling or if the bundled COOKIE-ECHO plus HEARTBEAT (including 3285 nonce) would exceed the path MTU, then the implementation MUST NOT 3286 send a COOKIE-ECHO to an UNCONFIRMED address. 3288 6. User Data Transfer 3290 Data transmission MUST only happen in the ESTABLISHED, SHUTDOWN- 3291 PENDING, and SHUTDOWN-RECEIVED states. The only exception to this is 3292 that DATA chunks are allowed to be bundled with an outbound COOKIE 3293 ECHO chunk when in COOKIE-WAIT state. 3295 DATA chunks MUST only be received according to the rules below in 3296 ESTABLISHED, SHUTDOWN-PENDING, SHUTDOWN-SENT. A DATA chunk received 3297 in CLOSED is out of the blue and SHOULD be handled per 8.4. A DATA 3298 chunk received in any other state SHOULD be discarded. 3300 A SACK MUST be processed in ESTABLISHED, SHUTDOWN-PENDING, and 3301 SHUTDOWN-RECEIVED. An incoming SACK MAY be processed in COOKIE- 3302 ECHOED. A SACK in the CLOSED state is out of the blue and SHOULD be 3303 processed according to the rules in 8.4. A SACK chunk received in 3304 any other state SHOULD be discarded. 3306 A SCTP receiver MUST be able to receive a minimum of 1500 bytes in 3307 one SCTP packet. This means that a SCTP endpoint MUST NOT indicate 3308 less than 1500 bytes in its Initial a_rwnd sent in the INIT or INIT 3309 ACK. 3311 For transmission efficiency, SCTP defines mechanisms for bundling of 3312 small user messages and fragmentation of large user messages. The 3313 following diagram depicts the flow of user messages through SCTP. 3315 In this section the term "data sender" refers to the endpoint that 3316 transmits a DATA chunk and the term "data receiver" refers to the 3317 endpoint that receives a DATA chunk. A data receiver will transmit 3318 SACK chunks. 3320 +--------------------------+ 3321 | User Messages | 3322 +--------------------------+ 3323 SCTP user ^ | 3324 ==================|==|======================================= 3325 | v (1) 3326 +------------------+ +--------------------+ 3327 | SCTP DATA Chunks | |SCTP Control Chunks | 3328 +------------------+ +--------------------+ 3329 ^ | ^ | 3330 | v (2) | v (2) 3331 +--------------------------+ 3332 | SCTP packets | 3333 +--------------------------+ 3334 SCTP ^ | 3335 ===========================|==|=========================== 3336 | v 3337 Connectionless Packet Transfer Service (e.g., IP) 3339 Notes: 3341 1) When converting user messages into DATA chunks, an endpoint 3342 will fragment user messages larger than the current association 3343 path MTU into multiple DATA chunks. The data receiver will 3344 normally reassemble the fragmented message from DATA chunks 3345 before delivery to the user (see Section 6.9 for details). 3347 2) Multiple DATA and control chunks may be bundled by the sender 3348 into a single SCTP packet for transmission, as long as the 3349 final size of the packet does not exceed the current path MTU. 3350 The receiver will unbundle the packet back into the original 3351 chunks. Control chunks MUST come before DATA chunks in the 3352 packet. 3354 Figure 6: Illustration of User Data Transfer 3356 The fragmentation and bundling mechanisms, as detailed in Section 6.9 3357 and Section 6.10, are OPTIONAL to implement by the data sender, but 3358 they MUST be implemented by the data receiver, i.e., an endpoint MUST 3359 properly receive and process bundled or fragmented data. 3361 6.1. Transmission of DATA Chunks 3363 This document is specified as if there is a single retransmission 3364 timer per destination transport address, but implementations MAY have 3365 a retransmission timer for each DATA chunk. 3367 The following general rules MUST be applied by the data sender for 3368 transmission and/or retransmission of outbound DATA chunks: 3370 A) At any given time, the data sender MUST NOT transmit new data to 3371 any destination transport address if its peer's rwnd indicates 3372 that the peer has no buffer space (i.e., rwnd is 0; see 3373 Section 6.2.1). However, regardless of the value of rwnd 3374 (including if it is 0), the data sender can always have one DATA 3375 chunk in flight to the receiver if allowed by cwnd (see rule B, 3376 below). This rule allows the sender to probe for a change in rwnd 3377 that the sender missed due to the SACK's having been lost in 3378 transit from the data receiver to the data sender. 3380 When the receiver's advertised window is zero, this probe is 3381 called a zero window probe. Note that a zero window probe SHOULD 3382 only be sent when all outstanding DATA chunks have been 3383 cumulatively acknowledged and no DATA chunks are in flight. Zero 3384 window probing MUST be supported. 3386 If the sender continues to receive new packets from the receiver 3387 while doing zero window probing, the unacknowledged window probes 3388 should not increment the error counter for the association or any 3389 destination transport address. This is because the receiver MAY 3390 keep its window closed for an indefinite time. Refer to 3391 Section 6.2 on the receiver behavior when it advertises a zero 3392 window. The sender SHOULD send the first zero window probe after 3393 1 RTO when it detects that the receiver has closed its window and 3394 SHOULD increase the probe interval exponentially afterwards. Also 3395 note that the cwnd SHOULD be adjusted according to Section 7.2.1. 3396 Zero window probing does not affect the calculation of cwnd. 3398 The sender MUST also have an algorithm for sending new DATA chunks 3399 to avoid silly window syndrome (SWS) as described in [RFC0813]. 3400 The algorithm can be similar to the one described in Section 3401 4.2.3.4 of [RFC1122]. 3403 that the peer has no buffer space (i.e. rwnd is 0, see ). 3405 However, regardless of the value of rwnd (including if it is 0), 3406 the data sender can always have one DATA chunk in flight to the 3407 receiver if allowed by cwnd (see rule B below). This rule allows 3408 the sender to probe for a change in rwnd that the sender missed 3409 due to the SACK having been lost in transit from the data receiver 3410 to the data sender. 3412 B) At any given time, the sender MUST NOT transmit new data to a 3413 given transport address if it has cwnd or more bytes of data 3414 outstanding to that transport address. 3416 C) When the time comes for the sender to transmit, before sending new 3417 DATA chunks, the sender MUST first transmit any outstanding DATA 3418 chunks which are marked for retransmission (limited by the current 3419 cwnd). 3421 D) When the time comes for the sender to transmit new DATA chunks, 3422 the protocol parameter Max.Burst SHOULD be used to limit the 3423 number of packets sent. The limit MAY be applied by adjusting 3424 cwnd as follows: 3426 if((flightsize + Max.Burst*MTU) < cwnd) cwnd = flightsize + 3427 Max.Burst*MTU 3429 Or it MAY be applied by strictly limiting the number of packets 3430 emitted by the output routine. 3432 E) Then, the sender can send out as many new DATA chunks as Rule A 3433 and Rule B allow. 3435 Multiple DATA chunks committed for transmission MAY be bundled in a 3436 single packet. Furthermore, DATA chunks being retransmitted MAY be 3437 bundled with new DATA chunks, as long as the resulting packet size 3438 does not exceed the path MTU. A ULP may request that no bundling is 3439 performed but this should only turn off any delays that a SCTP 3440 implementation may be using to increase bundling efficiency. It does 3441 not in itself stop all bundling from occurring (i.e. in case of 3442 congestion or retransmission). 3444 Before an endpoint transmits a DATA chunk, if any received DATA 3445 chunks have not been acknowledged (e.g., due to delayed ack), the 3446 sender should create a SACK and bundle it with the outbound DATA 3447 chunk, as long as the size of the final SCTP packet does not exceed 3448 the current MTU. See Section 6.2. 3450 IMPLEMENTATION NOTE: When the window is full (i.e., transmission is 3451 disallowed by Rule A and/or Rule B), the sender MAY still accept send 3452 requests from its upper layer, but MUST transmit no more DATA chunks 3453 until some or all of the outstanding DATA chunks are acknowledged and 3454 transmission is allowed by Rule A and Rule B again. 3456 Whenever a transmission or retransmission is made to any address, if 3457 the T3-rtx timer of that address is not currently running, the sender 3458 MUST start that timer. If the timer for that address is already 3459 running, the sender MUST restart the timer if the earliest (i.e., 3460 lowest TSN) outstanding DATA chunk sent to that address is being 3461 retransmitted. Otherwise, the data sender MUST NOT restart the 3462 timer. 3464 When starting or restarting the T3-rtx timer, the timer value must be 3465 adjusted according to the timer rules defined in Section 6.3.2, and 3466 Section 6.3.3. 3468 Note: The data sender SHOULD NOT use a TSN that is more than 2**31 - 3469 1 above the beginning TSN of the current send window. 3471 6.2. Acknowledgement on Reception of DATA Chunks 3473 The SCTP endpoint MUST always acknowledge the reception of each valid 3474 DATA chunk when the DATA chunk received is inside its receive window. 3476 When the receiver's advertised window is 0, the receiver MUST drop 3477 any new incoming DATA chunk with a TSN larger than the largest TSN 3478 received so far. If the new incoming DATA chunk holds a TSN value 3479 less than the largest TSN received so far, then the receiver SHOULD 3480 drop the largest TSN held for reordering and accept the new incoming 3481 DATA chunk. In either case, if such a DATA chunk is dropped, the 3482 receiver MUST immediately send back a SACK with the current receive 3483 window showing only DATA chunks received and accepted so far. The 3484 dropped DATA chunk(s) MUST NOT be included in the SACK, as they were 3485 not accepted. The receiver MUST also have an algorithm for 3486 advertising its receive window to avoid receiver silly window 3487 syndrome (SWS), as described in [RFC0813]. The algorithm can be 3488 similar to the one described in Section 4.2.3.3 of [RFC1122]. 3490 The guidelines on delayed acknowledgement algorithm specified in 3491 Section 4.2 of [RFC2581] SHOULD be followed. Specifically, an 3492 acknowledgement SHOULD be generated for at least every second packet 3493 (not every second DATA chunk) received, and SHOULD be generated 3494 within 200 ms of the arrival of any unacknowledged DATA chunk. In 3495 some situations it may be beneficial for an SCTP transmitter to be 3496 more conservative than the algorithms detailed in this document 3497 allow. However, an SCTP transmitter MUST NOT be more aggressive than 3498 the following algorithms allow. 3500 A SCTP receiver MUST NOT generate more than one SACK for every 3501 incoming packet, other than to update the offered window as the 3502 receiving application consumes new data. 3504 IMPLEMENTATION NOTE: The maximum delay for generating an 3505 acknowledgement may be configured by the SCTP administrator, either 3506 statically or dynamically, in order to meet the specific timing 3507 requirement of the protocol being carried. 3509 An implementation MUST NOT allow the maximum delay to be configured 3510 to be more than 500 ms. In other words an implementation MAY lower 3511 this value below 500ms but MUST NOT raise it above 500ms. 3513 Acknowledgments MUST be sent in SACK chunks unless shutdown was 3514 requested by the ULP, in which case an endpoint MAY send an 3515 acknowledgement in the SHUTDOWN chunk. A SACK chunk can acknowledge 3516 the reception of multiple DATA chunks. See Section 3.3.4 for SACK 3517 chunk format. In particular, the SCTP endpoint MUST fill in the 3518 Cumulative TSN Ack field to indicate the latest sequential TSN (of a 3519 valid DATA chunk) it has received. Any received DATA chunks with TSN 3520 greater than the value in the Cumulative TSN Ack field are reported 3521 in the Gap Ack Block fields. The SCTP endpoint MUST report as many 3522 Gap Ack Blocks as can fit in a single SACK chunk limited by the 3523 current path MTU. 3525 Note: The SHUTDOWN chunk does not contain Gap Ack Block fields. 3526 Therefore, the endpoint should use a SACK instead of the SHUTDOWN 3527 chunk to acknowledge DATA chunks received out of order . 3529 When a packet arrives with duplicate DATA chunk(s) and with no new 3530 DATA chunk(s), the endpoint MUST immediately send a SACK with no 3531 delay. If a packet arrives with duplicate DATA chunk(s) bundled with 3532 new DATA chunks, the endpoint MAY immediately send a SACK. Normally 3533 receipt of duplicate DATA chunks will occur when the original SACK 3534 chunk was lost and the peer's RTO has expired. The duplicate TSN 3535 number(s) SHOULD be reported in the SACK as duplicate. 3537 When an endpoint receives a SACK, it MAY use the Duplicate TSN 3538 information to determine if SACK loss is occurring. Further use of 3539 this data is for future study. 3541 The data receiver is responsible for maintaining its receive buffers. 3542 The data receiver SHOULD notify the data sender in a timely manner of 3543 changes in its ability to receive data. How an implementation 3544 manages its receive buffers is dependent on many factors (e.g., 3545 Operating System, memory management system, amount of memory, etc.). 3546 However, the data sender strategy defined in Section 6.2.1 is based 3547 on the assumption of receiver operation similar to the following: 3549 A) At initialization of the association, the endpoint tells the peer 3550 how much receive buffer space it has allocated to the association 3551 in the INIT or INIT ACK. The endpoint sets a_rwnd to this value. 3553 B) As DATA chunks are received and buffered, decrement a_rwnd by the 3554 number of bytes received and buffered. This is, in effect, 3555 closing rwnd at the data sender and restricting the amount of data 3556 it can transmit. 3558 C) As DATA chunks are delivered to the ULP and released from the 3559 receive buffers, increment a_rwnd by the number of bytes delivered 3560 to the upper layer. This is, in effect, opening up rwnd on the 3561 data sender and allowing it to send more data. The data receiver 3562 SHOULD NOT increment a_rwnd unless it has released bytes from its 3563 receive buffer. For example, if the receiver is holding 3564 fragmented DATA chunks in a reassembly queue, it should not 3565 increment a_rwnd. 3567 D) When sending a SACK, the data receiver SHOULD place the current 3568 value of a_rwnd into the a_rwnd field. The data receiver SHOULD 3569 take into account that the data sender will not retransmit DATA 3570 chunks that are acked via the Cumulative TSN Ack (i.e., will drop 3571 from its retransmit queue). 3573 Under certain circumstances, the data receiver may need to drop DATA 3574 chunks that it has received but hasn't released from its receive 3575 buffers (i.e., delivered to the ULP). These DATA chunks may have 3576 been acked in Gap Ack Blocks. For example, the data receiver may be 3577 holding data in its receive buffers while reassembling a fragmented 3578 user message from its peer when it runs out of receive buffer space. 3579 It may drop these DATA chunks even though it has acknowledged them in 3580 Gap Ack Blocks. If a data receiver drops DATA chunks, it MUST NOT 3581 include them in Gap Ack Blocks in subsequent SACKs until they are 3582 received again via retransmission. In addition, the endpoint should 3583 take into account the dropped data when calculating its a_rwnd. 3585 An endpoint SHOULD NOT revoke a SACK and discard data. Only in 3586 extreme circumstance should an endpoint use this procedure (such as 3587 out of buffer space). The data receiver should take into account 3588 that dropping data that has been acked in Gap Ack Blocks can result 3589 in suboptimal retransmission strategies in the data sender and thus 3590 in suboptimal performance. 3592 The following example illustrates the use of delayed 3593 acknowledgements: 3595 Endpoint A Endpoint Z 3597 {App sends 3 messages; strm 0} 3598 DATA [TSN=7,Strm=0,Seq=3] ------------> (ack delayed) 3599 (Start T3-rtx timer) 3601 DATA [TSN=8,Strm=0,Seq=4] ------------> (send ack) 3602 /------- SACK [TSN Ack=8,block=0] 3603 (cancel T3-rtx timer) <-----/ 3605 DATA [TSN=9,Strm=0,Seq=5] ------------> (ack delayed) 3606 (Start T3-rtx timer) 3607 ... 3608 {App sends 1 message; strm 1} 3609 (bundle SACK with DATA) 3610 /----- SACK [TSN Ack=9,block=0] \ 3611 / DATA [TSN=6,Strm=1,Seq=2] 3612 (cancel T3-rtx timer) <------/ (Start T3-rtx timer) 3614 (ack delayed) 3615 (send ack) 3616 SACK [TSN Ack=6,block=0] -------------> (cancel T3-rtx timer) 3618 Figure 7: Delayed Acknowledgment Example 3620 If an endpoint receives a DATA chunk with no user data (i.e., the 3621 Length field is set to 16) it MUST send an ABORT with error cause set 3622 to "No User Data". 3624 An endpoint SHOULD NOT send a DATA chunk with no user data part. 3626 6.2.1. Processing a Received SACK 3628 Each SACK an endpoint receives contains an a_rwnd value. This value 3629 represents the amount of buffer space the data receiver, at the time 3630 of transmitting the SACK, has left of its total receive buffer space 3631 (as specified in the INIT/INIT ACK). Using a_rwnd, Cumulative TSN 3632 Ack and Gap Ack Blocks, the data sender can develop a representation 3633 of the peer's receive buffer space. 3635 One of the problems the data sender must take into account when 3636 processing a SACK is that a SACK can be received out of order. That 3637 is, a SACK sent by the data receiver can pass an earlier SACK and be 3638 received first by the data sender. If a SACK is received out of 3639 order, the data sender can develop an incorrect view of the peer's 3640 receive buffer space. 3642 Since there is no explicit identifier that can be used to detect out- 3643 of-order SACKs, the data sender must use heuristics to determine if a 3644 SACK is new. 3646 An endpoint SHOULD use the following rules to calculate the rwnd, 3647 using the a_rwnd value, the Cumulative TSN Ack and Gap Ack Blocks in 3648 a received SACK. 3650 A) At the establishment of the association, the endpoint initializes 3651 the rwnd to the Advertised Receiver Window Credit (a_rwnd) the 3652 peer specified in the INIT or INIT ACK. 3654 B) Any time a DATA chunk is transmitted (or retransmitted) to a peer, 3655 the endpoint subtracts the data size of the chunk from the rwnd of 3656 that peer. 3658 C) Any time a DATA chunk is marked for retransmission (via either T3- 3659 rtx timer expiration (Section 6.3.3) or via fast retransmit 3660 (Section 7.2.4), add the data size of those chunks to the rwnd. 3662 Note: If the implementation is maintaining a timer on each DATA 3663 chunk then only DATA chunks whose timer expired would be marked 3664 for retransmission. 3666 D) Any time a SACK arrives, the endpoint performs the following: 3667 i) If Cumulative TSN Ack is less than the Cumulative TSN Ack 3668 Point, then drop the SACK. Since Cumulative TSN Ack is 3669 monotonically increasing, a SACK whose Cumulative TSN Ack is 3670 less than the Cumulative TSN Ack Point indicates an out-of- 3671 order SACK. 3673 ii) Set rwnd equal to the newly received a_rwnd minus the number 3674 of bytes still outstanding after processing the Cumulative TSN 3675 Ack and the Gap Ack Blocks. 3677 iii) If the SACK is missing a TSN that was previously 3678 acknowledged via a Gap Ack Block (e.g., the data receiver 3679 reneged on the data), then consider the corresponding DATA that 3680 might be possibly missing: Count one miss indication towards 3681 fast retransmit as described in Section 7.2.4 , and if no 3682 retransmit timer is running for the destination address to 3683 which the DATA chunk was originally transmitted, then T3-rtx is 3684 started for that destination address. 3685 iv) If the Cumulative TSN Ack matches or exceeds the Fast 3686 Recovery exitpoint (Section 7.2.4), Fast Recovery is exited. 3688 6.3. Management of Retransmission Timer 3690 An SCTP endpoint uses a retransmission timer T3-rtx to ensure data 3691 delivery in the absence of any feedback from its peer. The duration 3692 of this timer is referred to as RTO (retransmission timeout). 3694 When an endpoint's peer is multi-homed, the endpoint will calculate a 3695 separate RTO for each different destination transport address of its 3696 peer endpoint. 3698 The computation and management of RTO in SCTP follows closely how TCP 3699 manages its retransmission timer. To compute the current RTO, an 3700 endpoint maintains two state variables per destination transport 3701 address: SRTT (smoothed round-trip time) and RTTVAR (round-trip time 3702 variation). 3704 6.3.1. RTO Calculation 3706 The rules governing the computation of SRTT, RTTVAR, and RTO are as 3707 follows: 3709 C1) Until an RTT measurement has been made for a packet sent to the 3710 given destination transport address, set RTO to the protocol 3711 parameter 'RTO.Initial'. 3713 C2) When the first RTT measurement R is made, set 3715 SRTT <- R, 3717 RTTVAR <- R/2, and 3719 RTO <- SRTT + 4 * RTTVAR. 3721 C3) When a new RTT measurement R' is made, set 3723 RTTVAR <- (1 - RTO.Beta) * RTTVAR + RTO.Beta * |SRTT - R'| 3725 and 3727 SRTT <- (1 - RTO.Alpha) * SRTT + RTO.Alpha * R' 3729 Note: The value of SRTT used in the update to RTTVAR is its 3730 value before updating SRTT itself using the second assignment. 3732 After the computation, update RTO <- SRTT + 4 * RTTVAR. 3734 C4) When data is in flight and when allowed by rule C5 below, a new 3735 RTT measurement MUST be made each round trip. Furthermore, new 3736 RTT measurements SHOULD be made no more than once per round-trip 3737 for a given destination transport address. There are two 3738 reasons for this recommendation: First, it appears that 3739 measuring more frequently often does not in practice yield any 3740 significant benefit [ALLMAN99]; second, if measurements are made 3741 more often, then the values of RTO.Alpha and RTO.Beta in rule C3 3742 above should be adjusted so that SRTT and RTTVAR still adjust to 3743 changes at roughly the same rate (in terms of how many round 3744 trips it takes them to reflect new values) as they would if 3745 making only one measurement per round-trip and using RTO.Alpha 3746 and RTO.Beta as given in rule C3. However, the exact nature of 3747 these adjustments remains a research issue. 3749 C5) Karn's algorithm: RTT measurements MUST NOT be made using 3750 packets that were retransmitted (and thus for which it is 3751 ambiguous whether the reply was for the first instance of the 3752 the chunk or for a later instance) 3754 IMPLEMENTATION NOTE: RTT measurements should only be made using 3755 a chunk with TSN r if no chunk with TSN less than or equal to r 3756 is retransmitted since r is first sent. 3758 C6) Whenever RTO is computed, if it is less than RTO.Min seconds 3759 then it is rounded up to RTO.Min seconds. The reason for this 3760 rule is that RTOs that do not have a high minimum value are 3761 susceptible to unnecessary timeouts [ALLMAN99]. 3763 C7) A maximum value may be placed on RTO provided it is at least 3764 RTO.max seconds. 3766 There is no requirement for the clock granularity G used for 3767 computing RTT measurements and the different state variables, other 3768 than: 3770 G1) Whenever RTTVAR is computed, if RTTVAR = 0, then adjust RTTVAR <- 3771 G. 3773 Experience [ALLMAN99] has shown that finer clock granularities (<= 3774 100 msec) perform somewhat better than more coarse granularities. 3776 6.3.2. Retransmission Timer Rules 3778 The rules for managing the retransmission timer are as follows: 3780 R1) Every time a DATA chunk is sent to any address (including a 3781 retransmission), if the T3-rtx timer of that address is not 3782 running, start it running so that it will expire after the RTO 3783 of that address. The RTO used here is that obtained after any 3784 doubling due to previous T3-rtx timer expirations on the 3785 corresponding destination address as discussed in rule E2 below. 3787 R2) Whenever all outstanding data sent to an address have been 3788 acknowledged, turn off the T3-rtx timer of that address. 3790 R3) Whenever a SACK is received that acknowledges the DATA chunk 3791 with the earliest outstanding TSN for that address, restart T3- 3792 rtx timer for that address with its current RTO (if there is 3793 still outstanding data on that address). 3795 R4) Whenever a SACK is received missing a TSN that was previously 3796 acknowledged via a Gap Ack Block, start T3-rtx for the 3797 destination address to which the DATA chunk was originally 3798 transmitted if it is not already running. 3800 The following example shows the use of various timer rules (assuming 3801 the receiver uses delayed acks). 3803 Endpoint A Endpoint Z 3804 {App begins to send} 3805 Data [TSN=7,Strm=0,Seq=3] ------------> (ack delayed) 3806 (Start T3-rtx timer) 3807 {App sends 1 message; strm 1} 3808 (bundle ack with data) 3809 DATA [TSN=8,Strm=0,Seq=4] ----\ /-- SACK [TSN Ack=7,Block=0] 3810 \ / DATA [TSN=6,Strm=1,Seq=2] 3811 \ / (Start T3-rtx timer) 3812 \ 3813 / \ 3814 (Re-start T3-rtx timer) <------/ \--> (ack delayed) 3815 (ack delayed) 3816 {send ack} 3817 SACK [TSN Ack=6,Block=0] --------------> (Cancel T3-rtx timer) 3818 .. 3819 (send ack) 3820 (Cancel T3-rtx timer) <-------------- SACK [TSN Ack=8,Block=0] 3822 Figure 8 - Timer Rule Examples 3824 6.3.3. Handle T3-rtx Expiration 3826 Whenever the retransmission timer T3-rtx expires for a destination 3827 address, do the following: 3829 E1) For the destination address for which the timer expires, adjust 3830 its ssthresh with rules defined in Section 7.2.3 and set the 3831 cwnd <- MTU. 3833 E2) For the destination address for which the timer expires, set RTO 3834 <- RTO * 2 ("back off the timer"). The maximum value discussed 3835 in rule C7 above (RTO.max) may be used to provide an upper bound 3836 to this doubling operation. 3838 E3) Determine how many of the earliest (i.e., lowest TSN) 3839 outstanding DATA chunks for the address for which the T3-rtx has 3840 expired will fit into a single packet, subject to the MTU 3841 constraint for the path corresponding to the destination 3842 transport address to which the retransmission is being sent 3843 (this may be different from the address for which the timer 3844 expires [see Section 6.4]). Call this value K. Bundle and 3845 retransmit those K DATA chunks in a single packet to the 3846 destination endpoint. 3848 E4) Start the retransmission timer T3-rtx on the destination address 3849 to which the retransmission is sent, if rule R1 above indicates 3850 to do so. The RTO to be used for starting T3-rtx should be the 3851 one for the destination address to which the retransmission is 3852 sent, which, when the receiver is multi-homed, may be different 3853 from the destination address for which the timer expired (see 3854 Section 6.4 below). 3856 After retransmitting, once a new RTT measurement is obtained (which 3857 can happen only when new data has been sent and acknowledged, per 3858 rule C5, or for a measurement made from a HEARTBEAT [see Section 8.3 3859 ), the computation in rule C3 is performed, including the computation 3860 of RTO, which may result in "collapsing" RTO back down after it has 3861 been subject to doubling (rule E2). 3863 Note: Any DATA chunks that were sent to the address for which the T3- 3864 rtx timer expired but did not fit in one MTU (rule E3 above), should 3865 be marked for retransmission and sent as soon as cwnd allows 3866 (normally when a SACK arrives). 3868 The final rule for managing the retransmission timer concerns 3869 failover (see Section 6.4.1): 3871 F1) Whenever an endpoint switches from the current destination 3872 transport address to a different one, the current retransmission 3873 timers are left running. As soon as the endpoint transmits a 3874 packet containing DATA chunk(s) to the new transport address, 3875 start the timer on that transport address, using the RTO value 3876 of the destination address to which the data is being sent, if 3877 rule R1 indicates to do so. 3879 6.4. Multi-homed SCTP Endpoints 3881 An SCTP endpoint is considered multi-homed if there are more than one 3882 transport address that can be used as a destination address to reach 3883 that endpoint. 3885 Moreover, the ULP of an endpoint shall select one of the multiple 3886 destination addresses of a multi-homed peer endpoint as the primary 3887 path (see Section 5.1.2 and Section 10.1 for details). 3889 By default, an endpoint SHOULD always transmit to the primary path, 3890 unless the SCTP user explicitly specifies the destination transport 3891 address (and possibly source transport address) to use. 3893 An endpoint SHOULD transmit reply chunks (e.g., SACK, HEARTBEAT ACK, 3894 etc.) to the same destination transport address from which it 3895 received the DATA or control chunk to which it is replying. This 3896 rule should also be followed if the endpoint is bundling DATA chunks 3897 together with the reply chunk. 3899 However, when acknowledging multiple DATA chunks received in packets 3900 from different source addresses in a single SACK, the SACK chunk may 3901 be transmitted to one of the destination transport addresses from 3902 which the DATA or control chunks being acknowledged were received. 3904 When a receiver of a duplicate DATA chunk sends a SACK to a multi- 3905 homed endpoint it MAY be beneficial to vary the destination address 3906 and not use the source address of the DATA chunk. The reason being 3907 that receiving a duplicate from a multi-homed endpoint might indicate 3908 that the return path (as specified in the source address of the DATA 3909 chunk) for the SACK is broken. 3911 Furthermore, when its peer is multi-homed, an endpoint SHOULD try to 3912 retransmit a chunk that timed out to an active destination transport 3913 address that is different from the last destination address to which 3914 the DATA chunk was sent. 3916 Retransmissions do not affect the total outstanding data count. 3917 However, if the DATA chunk is retransmitted onto a different 3918 destination address, both the outstanding data counts on the new 3919 destination address and the old destination address to which the data 3920 chunk was last sent shall be adjusted accordingly. 3922 6.4.1. Failover from Inactive Destination Address 3924 Some of the transport addresses of a multi-homed SCTP endpoint may 3925 become inactive due to either the occurrence of certain error 3926 conditions (see Section 8.2) or adjustments from SCTP user. 3928 When there is outbound data to send and the primary path becomes 3929 inactive (e.g., due to failures), or where the SCTP user explicitly 3930 requests to send data to an inactive destination transport address, 3931 before reporting an error to its ULP, the SCTP endpoint should try to 3932 send the data to an alternate active destination transport address if 3933 one exists. 3935 When retransmitting data that timed out, if the endpoint is multi- 3936 homed, it should consider each source-destination address pair in its 3937 retransmission selection policy. When retransmitting timed out data, 3938 the endpoint should attempt to pick the most divergent source- 3939 destination pair from the original source-destination pair to which 3940 the packet was transmitted. 3942 Note: Rules for picking the most divergent source-destination pair 3943 are an implementation decision and is not specified within this 3944 document. 3946 6.5. Stream Identifier and Stream Sequence Number 3948 Every DATA chunk MUST carry a valid stream identifier. If an 3949 endpoint receives a DATA chunk with an invalid stream identifier, it 3950 shall acknowledge the reception of the DATA chunk following the 3951 normal procedure, immediately send an ERROR chunk with cause set to 3952 "Invalid Stream Identifier" (see Section 3.3.10) and discard the DATA 3953 chunk. The endpoint may bundle the ERROR chunk in the same packet as 3954 the SACK as long as the ERROR follows the SACK. 3956 The stream sequence number in all the streams MUST start from 0 when 3957 the association is established. Also, when the stream sequence 3958 number reaches the value 65535 the next stream sequence number MUST 3959 be set to 0. 3961 6.6. Ordered and Unordered Delivery 3963 Within a stream, an endpoint MUST deliver DATA chunks received with 3964 the U flag set to 0 to the upper layer according to the order of 3965 their stream sequence number. If DATA chunks arrive out of order of 3966 their stream sequence number, the endpoint MUST hold the received 3967 DATA chunks from delivery to the ULP until they are re-ordered. 3969 However, an SCTP endpoint can indicate that no ordered delivery is 3970 required for a particular DATA chunk transmitted within the stream by 3971 setting the U flag of the DATA chunk to 1. 3973 When an endpoint receives a DATA chunk with the U flag set to 1, it 3974 must bypass the ordering mechanism and immediately deliver the data 3975 to the upper layer (after re-assembly if the user data is fragmented 3976 by the data sender). 3978 This provides an effective way of transmitting "out-of-band" data in 3979 a given stream. Also, a stream can be used as an "unordered" stream 3980 by simply setting the U flag to 1 in all DATA chunks sent through 3981 that stream. 3983 IMPLEMENTATION NOTE: When sending an unordered DATA chunk, an 3984 implementation may choose to place the DATA chunk in an outbound 3985 packet that is at the head of the outbound transmission queue if 3986 possible. 3988 The 'Stream Sequence Number' field in a DATA chunk with U flag set to 3989 1 has no significance. The sender can fill it with arbitrary value, 3990 but the receiver MUST ignore the field. 3992 Note: When transmitting ordered and unordered data, an endpoint does 3993 not increment its Stream Sequence Number when transmitting a DATA 3994 chunk with U flag set to 1. 3996 6.7. Report Gaps in Received DATA TSNs 3998 Upon the reception of a new DATA chunk, an endpoint shall examine the 3999 continuity of the TSNs received. If the endpoint detects a gap in 4000 the received DATA chunk sequence, it SHOULD send a SACK with Gap Ack 4001 Blocks immediately. The data receiver continues sending a SACK after 4002 receipt of each SCTP packet that doesn't fill the gap. 4004 Based on the Gap Ack Block from the received SACK, the endpoint can 4005 calculate the missing DATA chunks and make decisions on whether to 4006 retransmit them (see Section 6.2.1 for details). 4008 Multiple gaps can be reported in one single SACK (see Section 3.3.4). 4010 When its peer is multi-homed, the SCTP endpoint SHOULD always try to 4011 send the SACK to the same destination address from which the last 4012 DATA chunk was received. 4014 Upon the reception of a SACK, the endpoint MUST remove all DATA 4015 chunks which have been acknowledged by the SACK's Cumulative TSN Ack 4016 from its transmit queue. The endpoint MUST also treat all the DATA 4017 chunks with TSNs not included in the Gap Ack Blocks reported by the 4018 SACK as "missing". The number of "missing" reports for each 4019 outstanding DATA chunk MUST be recorded by the data sender in order 4020 to make retransmission decisions. See Section 7.2.4 for details. 4022 The following example shows the use of SACK to report a gap. 4024 Endpoint A Endpoint Z 4025 {App sends 3 messages; strm 0} 4026 DATA [TSN=6,Strm=0,Seq=2] ---------------> (ack delayed) 4027 (Start T3-rtx timer) 4029 DATA [TSN=7,Strm=0,Seq=3] --------> X (lost) 4031 DATA [TSN=8,Strm=0,Seq=4] ---------------> (gap detected, 4032 immediately send ack) 4033 /----- SACK [TSN Ack=6,Block=1, 4034 / Start=2,End=2] 4035 <-----/ 4036 (remove 6 from out-queue, 4037 and mark 7 as "1" missing report) 4039 Figure 9 - Reporting a Gap using SACK 4041 The maximum number of Gap Ack Blocks that can be reported within a 4042 single SACK chunk is limited by the current path MTU. When a single 4043 SACK can not cover all the Gap Ack Blocks needed to be reported due 4044 to the MTU limitation, the endpoint MUST send only one SACK, 4045 reporting the Gap Ack Blocks from the lowest to highest TSNs, within 4046 the size limit set by the MTU, and leave the remaining highest TSN 4047 numbers unacknowledged. 4049 6.8. CRC32c Checksum Calculation 4051 When sending an SCTP packet, the endpoint MUST strengthen the data 4052 integrity of the transmission by including the CRC32c checksum value 4053 calculated on the packet, as described below. 4055 After the packet is constructed (containing the SCTP common header 4056 and one or more control or DATA chunks), the transmitter MUST 4057 1) fill in the proper Verification Tag in the SCTP common header and 4058 initialize the checksum field to '0's, 4060 2) calculate the CRC32c checksum of the whole packet, including the 4061 SCTP common header and all the chunks (refer to appendix B for 4062 details of the CRC32c algorithm); and 4064 3) put the resultant value into the checksum field in the common 4065 header, and leave the rest of the bits unchanged. 4067 When an SCTP packet is received, the receiver MUST first check the 4068 CRC32c checksum as follows: 4070 1) Store the received CRC32c checksum value aside. 4072 2) Replace the 32 bits of the checksum field in the received SCTP 4073 packet with all '0's and calculate a CRC32c checksum value of the 4074 whole received packet. 4076 3) Verify that the calculated CRC32c checksum is the same as the 4077 received CRC32c checksum. If it is not, the receiver MUST treat 4078 the packet as an invalid SCTP packet. 4080 The default procedure for handling invalid SCTP packets is to 4081 silently discard them. 4083 Any hardware implementation SHOULD be done in a way that is 4084 verifiable by the software. 4086 6.9. Fragmentation and Reassembly 4088 An endpoint MAY support fragmentation when sending DATA chunks, but 4089 it MUST support reassembly when receiving DATA chunks. If an 4090 endpoint supports fragmentation, it MUST fragment a user message if 4091 the size of the user message to be sent causes the outbound SCTP 4092 packet size to exceed the current MTU. If an implementation does not 4093 support fragmentation of outbound user messages, the endpoint MUST 4094 return an error to its upper layer and not attempt to send the user 4095 message. 4097 Note: If an implementation that supports fragmentation makes 4098 available to its upper layer a mechanism to turn off fragmentation it 4099 may do so. However, in so doing, it MUST react just like an 4100 implementation that does NOT support fragmentation, i.e., it MUST 4101 reject sends that exceed the current P-MTU. 4103 IMPLEMENTATION NOTE: In this error case, the Send primitive discussed 4104 in Section 10.1 would need to return an error to the upper layer. 4106 If its peer is multi-homed, the endpoint shall choose a size no 4107 larger than the association Path MTU. The association Path MTU is 4108 the smallest Path MTU of all destination addresses. 4110 Note: Once a message is fragmented it cannot be re-fragmented. 4111 Instead if the PMTU has been reduced, then IP fragmentation must be 4112 used. Please see Section 7.3 for details of PMTU discovery. 4114 When determining when to fragment, the SCTP implementation MUST take 4115 into account the SCTP packet header as well as the DATA chunk 4116 header(s). The implementation MUST also take into account the space 4117 required for a SACK chunk if bundling a SACK chunk with the DATA 4118 chunk. 4120 Fragmentation takes the following steps: 4122 1) The data sender MUST break the user message into a series of DATA 4123 chunks such that each chunk plus SCTP overhead fits into an IP 4124 datagram smaller than or equal to the association Path MTU. 4126 2) The transmitter MUST then assign, in sequence, a separate TSN to 4127 each of the DATA chunks in the series. The transmitter assigns 4128 the same SSN to each of the DATA chunks. If the user indicates 4129 that the user message is to be delivered using unordered 4130 delivery, then the U flag of each DATA chunk of the user message 4131 MUST be set to 1. 4133 3) The transmitter MUST also set the B/E bits of the first DATA 4134 chunk in the series to '10', the B/E bits of the last DATA chunk 4135 in the series to '01', and the B/E bits of all other DATA chunks 4136 in the series to '00'. 4138 An endpoint MUST recognize fragmented DATA chunks by examining the 4139 B/E bits in each of the received DATA chunks, and queue the 4140 fragmented DATA chunks for re-assembly. Once the user message is 4141 reassembled, SCTP shall pass the re-assembled user message to the 4142 specific stream for possible re-ordering and final dispatching. 4144 Note: If the data receiver runs out of buffer space while still 4145 waiting for more fragments to complete the re-assembly of the 4146 message, it should dispatch part of its inbound message through a 4147 partial delivery API (see Section 10), freeing some of its receive 4148 buffer space so that the rest of the message may be received. 4150 6.10. Bundling 4152 An endpoint bundles chunks by simply including multiple chunks in one 4153 outbound SCTP packet. The total size of the resultant IP datagram, 4154 including the SCTP packet and IP headers, MUST be less or equal to 4155 the current Path MTU. 4157 If its peer endpoint is multi-homed, the sending endpoint shall 4158 choose a size no larger than the latest MTU of the current primary 4159 path. 4161 When bundling control chunks with DATA chunks, an endpoint MUST place 4162 control chunks first in the outbound SCTP packet. The transmitter 4163 MUST transmit DATA chunks within a SCTP packet in increasing order of 4164 TSN. 4166 Note: Since control chunks must be placed first in a packet and since 4167 DATA chunks must be transmitted before SHUTDOWN or SHUTDOWN ACK 4168 chunks, DATA chunks cannot be bundled with SHUTDOWN or SHUTDOWN ACK 4169 chunks. 4171 Partial chunks MUST NOT be placed in an SCTP packet. A partial chunk 4172 is a chunk that is not completely contained in the SCTP packet; i.e., 4173 the SCTP packet is too short to contain all the bytes of the chunk as 4174 indicated by the chunk length. 4176 An endpoint MUST process received chunks in their order in the 4177 packet. The receiver uses the chunk length field to determine the 4178 end of a chunk and beginning of the next chunk taking account of the 4179 fact that all chunks end on a 4 byte boundary. If the receiver 4180 detects a partial chunk, it MUST drop the chunk. 4182 An endpoint MUST NOT bundle INIT, INIT ACK or SHUTDOWN COMPLETE with 4183 any other chunks. 4185 7. Congestion control 4187 Congestion control is one of the basic functions in SCTP. For some 4188 applications, it may be likely that adequate resources will be 4189 allocated to SCTP traffic to assure prompt delivery of time-critical 4190 data - thus it would appear to be unlikely, during normal operations, 4191 that transmissions encounter severe congestion conditions. However 4192 SCTP must operate under adverse operational conditions, which can 4193 develop upon partial network failures or unexpected traffic surges. 4194 In such situations SCTP must follow correct congestion control steps 4195 to recover from congestion quickly in order to get data delivered as 4196 soon as possible. In the absence of network congestion, these 4197 preventive congestion control algorithms should show no impact on the 4198 protocol performance. 4200 IMPLEMENTATION NOTE: As far as its specific performance requirements 4201 are met, an implementation is always allowed to adopt a more 4202 conservative congestion control algorithm than the one defined below. 4204 The congestion control algorithms used by SCTP are based on 4205 [RFC2581]. This section describes how the algorithms defined in 4206 [RFC2581] are adapted for use in SCTP. We first list differences in 4207 protocol designs between TCP and SCTP, and then describe SCTP's 4208 congestion control scheme. The description will use the same 4209 terminology as in TCP congestion control whenever appropriate. 4211 SCTP congestion control is always applied to the entire association, 4212 and not to individual streams. 4214 7.1. SCTP Differences from TCP Congestion control 4216 Gap Ack Blocks in the SCTP SACK carry the same semantic meaning as 4217 the TCP SACK. TCP considers the information carried in the SACK as 4218 advisory information only. SCTP considers the information carried in 4219 the Gap Ack Blocks in the SACK chunk as advisory. In SCTP, any DATA 4220 chunk that has been acknowledged by SACK, including DATA that arrived 4221 at the receiving end out of order, are not considered fully delivered 4222 until the Cumulative TSN Ack Point passes the TSN of the DATA chunk 4223 (i.e., the DATA chunk has been acknowledged by the Cumulative TSN Ack 4224 field in the SACK). Consequently, the value of cwnd controls the 4225 amount of outstanding data, rather than (as in the case of non-SACK 4226 TCP) the upper bound between the highest acknowledged sequence number 4227 and the latest DATA chunk that can be sent within the congestion 4228 window. SCTP SACK leads to different implementations of fast- 4229 retransmit and fast-recovery than non-SACK TCP. As an example see 4230 [FALL96]. 4232 The biggest difference between SCTP and TCP, however, is multi- 4233 homing. SCTP is designed to establish robust communication 4234 associations between two endpoints each of which may be reachable by 4235 more than one transport address. Potentially different addresses may 4236 lead to different data paths between the two endpoints, thus ideally 4237 one may need a separate set of congestion control parameters for each 4238 of the paths. The treatment here of congestion control for multi- 4239 homed receivers is new with SCTP and may require refinement in the 4240 future. The current algorithms make the following assumptions: 4242 o The sender usually uses the same destination address until being 4243 instructed by the upper layer to do otherwise; however, SCTP may 4244 change to an alternate destination in the event an address is 4245 marked inactive (see Section 8.2). Also, SCTP may retransmit to a 4246 different transport address than the original transmission. 4248 o The sender keeps a separate congestion control parameter set for 4249 each of the destination addresses it can send to (not each source- 4250 destination pair but for each destination). The parameters should 4251 decay if the address is not used for a long enough time period. 4253 o For each of the destination addresses, an endpoint does slow-start 4254 upon the first transmission to that address. 4256 Note: TCP guarantees in-sequence delivery of data to its upper-layer 4257 protocol within a single TCP session. This means that when TCP 4258 notices a gap in the received sequence number, it waits until the gap 4259 is filled before delivering the data that was received with sequence 4260 numbers higher than that of the missing data. On the other hand, 4261 SCTP can deliver data to its upper-layer protocol even if there is a 4262 gap in TSN if the Stream Sequence Numbers are in sequence for a 4263 particular stream (i.e., the missing DATA chunks are for a different 4264 stream) or if unordered delivery is indicated. Although this does 4265 not affect cwnd, it might affect rwnd calculation. 4267 7.2. SCTP Slow-Start and Congestion Avoidance 4269 The slow start and congestion avoidance algorithms MUST be used by an 4270 endpoint to control the amount of data being injected into the 4271 network. The congestion control in SCTP is employed in regard to the 4272 association, not to an individual stream. In some situations it may 4273 be beneficial for an SCTP sender to be more conservative than the 4274 algorithms allow; however, an SCTP sender MUST NOT be more aggressive 4275 than the following algorithms allow. 4277 Like TCP, an SCTP endpoint uses the following three control variables 4278 to regulate its transmission rate. 4280 o Receiver advertised window size (rwnd, in bytes), which is set by 4281 the receiver based on its available buffer space for incoming 4282 packets. 4284 Note: This variable is kept on the entire association. 4286 o Congestion control window (cwnd, in bytes), which is adjusted by 4287 the sender based on observed network conditions. 4289 Note: This variable is maintained on a per-destination address 4290 basis. 4292 o Slow-start threshold (ssthresh, in bytes), which is used by the 4293 sender to distinguish slow start and congestion avoidance phases. 4295 Note: This variable is maintained on a per-destination address 4296 basis. 4298 SCTP also requires one additional control variable, 4299 partial_bytes_acked, which is used during congestion avoidance phase 4300 to facilitate cwnd adjustment. 4302 Unlike TCP, an SCTP sender MUST keep a set of these control variables 4303 cwnd, ssthresh and partial_bytes_acked for EACH destination address 4304 of its peer (when its peer is multi-homed). Only one rwnd is kept 4305 for the whole association (no matter if the peer is multi-homed or 4306 has a single address). 4308 7.2.1. Slow-Start 4310 Beginning data transmission into a network with unknown conditions or 4311 after a sufficiently long idle period requires SCTP to probe the 4312 network to determine the available capacity. The slow start 4313 algorithm is used for this purpose at the beginning of a transfer, or 4314 after repairing loss detected by the retransmission timer. 4316 o The initial cwnd before DATA transmission or after a sufficiently 4317 long idle period MUST be set to min(4*MTU, max (2*MTU, 4380 4318 bytes)). 4320 o The initial cwnd after a retransmission timeout MUST be no more 4321 than 1*MTU. 4323 o The initial value of ssthresh MAY be arbitrarily high (for 4324 example, implementations MAY use the size of the receiver 4325 advertised window). 4327 o Whenever cwnd is greater than zero, the endpoint is allowed to 4328 have cwnd bytes of data outstanding on that transport address. 4330 o When cwnd is less than or equal to ssthresh, an SCTP endpoint MUST 4331 use the slow start algorithm to increase cwnd only if the current 4332 congestion window is being fully utilized, an incoming SACK 4333 advances the Cumulative TSN Ack Point, and the data sender is not 4334 in Fast Recovery. Only when these three conditions are met can 4335 the cwnd be increased; otherwise, the cwnd MUST not be increased. 4336 If these conditions are met, then cwnd MUST be increased by, at 4337 most, the lesser of 1) the total size of the previously 4338 outstanding DATA chunk(s) acknowledged, and 2) the destination's 4339 path MTU. This upper bound protects against the ACK-Splitting 4340 attack outlined in [SAVAGE99]. 4342 In instances where its peer endpoint is multi-homed, if an endpoint 4343 receives a SACK that advances its Cumulative TSN Ack Point, then it 4344 should update its cwnd (or cwnds) apportioned to the destination 4345 addresses to which it transmitted the acknowledged data. However if 4346 the received SACK does not advance the Cumulative TSN Ack Point, the 4347 endpoint MUST NOT adjust the cwnd of any of the destination 4348 addresses. 4350 Because an endpoint's cwnd is not tied to its Cumulative TSN Ack 4351 Point, as duplicate SACKs come in, even though they may not advance 4352 the Cumulative TSN Ack Point an endpoint can still use them to clock 4353 out new data. That is, the data newly acknowledged by the SACK 4354 diminishes the amount of data now in flight to less than cwnd; and so 4355 the current, unchanged value of cwnd now allows new data to be sent. 4356 On the other hand, the increase of cwnd must be tied to the 4357 Cumulative TSN Ack Point advancement as specified above. Otherwise 4358 the duplicate SACKs will not only clock out new data, but also will 4359 adversely clock out more new data than what has just left the 4360 network, during a time of possible congestion. 4362 o When the endpoint does not transmit data on a given transport 4363 address, the cwnd of the transport address should be adjusted to 4364 max(cwnd/2, 4*MTU) per RTO. 4366 7.2.2. Congestion Avoidance 4368 When cwnd is greater than ssthresh, cwnd should be incremented by 4369 1*MTU per RTT if the sender has cwnd or more bytes of data 4370 outstanding for the corresponding transport address. 4372 In practice an implementation can achieve this goal in the following 4373 way: 4375 o partial_bytes_acked is initialized to 0. 4377 o Whenever cwnd is greater than ssthresh, upon each SACK arrival 4378 that advances the Cumulative TSN Ack Point, increase 4379 partial_bytes_acked by the total number of bytes of all new chunks 4380 acknowledged in that SACK including chunks acknowledged by the new 4381 Cumulative TSN Ack and by Gap Ack Blocks. 4383 o When partial_bytes_acked is equal to or greater than cwnd and 4384 before the arrival of the SACK the sender had cwnd or more bytes 4385 of data outstanding (i.e., before arrival of the SACK, flightsize 4386 was greater than or equal to cwnd), increase cwnd by MTU, and 4387 reset partial_bytes_acked to (partial_bytes_acked - cwnd). 4389 o Same as in the slow start, when the sender does not transmit DATA 4390 on a given transport address, the cwnd of the transport address 4391 should be adjusted to max(cwnd / 2, 4*MTU) per RTO. 4393 o When all of the data transmitted by the sender has been 4394 acknowledged by the receiver, partial_bytes_acked is initialized 4395 to 0. 4397 7.2.3. Congestion Control 4399 Upon detection of packet losses from SACK (see Section 7.2.4), An 4400 endpoint should do the following: 4401 ssthresh = max(cwnd/2, 4*MTU) 4402 cwnd = ssthresh 4403 partial_bytes_acked = 0 4405 Basically, a packet loss causes cwnd to be cut in half. 4407 When the T3-rtx timer expires on an address, SCTP should perform slow 4408 start by: 4409 ssthresh = max(cwnd/2, 4*MTU) 4410 cwnd = 1*MTU 4412 and assure that no more than one SCTP packet will be in flight for 4413 that address until the endpoint receives acknowledgement for 4414 successful delivery of data to that address. 4416 7.2.4. Fast Retransmit on Gap Reports 4418 In the absence of data loss, an endpoint performs delayed 4419 acknowledgement. However, whenever an endpoint notices a hole in the 4420 arriving TSN sequence, it SHOULD start sending a SACK back every time 4421 a packet arrives carrying data until the hole is filled. 4423 Whenever an endpoint receives a SACK that indicates that some TSNs 4424 are missing, it SHOULD wait for 2 further miss indications (via 4425 subsequent SACKs for a total of 3 missing reports) on the same TSNs 4426 before taking action with regard to Fast Retransmit. 4428 Miss indications SHOULD follow the HTNA (Highest TSN Newly 4429 Acknowledged) algorithm. For each incoming SACK, miss indications 4430 are incremented only for missing TSNs prior to the highest TSN newly 4431 acknowledged in the SACK. A newly acknowledged DATA chunk is one not 4432 previously acknowledged in a SACK. If an endpoint is in Fast 4433 Recovery and a SACK arrives that advances the Cumulative TSN Ack 4434 Point, the miss indications are incremented for all TSNs reported 4435 missing in the SACK. 4437 When the third consecutive miss indication is received for a TSN(s), 4438 the data sender shall do the following: 4440 1) Mark the DATA chunk(s) with three miss indications for 4441 retransmission. 4443 2) If not in Fast Recovery, adjust the ssthresh and cwnd of the 4444 destination address(es) to which the missing DATA chunks were 4445 last sent, according to the formula described in Section 7.2.3. 4447 3) Determine how many of the earliest (i.e., lowest TSN) DATA chunks 4448 marked for retransmission will fit into a single packet, subject 4449 to constraint of the path MTU of the destination transport 4450 address to which the packet is being sent. Call this value K. 4451 Retransmit those K DATA chunks in a single packet. When a Fast 4452 Retransmit is being performed, the sender SHOULD ignore the value 4453 of cwnd and SHOULD NOT delay retransmission for this single 4454 packet. 4456 4) Restart T3-rtx timer only if the last SACK acknowledged the 4457 lowest outstanding TSN number sent to that address, or the 4458 endpoint is retransmitting the first outstanding DATA chunk sent 4459 to that address. 4461 5) Mark the DATA chunk(s) as being fast retransmitted and thus 4462 ineligible for a subsequent fast retransmit. Those TSNs marked 4463 for retransmission due to the Fast Retransmit algorithm that did 4464 not fit in the sent datagram carrying K other TSNs are also 4465 marked as ineligible for a subsequent fast retransmit. However, 4466 as they are marked for retransmission they will be retransmitted 4467 later on as soon as cwnd allows. 4469 6) If not in Fast Recovery, enter Fast Recovery and mark the highest 4470 outstanding TSN as the Fast Recovery exit point. When a SACK 4471 acknowledges all TSNs up to and including this exit point, Fast 4472 Recovery is exited. While in Fast Recovery, the ssthresh and 4473 cwnd SHOULD NOT change for any destinations due to a subsequent 4474 Fast Recovery event (i.e., one SHOULD NOT reduce the cwnd further 4475 due to a subsequent fast retransmit). 4477 Note: Before the above adjustments, if the received SACK also 4478 acknowledges new DATA chunks and advances the Cumulative TSN Ack 4479 Point, the cwnd adjustment rules defined in Section 7.2.1 and 4480 Section 7.2.2 must be applied first. 4482 A straightforward implementation of the above keeps a counter for 4483 each TSN hole reported by a SACK. The counter increments for each 4484 consecutive SACK reporting the TSN hole. After reaching 3 and 4485 starting the fast retransmit procedure, the counter resets to 0. 4487 Because cwnd in SCTP indirectly bounds the number of outstanding 4488 TSN's, the effect of TCP fast-recovery is achieved automatically with 4489 no adjustment to the congestion control window size. 4491 7.3. Path MTU Discovery 4493 [RFC4821] specifies "Packetization Layer Path MTU Discovery", whereby 4494 an endpoint maintains an estimate of the maximum transmission unit 4495 (MTU) along a given Internet path and refrains from sending packets 4496 along that path which exceed the MTU, other than occasional attempts 4497 to probe for a change in the Path MTU (PMTU). [RFC4821] is thorough 4498 in its discussion of the MTU discovery mechanism and strategies for 4499 determining the current end-to-end MTU setting as well as detecting 4500 changes in this value. 4502 An endpoint SHOULD apply these techniques, and SHOULD do so on a per- 4503 destination-address basis. 4505 There are 2 important SCTP specific points regarding path MTU 4506 discovery: 4508 1) SCTP associations can span multiple addresses. An endpoint MUST 4509 maintain separate MTU estimates for each destination address of 4510 its peer. 4512 2) The sender should track an association PMTU which will be the 4513 smallest PMTU discovered for all of the peer's destination 4514 addresses. When fragmenting messages into multiple parts this 4515 association PMTU should be used to calculate the size of each 4516 fragment. This will allow retransmissions to be seamlessly sent 4517 to an alternate address without encountering IP fragmentation. 4519 8. Fault Management 4521 8.1. Endpoint Failure Detection 4523 An endpoint shall keep a counter on the total number of consecutive 4524 retransmissions to its peer (this includes retransmissions to all the 4525 destination transport addresses of the peer if it is multi-homed), 4526 including unacknowledged HEARTBEAT Chunks. If the value of this 4527 counter exceeds the limit indicated in the protocol parameter 4528 'Association.Max.Retrans', the endpoint shall consider the peer 4529 endpoint unreachable and shall stop transmitting any more data to it 4530 (and thus the association enters the CLOSED state). In addition, the 4531 endpoint MAY report the failure to the upper layer and optionally 4532 report back all outstanding user data remaining in its outbound 4533 queue. The association is automatically closed when the peer 4534 endpoint becomes unreachable. 4536 The counter shall be reset each time a DATA chunk sent to that peer 4537 endpoint is acknowledged (by the reception of a SACK), or a 4538 HEARTBEAT-ACK is received from the peer endpoint. 4540 8.2. Path Failure Detection 4542 When its peer endpoint is multi-homed, an endpoint should keep a 4543 error counter for each of the destination transport addresses of the 4544 peer endpoint. 4546 Each time the T3-rtx timer expires on any address, or when a 4547 HEARTBEAT sent to an idle address is not acknowledged within a RTO, 4548 the error counter of that destination address will be incremented. 4549 When the value in the error counter exceeds the protocol parameter 4550 'Path.Max.Retrans' of that destination address, the endpoint should 4551 mark the destination transport address as inactive, and a 4552 notification SHOULD be sent to the upper layer. 4554 When an outstanding TSN is acknowledged or a HEARTBEAT sent to that 4555 address is acknowledged with a HEARTBEAT ACK, the endpoint shall 4556 clear the error counter of the destination transport address to which 4557 the DATA chunk was last sent (or HEARTBEAT was sent). When the peer 4558 endpoint is multi-homed and the last chunk sent to it was a 4559 retransmission to an alternate address, there exists an ambiguity as 4560 to whether or not the acknowledgement should be credited to the 4561 address of the last chunk sent. However, this ambiguity does not 4562 seem to bear any significant consequence to SCTP behavior. If this 4563 ambiguity is undesirable, the transmitter may choose not to clear the 4564 error counter if the last chunk sent was a retransmission. 4566 Note: When configuring the SCTP endpoint, the user should avoid 4567 having the value of 'Association.Max.Retrans' larger than the 4568 summation of the 'Path.Max.Retrans' of all the destination addresses 4569 for the remote endpoint. Otherwise, all the destination addresses 4570 may become inactive while the endpoint still considers the peer 4571 endpoint reachable. When this condition occurs, how the SCTP chooses 4572 to function is implementation specific. 4574 When the primary path is marked inactive (due to excessive 4575 retransmissions, for instance), the sender MAY automatically transmit 4576 new packets to an alternate destination address if one exists and is 4577 active. If more than one alternate address is active when the 4578 primary path is marked inactive only ONE transport address SHOULD be 4579 chosen and used as the new destination transport address. 4581 8.3. Path Heartbeat 4583 By default, an SCTP endpoint SHOULD monitor the reachability of the 4584 idle destination transport address(es) of its peer by sending a 4585 HEARTBEAT chunk periodically to the destination transport 4586 address(es). HEARTBEAT sending MAY begin upon reaching the 4587 ESTABLISHED state and is discontinued after sending either SHUTDOWN 4588 or SHUTDOWN-ACK. A receiver of a HEARTBEAT MUST respond to a 4589 HEARTBEAT with a HEARTBEAT-ACK after entering the COOKIE-ECHOED state 4590 (INIT sender) or the ESTABLISHED state (INIT receiver), up until 4591 reaching the SHUTDOWN-SENT state (SHUTDOWN sender) or the SHUTDOWN- 4592 ACK-SENT state (SHUTDOWN receiver). 4594 A destination transport address is considered "idle" if no new chunk 4595 which can be used for updating path RTT (usually including first 4596 transmission DATA, INIT, COOKIE ECHO, HEARTBEAT etc.) and no 4597 HEARTBEAT has been sent to it within the current heartbeat period of 4598 that address. This applies to both active and inactive destination 4599 addresses. 4601 The upper layer can optionally initiate the following functions: 4603 A) Disable heartbeat on a specific destination transport address of a 4604 given association, 4606 B) Change the HB.interval, 4608 C) Re-enable heartbeat on a specific destination transport address of 4609 a given association, and, 4611 D) Request an on-demand HEARTBEAT on a specific destination transport 4612 address of a given association. 4614 The endpoint should increment the respective error counter of the 4615 destination transport address each time a HEARTBEAT is sent to that 4616 address and not acknowledged within one RTO. 4618 When the value of this counter reaches the protocol parameter 4619 'Path.Max.Retrans', the endpoint should mark the corresponding 4620 destination address as inactive if it is not so marked, and may also 4621 optionally report to the upper layer the change of reachability of 4622 this destination address. After this, the endpoint should continue 4623 HEARTBEAT on this destination address but should stop increasing the 4624 counter. 4626 The sender of the HEARTBEAT chunk should include in the Heartbeat 4627 Information field of the chunk the current time when the packet is 4628 sent out and the destination address to which the packet is sent. 4630 IMPLEMENTATION NOTE: An alternative implementation of the heartbeat 4631 mechanism that can be used is to increment the error counter variable 4632 every time a HEARTBEAT is sent to a destination. Whenever a 4633 HEARTBEAT ACK arrives, the sender SHOULD clear the error counter of 4634 the destination that the HEARTBEAT was sent to. This in effect would 4635 clear the previously stroked error (and any other error counts as 4636 well). 4638 The receiver of the HEARTBEAT should immediately respond with a 4639 HEARTBEAT ACK that contains the Heartbeat Information TLV, together 4640 with any other received TLVs, copied unchanged from the received 4641 HEARTBEAT chunk. 4643 Upon the receipt of the HEARTBEAT ACK, the sender of the HEARTBEAT 4644 should clear the error counter of the destination transport address 4645 to which the HEARTBEAT was sent, and mark the destination transport 4646 address as active if it is not so marked. The endpoint may 4647 optionally report to the upper layer when an inactive destination 4648 address is marked as active due to the reception of the latest 4649 HEARTBEAT ACK. The receiver of the HEARTBEAT ACK must also clear the 4650 association overall error count as well (as defined in Section 8.1). 4652 The receiver of the HEARTBEAT ACK should also perform an RTT 4653 measurement for that destination transport address using the time 4654 value carried in the HEARTBEAT ACK chunk. 4656 On an idle destination address that is allowed to heartbeat, it is 4657 recommended that a HEARTBEAT chunk is sent once per RTO of that 4658 destination address plus the protocol parameter 'HB.interval', with 4659 jittering of +/- 50% of the RTO value, and exponential back-off of 4660 the RTO if the previous HEARTBEAT is unanswered. 4662 A primitive is provided for the SCTP user to change the HB.interval 4663 and turn on or off the heartbeat on a given destination address. The 4664 heartbeat interval set by the SCTP user is added to the RTO of that 4665 destination (including any exponential backoff). Only one heartbeat 4666 should be sent each time the heartbeat timer expires (if multiple 4667 destinations are idle). It is a implementation decision on how to 4668 choose which of the candidate idle destinations to heartbeat to (if 4669 more than one destination is idle). 4671 Note: When tuning the heartbeat interval, there is a side effect that 4672 SHOULD be taken into account. When this value is increased, i.e. the 4673 HEARTBEAT takes longer, the detection of lost ABORT messages takes 4674 longer as well. If a peer endpoint ABORTs the association for any 4675 reason and the ABORT chunk is lost, the local endpoint will only 4676 discover the lost ABORT by sending a DATA chunk or HEARTBEAT chunk 4677 (thus causing the peer to send another ABORT). This must be 4678 considered when tuning the HEARTBEAT timer. If the HEARTBEAT is 4679 disabled only sending DATA to the association will discover a lost 4680 ABORT from the peer. 4682 8.4. Handle "Out of the blue" Packets 4684 An SCTP packet is called an "out of the blue" (OOTB) packet if it is 4685 correctly formed (i.e., passed the receiver's CRC32c check; see 4686 Section 6.8), but the receiver is not able to identify the 4687 association to which this packet belongs. 4689 The receiver of an OOTB packet MUST do the following: 4691 1) If the OOTB packet is to or from a non-unicast address, a 4692 receiver SHOULD silently discard the packet. Otherwise, 4694 2) If the OOTB packet contains an ABORT chunk, the receiver MUST 4695 silently discard the OOTB packet and take no further action. 4696 Otherwise, 4698 3) If the packet contains an INIT chunk with a Verification Tag set 4699 to '0', process it as described in Section 5.1. If, for whatever 4700 reason, the INIT cannot be processed normally and an ABORT has to 4701 be sent in response, the Verification Tag of the packet 4702 containing the ABORT chunk MUST be the Initiate tag of the 4703 received INIT chunk, and the T-Bit of the ABORT chunk has to be 4704 set to 0, indicating that the Verification Tag is NOT reflected. 4706 4) If the packet contains a COOKIE ECHO in the first chunk, process 4707 it as described in Section 5.1. Otherwise, 4709 5) If the packet contains a SHUTDOWN ACK chunk, the receiver should 4710 respond to the sender of the OOTB packet with a SHUTDOWN 4711 COMPLETE. When sending the SHUTDOWN COMPLETE, the receiver of 4712 the OOTB packet must fill in the Verification Tag field of the 4713 outbound packet with the Verification Tag received in the 4714 SHUTDOWN ACK and set the T-bit in the Chunk Flags to indicate 4715 that the Verification Tag is reflected. Otherwise, 4717 6) If the packet contains a SHUTDOWN COMPLETE chunk, the receiver 4718 should silently discard the packet and take no further action. 4719 Otherwise, 4721 7) If the packet contains a "Stale cookie" ERROR or a COOKIE ACK the 4722 SCTP Packet should be silently discarded. Otherwise, 4724 8) The receiver should respond to the sender of the OOTB packet with 4725 an ABORT. When sending the ABORT, the receiver of the OOTB 4726 packet MUST fill in the Verification Tag field of the outbound 4727 packet with the value found in the Verification Tag field of the 4728 OOTB packet and set the T-bit in the Chunk Flags to indicate that 4729 the Verification Tag is reflected. After sending this ABORT, the 4730 receiver of the OOTB packet shall discard the OOTB packet and 4731 take no further action. 4733 8.5. Verification Tag 4735 The Verification Tag rules defined in this section apply when sending 4736 or receiving SCTP packets which do not contain an INIT, SHUTDOWN 4737 COMPLETE, COOKIE ECHO (see Section 5.1), ABORT or SHUTDOWN ACK chunk. 4738 The rules for sending and receiving SCTP packets containing one of 4739 these chunk types are discussed separately in Section 8.5.1. 4741 When sending an SCTP packet, the endpoint MUST fill in the 4742 Verification Tag field of the outbound packet with the tag value in 4743 the Initiate Tag parameter of the INIT or INIT ACK received from its 4744 peer. 4746 When receiving an SCTP packet, the endpoint MUST ensure that the 4747 value in the Verification Tag field of the received SCTP packet 4748 matches its own Tag. If the received Verification Tag value does not 4749 match the receiver's own tag value, the receiver shall silently 4750 discard the packet and shall not process it any further except for 4751 those cases listed in Section 8.5.1 below. 4753 8.5.1. Exceptions in Verification Tag Rules 4755 A) Rules for packet carrying INIT: 4757 - The sender MUST set the Verification Tag of the packet to 0. 4759 - When an endpoint receives an SCTP packet with the Verification 4760 Tag set to 0, it should verify that the packet contains only an 4761 INIT chunk. Otherwise, the receiver MUST silently discard the 4762 packet. 4764 B) Rules for packet carrying ABORT: 4766 - The endpoint MUST always fill in the Verification Tag field of 4767 the outbound packet with the destination endpoint's tag value, if 4768 it is known. 4770 - If the ABORT is sent in response to an OOTB packet, the endpoint 4771 MUST follow the procedure described in Section 8.4 4773 - The receiver of an ABORT MUST accept the packet if the 4774 Verification Tag field of the packet matches its own tag and the 4775 T bit is not set OR if it is set to its peer's tag and the T bit 4776 is set in the Chunk Flags. Otherwise, the receiver MUST silently 4777 discard the packet and take no further action. 4779 C) Rules for packet carrying SHUTDOWN COMPLETE: 4781 - When sending a SHUTDOWN COMPLETE, if the receiver of the SHUTDOWN 4782 ACK has a TCB, then the destination endpoint's tag MUST be used, 4783 and the T-bit MUST NOT be set. Only where no TCB exists should 4784 the sender use the Verification Tag from the SHUTDOWN ACK, and 4785 MUST set the T-bit. 4787 - The receiver of a SHUTDOWN COMPLETE shall accept the packet if 4788 the Verification Tag field of the packet matches its own tag and 4789 the T bit is not set OR if it is set to its peer's tag and the T 4790 bit is set in the Chunk Flags. Otherwise, the receiver MUST 4791 silently discard the packet and take no further action. An 4792 endpoint MUST ignore the SHUTDOWN COMPLETE if it is not in the 4793 SHUTDOWN-ACK-SENT state. 4795 D) Rules for packet carrying a COOKIE ECHO 4797 - When sending a COOKIE ECHO, the endpoint MUST use the value of 4798 the Initial Tag received in the INIT ACK. 4800 - The receiver of a COOKIE ECHO follows the procedures in 4801 Section 5. 4803 E) Rules for packet carrying a SHUTDOWN ACK 4805 - If the receiver is in COOKIE-ECHOED or COOKIE-WAIT state the 4806 procedures in Section 8.4 SHOULD be followed, in other words it 4807 should be treated as an Out Of The Blue packet. 4809 9. Termination of Association 4811 An endpoint should terminate its association when it exits from 4812 service. An association can be terminated by either abort or 4813 shutdown. An abort of an association is abortive by definition in 4814 that any data pending on either end of the association is discarded 4815 and not delivered to the peer. A shutdown of an association is 4816 considered a graceful close where all data in queue by either 4817 endpoint is delivered to the respective peers. However, in the case 4818 of a shutdown, SCTP does not support a half-open state (like TCP) 4819 wherein one side may continue sending data while the other end is 4820 closed. When either endpoint performs a shutdown, the association on 4821 each peer will stop accepting new data from its user and only deliver 4822 data in queue at the time of sending or receiving the SHUTDOWN chunk. 4824 9.1. Abort of an Association 4826 When an endpoint decides to abort an existing association, it MUST 4827 send an ABORT chunk to its peer endpoint. The sender MUST fill in 4828 the peer's Verification Tag in the outbound packet and MUST NOT 4829 bundle any DATA chunk with the ABORT. If the association is aborted 4830 on request of the upper layer, a User-Initiated Abort error cause 4831 (see Section 3.3.10.12) SHOULD be present in the ABORT chunk. 4833 An endpoint MUST NOT respond to any received packet that contains an 4834 ABORT chunk (also see Section 8.4). 4836 An endpoint receiving an ABORT MUST apply the special Verification 4837 Tag check rules described in Section 8.5.1. 4839 After checking the Verification Tag, the receiving endpoint MUST 4840 remove the association from its record and SHOULD report the 4841 termination to its upper layer. If a User-Initiated Abort error 4842 cause is present in the ABORT chunk, the Upper Layer Abort Reason 4843 SHOULD be made available to the upper layer. 4845 9.2. Shutdown of an Association 4847 Using the SHUTDOWN primitive (see Section 10.1), the upper layer of 4848 an endpoint in an association can gracefully close the association. 4849 This will allow all outstanding DATA chunks from the peer of the 4850 shutdown initiator to be delivered before the association terminates. 4852 Upon receipt of the SHUTDOWN primitive from its upper layer, the 4853 endpoint enters SHUTDOWN-PENDING state and remains there until all 4854 outstanding data has been acknowledged by its peer. The endpoint 4855 accepts no new data from its upper layer, but retransmits data to the 4856 far end if necessary to fill gaps. 4858 Once all its outstanding data has been acknowledged, the endpoint 4859 shall send a SHUTDOWN chunk to its peer including in the Cumulative 4860 TSN Ack field the last sequential TSN it has received from the peer. 4861 It shall then start the T2-shutdown timer and enter the SHUTDOWN-SENT 4862 state. If the timer expires, the endpoint must re-send the SHUTDOWN 4863 with the updated last sequential TSN received from its peer. 4865 The rules in Section 6.3 MUST be followed to determine the proper 4866 timer value for T2-shutdown. To indicate any gaps in TSN, the 4867 endpoint may also bundle a SACK with the SHUTDOWN chunk in the same 4868 SCTP packet. 4870 An endpoint should limit the number of retransmissions of the 4871 SHUTDOWN chunk to the protocol parameter 'Association.Max.Retrans'. 4872 If this threshold is exceeded the endpoint should destroy the TCB and 4873 MUST report the peer endpoint unreachable to the upper layer (and 4874 thus the association enters the CLOSED state). The reception of any 4875 packet from its peer (i.e. as the peer sends all of its queued DATA 4876 chunks) should clear the endpoint's retransmission count and restart 4877 the T2-Shutdown timer, giving its peer ample opportunity to transmit 4878 all of its queued DATA chunks that have not yet been sent. 4880 Upon the reception of the SHUTDOWN, the peer endpoint shall 4882 - enter the SHUTDOWN-RECEIVED state, 4884 - stop accepting new data from its SCTP user 4886 - verify, by checking the Cumulative TSN Ack field of the chunk, 4887 that all its outstanding DATA chunks have been received by the 4888 SHUTDOWN sender. 4890 Once an endpoint as reached the SHUTDOWN-RECEIVED state it MUST NOT 4891 send a SHUTDOWN in response to a ULP request, and should discard 4892 subsequent SHUTDOWN chunks. 4894 If there are still outstanding DATA chunks left, the SHUTDOWN 4895 receiver MUST continue to follow normal data transmission procedures 4896 defined in Section 6, until all outstanding DATA chunks are 4897 acknowledged; however, the SHUTDOWN receiver MUST NOT accept new data 4898 from its SCTP user. 4900 While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately 4901 respond to each received packet containing one or more DATA chunks 4902 with a SHUTDOWN chunk and restart the T2-shutdown timer. If a 4903 SHUTDOWN chunk by itself cannot acknowledge all of the received DATA 4904 chunks (i.e., there are TSNs that can be acknowledged that are larger 4905 than the cumulative TSN, and thus gaps exist in the TSN sequence), or 4906 if duplicate TSNs have been received, then a SACK chunk MUST also be 4907 sent. 4909 The sender of the SHUTDOWN MAY also start an overall guard timer 'T5- 4910 shutdown-guard' to bound the overall time for the shutdown sequence. 4911 At the expiration of this timer, the sender SHOULD abort the 4912 association by sending an ABORT chunk. If the 'T5-shutdown-guard' 4913 timer is used, it SHOULD be set to the recommended value of 5 times 4914 'RTO.Max'. 4916 If the receiver of the SHUTDOWN has no more outstanding DATA chunks, 4917 the SHUTDOWN receiver MUST send a SHUTDOWN ACK and start a T2- 4918 shutdown timer of its own, entering the SHUTDOWN-ACK-SENT state. If 4919 the timer expires, the endpoint must re-send the SHUTDOWN ACK. 4921 The sender of the SHUTDOWN ACK should limit the number of 4922 retransmissions of the SHUTDOWN ACK chunk to the protocol parameter 4923 'Association.Max.Retrans'. If this threshold is exceeded, the 4924 endpoint should destroy the TCB and may report the peer endpoint 4925 unreachable to the upper layer (and thus the association enters the 4926 CLOSED state). 4928 Upon the receipt of the SHUTDOWN ACK, the SHUTDOWN sender shall stop 4929 the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its peer, 4930 and remove all record of the association. 4932 Upon reception of the SHUTDOWN COMPLETE chunk the endpoint will 4933 verify that it is in SHUTDOWN-ACK-SENT state, if it is not the chunk 4934 should be discarded. If the endpoint is in the SHUTDOWN-ACK-SENT 4935 state the endpoint should stop the T2-shutdown timer and remove all 4936 knowledge of the association (and thus the association enters the 4937 CLOSED state). 4939 An endpoint SHOULD assure that all its outstanding DATA chunks have 4940 been acknowledged before initiating the shutdown procedure. 4942 An endpoint should reject any new data request from its upper layer 4943 if it is in SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED, or 4944 SHUTDOWN-ACK-SENT state. 4946 If an endpoint is in SHUTDOWN-ACK-SENT state and receives an INIT 4947 chunk (e.g., if the SHUTDOWN COMPLETE was lost) with source and 4948 destination transport addresses (either in the IP addresses or in the 4949 INIT chunk) that belong to this association, it should discard the 4950 INIT chunk and retransmit the SHUTDOWN ACK chunk. 4952 Note: Receipt of an INIT with the same source and destination IP 4953 addresses as used in transport addresses assigned to an endpoint but 4954 with a different port number indicates the initialization of a 4955 separate association. 4957 The sender of the INIT or COOKIE ECHO should respond to the receipt 4958 of a SHUTDOWN-ACK with a stand-alone SHUTDOWN COMPLETE in an SCTP 4959 packet with the Verification Tag field of its common header set to 4960 the same tag that was received in the SHUTDOWN ACK packet. This is 4961 considered an Out of the Blue packet as defined in Section 8.4. The 4962 sender of the INIT lets T1-init continue running and remains in the 4963 COOKIE-WAIT or COOKIE-ECHOED state. Normal T1-init timer expiration 4964 will cause the INIT or COOKIE chunk to be retransmitted and thus 4965 start a new association. 4967 If a SHUTDOWN is received in COOKIE WAIT or COOKIE ECHOED states the 4968 SHUTDOWN chunk SHOULD be silently discarded. 4970 If an endpoint is in SHUTDOWN-SENT state and receives a SHUTDOWN 4971 chunk from its peer, the endpoint shall respond immediately with a 4972 SHUTDOWN ACK to its peer, and move into a SHUTDOWN-ACK-SENT state 4973 restarting its T2-shutdown timer. 4975 If an endpoint is in the SHUTDOWN-ACK-SENT state and receives a 4976 SHUTDOWN ACK, it shall stop the T2-shutdown timer, send a SHUTDOWN 4977 COMPLETE chunk to its peer, and remove all record of the association. 4979 10. Interface with Upper Layer 4981 The Upper Layer Protocols (ULP) shall request for services by passing 4982 primitives to SCTP and shall receive notifications from SCTP for 4983 various events. 4985 The primitives and notifications described in this section should be 4986 used as a guideline for implementing SCTP. The following functional 4987 description of ULP interface primitives is shown for illustrative 4988 purposes. Different SCTP implementations may have different ULP 4989 interfaces. However, all SCTPs must provide a certain minimum set of 4990 services to guarantee that all SCTP implementations can support the 4991 same protocol hierarchy. 4993 10.1. ULP-to-SCTP 4995 The following sections functionally characterize a ULP/SCTP 4996 interface. The notation used is similar to most procedure or 4997 function calls in high level languages. 4999 The ULP primitives described below specify the basic functions the 5000 SCTP must perform to support inter-process communication. Individual 5001 implementations must define their own exact format, and may provide 5002 combinations or subsets of the basic functions in single calls. 5004 A) Initialize 5006 Format: INITIALIZE ([local port],[local eligible address list])-> 5007 local SCTP instance name 5009 This primitive allows SCTP to initialize its internal data structures 5010 and allocate necessary resources for setting up its operation 5011 environment. Once SCTP is initialized, ULP can communicate directly 5012 with other endpoints without re-invoking this primitive. 5014 SCTP will return a local SCTP instance name to the ULP. 5016 Mandatory attributes: 5018 None. 5020 Optional attributes: 5022 The following types of attributes may be passed along with the 5023 primitive: 5025 o local port - SCTP port number, if ULP wants it to be specified; 5027 o local eligible address list - An address list that the local SCTP 5028 endpoint should bind. By default, if an address list is not 5029 included, all IP addresses assigned to the host should be used by 5030 the local endpoint. 5032 IMPLEMENTATION NOTE: If this optional attribute is supported by an 5033 implementation, it will be the responsibility of the implementation 5034 to enforce that the IP source address field of any SCTP packets sent 5035 out by this endpoint contains one of the IP addresses indicated in 5036 the local eligible address list. 5038 B) Associate 5040 Format: ASSOCIATE(local SCTP instance name, 5041 destination transport addr, outbound stream count) 5042 -> association id [,destination transport addr list] 5043 [,outbound stream count] 5045 This primitive allows the upper layer to initiate an association to a 5046 specific peer endpoint. 5048 The peer endpoint shall be specified by one of the transport 5049 addresses which defines the endpoint (see Section 1.3). If the local 5050 SCTP instance has not been initialized, the ASSOCIATE is considered 5051 an error. 5053 An association id, which is a local handle to the SCTP association, 5054 will be returned on successful establishment of the association. If 5055 SCTP is not able to open an SCTP association with the peer endpoint, 5056 an error is returned. 5058 Other association parameters may be returned, including the complete 5059 destination transport addresses of the peer as well as the outbound 5060 stream count of the local endpoint. One of the transport address 5061 from the returned destination addresses will be selected by the local 5062 endpoint as default primary path for sending SCTP packets to this 5063 peer. The returned "destination transport addr list" can be used by 5064 the ULP to change the default primary path or to force sending a 5065 packet to a specific transport address. 5067 IMPLEMENTATION NOTE: If ASSOCIATE primitive is implemented as a 5068 blocking function call, the ASSOCIATE primitive can return 5069 association parameters in addition to the association id upon 5070 successful establishment. If ASSOCIATE primitive is implemented as a 5071 non-blocking call, only the association id shall be returned and 5072 association parameters shall be passed using the COMMUNICATION UP 5073 notification. 5075 Mandatory attributes: 5077 o local SCTP instance name - obtained from the INITIALIZE operation. 5079 o destination transport addr - specified as one of the transport 5080 addresses of the peer endpoint with which the association is to be 5081 established. 5083 o outbound stream count - the number of outbound streams the ULP 5084 would like to open towards this peer endpoint. 5086 Optional attributes: 5088 None. 5090 C) Shutdown 5092 Format: SHUTDOWN(association id) 5093 -> result 5095 Gracefully closes an association. Any locally queued user data will 5096 be delivered to the peer. The association will be terminated only 5097 after the peer acknowledges all the SCTP packets sent. A success 5098 code will be returned on successful termination of the association. 5099 If attempting to terminate the association results in a failure, an 5100 error code shall be returned. 5102 Mandatory attributes: 5104 o association id - local handle to the SCTP association 5106 Optional attributes: 5108 None. 5110 D) Abort 5112 Format: ABORT(association id [, Upper Layer Abort Reason]) 5113 -> result 5115 Ungracefully closes an association. Any locally queued user data 5116 will be discarded, and an ABORT chunk is sent to the peer. A success 5117 code will be returned on successful abortion of the association. If 5118 attempting to abort the association results in a failure, an error 5119 code shall be returned. 5121 Mandatory attributes: 5123 o association id - local handle to the SCTP association 5125 Optional attributes: 5127 o Upper Layer Abort Reason - Reason of the abort to be passed to the 5128 peer. 5130 None. 5132 E) Send 5134 Format: SEND(association id, buffer address, byte count [,context] 5135 [,stream id] [,life time] [,destination transport address] 5136 [,unordered flag] [,no-bundle flag] [,payload protocol-id] ) 5137 -> result 5139 This is the main method to send user data via SCTP. 5141 Mandatory attributes: 5143 o association id - local handle to the SCTP association 5144 o buffer address - the location where the user message to be 5145 transmitted is stored; 5147 o byte count - The size of the user data in number of bytes; 5149 Optional attributes: 5151 o context - an optional 32 bit integer that will be carried in the 5152 sending failure notification to the ULP if the transportation of 5153 this User Message fails. 5155 o stream id - to indicate which stream to send the data on. If not 5156 specified, stream 0 will be used. 5158 o life time - specifies the life time of the user data. The user 5159 data will not be sent by SCTP after the life time expires. This 5160 parameter can be used to avoid efforts to transmit stale user 5161 messages. SCTP notifies the ULP if the data cannot be initiated 5162 to transport (i.e. sent to the destination via SCTP's send 5163 primitive) within the life time variable. However, the user data 5164 will be transmitted if SCTP has attempted to transmit a chunk 5165 before the life time expired. 5167 IMPLEMENTATION NOTE: In order to better support the data lifetime 5168 option, the transmitter may hold back the assigning of the TSN number 5169 to an outbound DATA chunk to the last moment. And, for 5170 implementation simplicity, once a TSN number has been assigned the 5171 sender should consider the send of this DATA chunk as committed, 5172 overriding any lifetime option attached to the DATA chunk. 5174 o destination transport address - specified as one of the 5175 destination transport addresses of the peer endpoint to which this 5176 packet should be sent. Whenever possible, SCTP should use this 5177 destination transport address for sending the packets, instead of 5178 the current primary path. 5180 o unordered flag - this flag, if present, indicates that the user 5181 would like the data delivered in an unordered fashion to the peer 5182 (i.e., the U flag is set to 1 on all DATA chunks carrying this 5183 message). 5185 o no-bundle flag - instructs SCTP not to bundle this user data with 5186 other outbound DATA chunks. SCTP MAY still bundle even when this 5187 flag is present, when faced with network congestion. 5189 o payload protocol-id - A 32 bit unsigned integer that is to be 5190 passed to the peer indicating the type of payload protocol data 5191 being transmitted. This value is passed as opaque data by SCTP. 5193 F) Set Primary 5195 Format: SETPRIMARY(association id, destination transport address, 5196 [source transport address] ) 5197 -> result 5199 Instructs the local SCTP to use the specified destination transport 5200 address as primary path for sending packets. 5202 The result of attempting this operation shall be returned. If the 5203 specified destination transport address is not present in the 5204 "destination transport address list" returned earlier in an associate 5205 command or communication up notification, an error shall be returned. 5207 Mandatory attributes: 5209 o association id - local handle to the SCTP association 5211 o destination transport address - specified as one of the transport 5212 addresses of the peer endpoint, which should be used as primary 5213 address for sending packets. This overrides the current primary 5214 address information maintained by the local SCTP endpoint. 5216 Optional attributes: 5218 o source transport address - optionally, some implementations may 5219 allow you to set the default source address placed in all outgoing 5220 IP datagrams. 5222 G) Receive 5224 Format: RECEIVE(association id, buffer address, buffer size 5225 [,stream id]) 5226 -> byte count [,transport address] [,stream id] [,stream sequence 5227 number] [,partial flag] [,delivery number] [,payload protocol-id] 5229 This primitive shall read the first user message in the SCTP in-queue 5230 into the buffer specified by ULP, if there is one available. The 5231 size of the message read, in bytes, will be returned. It may, 5232 depending on the specific implementation, also return other 5233 information such as the sender's address, the stream id on which it 5234 is received, whether there are more messages available for retrieval, 5235 etc. For ordered messages, their stream sequence number may also be 5236 returned. 5238 Depending upon the implementation, if this primitive is invoked when 5239 no message is available the implementation should return an 5240 indication of this condition or should block the invoking process 5241 until data does become available. 5243 Mandatory attributes: 5245 o association id - local handle to the SCTP association 5247 o buffer address - the memory location indicated by the ULP to store 5248 the received message. 5250 o buffer size - the maximum size of data to be received, in bytes. 5252 Optional attributes: 5254 o stream id - to indicate which stream to receive the data on. 5256 o stream sequence number - the stream sequence number assigned by 5257 the sending SCTP peer. 5259 o partial flag - if this returned flag is set to 1, then this 5260 Receive contains a partial delivery of the whole message. When 5261 this flag is set, the stream id and stream sequence number MUST 5262 accompany this receive. When this flag is set to 0, it indicates 5263 that no more deliveries will be received for this stream sequence 5264 number. 5266 o payload protocol-id - A 32 bit unsigned integer that is received 5267 from the peer indicating the type of payload protocol of the 5268 received data. This value is passed as opaque data by SCTP. 5270 H) Status 5272 Format: STATUS(association id) 5273 -> status data 5275 This primitive should return a data block containing the following 5276 information: 5277 association connection state, 5278 destination transport address list, 5279 destination transport address reachability states, 5280 current receiver window size, 5281 current congestion window sizes, 5282 number of unacknowledged DATA chunks, 5283 number of DATA chunks pending receipt, 5284 primary path, 5285 most recent SRTT on primary path, 5286 RTO on primary path, 5287 SRTT and RTO on other destination addresses, etc. 5289 Mandatory attributes: 5291 o association id - local handle to the SCTP association 5293 Optional attributes: 5295 None. 5297 I) Change Heartbeat 5299 Format: CHANGE HEARTBEAT(association id, 5300 destination transport address, new state [,interval]) 5301 -> result 5303 Instructs the local endpoint to enable or disable heartbeat on the 5304 specified destination transport address. 5306 The result of attempting this operation shall be returned. 5308 Note: Even when enabled, heartbeat will not take place if the 5309 destination transport address is not idle. 5311 Mandatory attributes: 5313 o association id - local handle to the SCTP association 5315 o destination transport address - specified as one of the transport 5316 addresses of the peer endpoint. 5318 o new state - the new state of heartbeat for this destination 5319 transport address (either enabled or disabled). 5321 Optional attributes: 5323 o interval - if present, indicates the frequency of the heartbeat if 5324 this is to enable heartbeat on a destination transport address. 5325 This value is added to the RTO of the destination transport 5326 address. This value, if present, effects all destinations. 5328 J) Request HeartBeat 5330 Format: REQUESTHEARTBEAT(association id, destination transport 5331 address) 5332 -> result 5334 Instructs the local endpoint to perform a HeartBeat on the specified 5335 destination transport address of the given association. The returned 5336 result should indicate whether the transmission of the HEARTBEAT 5337 chunk to the destination address is successful. 5339 Mandatory attributes: 5341 o association id - local handle to the SCTP association 5343 o destination transport address - the transport address of the 5344 association on which a heartbeat should be issued. 5346 K) Get SRTT Report 5348 Format: GETSRTTREPORT(association id, 5349 destination transport address) 5350 -> srtt result 5352 Instructs the local SCTP to report the current SRTT measurement on 5353 the specified destination transport address of the given association. 5354 The returned result can be an integer containing the most recent SRTT 5355 in milliseconds. 5357 Mandatory attributes: 5359 o association id - local handle to the SCTP association 5361 o destination transport address - the transport address of the 5362 association on which the SRTT measurement is to be reported. 5364 L) Set Failure Threshold 5366 Format: SETFAILURETHRESHOLD(association id, destination transport 5367 address, failure threshold) 5369 -> result 5371 This primitive allows the local SCTP to customize the reachability 5372 failure detection threshold 'Path.Max.Retrans' for the specified 5373 destination address. 5375 Mandatory attributes: 5377 o association id - local handle to the SCTP association 5379 o destination transport address - the transport address of the 5380 association on which the failure detection threshold is to be set. 5382 o failure threshold - the new value of 'Path.Max.Retrans' for the 5383 destination address. 5385 M) Set Protocol Parameters 5387 Format: SETPROTOCOLPARAMETERS(association id, 5388 [,destination transport address,] 5389 protocol parameter list) 5390 -> result 5392 This primitive allows the local SCTP to customize the protocol 5393 parameters. 5395 Mandatory attributes: 5397 o association id - local handle to the SCTP association 5399 o protocol parameter list - The specific names and values of the 5400 protocol parameters (e.g., Association.Max.Retrans [see Section 15 5401 ) that the SCTP user wishes to customize. 5403 Optional attributes: 5405 o destination transport address - some of the protocol parameters 5406 may be set on a per destination transport address basis. 5408 N) Receive unsent message 5410 Format: RECEIVE_UNSENT(data retrieval id, buffer address, 5411 buffer size [,stream id] [, stream sequence number] 5412 [,partial flag] [,payload protocol-id]) 5414 o data retrieval id - The identification passed to the ULP in the 5415 failure notification. 5417 o buffer address - the memory location indicated by the ULP to store 5418 the received message. 5420 o buffer size - the maximum size of data to be received, in bytes. 5422 Optional attributes: 5424 o stream id - this is a return value that is set to indicate which 5425 stream the data was sent to. 5427 o stream sequence number - this value is returned indicating the 5428 stream sequence number that was associated with the message. 5430 o partial flag - if this returned flag is set to 1, then this 5431 message is a partial delivery of the whole message. When this 5432 flag is set, the stream id and stream sequence number MUST 5433 accompany this receive. When this flag is set to 0, it indicates 5434 that no more deliveries will be received for this stream sequence 5435 number. 5437 o payload protocol-id - The 32 bit unsigned integer that was sent to 5438 be sent to the peer indicating the type of payload protocol of the 5439 received data. 5441 o Receive unacknowledged message 5443 Format: RECEIVE_UNACKED(data retrieval id, buffer address, 5444 buffer size, [,stream id] [, stream sequence number] 5445 [,partial flag] [,payload protocol-id]) 5447 o data retrieval id - The identification passed to the ULP in the 5448 failure notification. 5450 o buffer address - the memory location indicated by the ULP to store 5451 the received message. 5453 o buffer size - the maximum size of data to be received, in bytes. 5455 Optional attributes: 5457 o stream id - this is a return value that is set to indicate which 5458 stream the data was sent to. 5460 o stream sequence number - this value is returned indicating the 5461 stream sequence number that was associated with the message. 5463 o partial flag - if this returned flag is set to 1, then this 5464 message is a partial delivery of the whole message. When this 5465 flag is set, the stream id and stream sequence number MUST 5466 accompany this receive. When this flag is set to 0, it indicates 5467 that no more deliveries will be received for this stream sequence 5468 number. 5470 o payload protocol-id - The 32 bit unsigned integer that was sent to 5471 be sent to the peer indicating the type of payload protocol of the 5472 received data. 5474 P) Destroy SCTP instance 5476 Format: DESTROY(local SCTP instance name) 5478 o local SCTP instance name - this is the value that was passed to 5479 the application in the initialize primitive and it indicates which 5480 SCTP instance to be destroyed. 5482 10.2. SCTP-to-ULP 5484 It is assumed that the operating system or application environment 5485 provides a means for the SCTP to asynchronously signal the ULP 5486 process. When SCTP does signal an ULP process, certain information 5487 is passed to the ULP. 5489 IMPLEMENTATION NOTE: In some cases this may be done through a 5490 separate socket or error channel. 5492 A) DATA ARRIVE notification 5494 SCTP shall invoke this notification on the ULP when a user message is 5495 successfully received and ready for retrieval. 5497 The following may be optionally be passed with the notification: 5499 o association id - local handle to the SCTP association 5500 o stream id - to indicate which stream the data is received on. 5502 B) SEND FAILURE notification 5504 If a message can not be delivered SCTP shall invoke this notification 5505 on the ULP. 5507 The following may be optionally be passed with the notification: 5509 o association id - local handle to the SCTP association 5511 o data retrieval id - an identification used to retrieve unsent and 5512 unacknowledged data. 5514 o cause code - indicating the reason of the failure, e.g., size too 5515 large, message life-time expiration, etc. 5517 o context - optional information associated with this message (see D 5518 in Section 10.1). 5520 C) NETWORK STATUS CHANGE notification 5522 When a destination transport address is marked inactive (e.g., when 5523 SCTP detects a failure), or marked active (e.g., when SCTP detects a 5524 recovery), SCTP shall invoke this notification on the ULP. 5526 The following shall be passed with the notification: 5528 o association id - local handle to the SCTP association 5530 o destination transport address - This indicates the destination 5531 transport address of the peer endpoint affected by the change; 5532 o new-status - This indicates the new status. 5534 D) COMMUNICATION UP notification 5536 This notification is used when SCTP becomes ready to send or receive 5537 user messages, or when a lost communication to an endpoint is 5538 restored. 5540 IMPLEMENTATION NOTE: If ASSOCIATE primitive is implemented as a 5541 blocking function call, the association parameters are returned as a 5542 result of the ASSOCIATE primitive itself. In that case, 5543 COMMUNICATION UP notification is optional at the association 5544 initiator's side. 5546 The following shall be passed with the notification: 5548 o association id - local handle to the SCTP association 5550 o status - This indicates what type of event has occurred 5552 o destination transport address list - the complete set of transport 5553 addresses of the peer 5555 o outbound stream count - the maximum number of streams allowed to 5556 be used in this association by the ULP 5558 o inbound stream count - the number of streams the peer endpoint has 5559 requested with this association (this may not be the same number 5560 as 'outbound stream count'). 5562 E) COMMUNICATION LOST notification 5564 When SCTP loses communication to an endpoint completely (e.g., via 5565 Heartbeats) or detects that the endpoint has performed an abort 5566 operation, it shall invoke this notification on the ULP. 5568 The following shall be passed with the notification: 5570 o association id - local handle to the SCTP association 5572 o status - This indicates what type of event has occurred; the 5573 status may indicate that a failure OR a normal termination 5574 event occurred in response to a shutdown or abort request. 5576 The following may be passed with the notification: 5578 o data retrieval id - an identification used to retrieve unsent and 5579 unacknowledged data. 5581 o last-acked - the TSN last acked by that peer endpoint. 5583 o last-sent - the TSN last sent to that peer endpoint. 5585 o Upper Layer Abort Reason - The abort reason specified in case of a 5586 user-initiated abort. 5588 F) COMMUNICATION ERROR notification 5590 When SCTP receives an ERROR chunk from its peer and decides to notify 5591 its ULP, it can invoke this notification on the ULP. 5593 The following can be passed with the notification: 5595 o association id - local handle to the SCTP association 5597 o error info - this indicates the type of error and optionally some 5598 additional information received through the ERROR chunk. 5600 G) RESTART notification 5602 When SCTP detects that the peer has restarted, it may send this 5603 notification to its ULP. 5605 The following can be passed with the notification: 5607 o association id - local handle to the SCTP association 5609 H) SHUTDOWN COMPLETE notification 5611 When SCTP completes the shutdown procedures (section 9.2) this 5612 notification is passed to the upper layer. 5614 The following can be passed with the notification: 5616 o association id - local handle to the SCTP association 5618 11. Security Considerations 5620 11.1. Security Objectives 5622 As a common transport protocol designed to reliably carry time- 5623 sensitive user messages, such as billing or signaling messages for 5624 telephony services, between two networked endpoints, SCTP has the 5625 following security objectives. 5627 - availability of reliable and timely data transport services 5629 - integrity of the user-to-user information carried by SCTP 5631 11.2. SCTP Responses To Potential Threats 5633 SCTP may potentially be used in a wide variety of risk situations. 5634 It is important for operator(s) of systems running SCTP to analyze 5635 their particular situations and decide on the appropriate counter- 5636 measures. 5638 Operators of systems running SCTP should consult [RFC2196] for 5639 guidance in securing their site. 5641 11.2.1. Countering Insider Attacks 5643 The principles of [RFC2196] should be applied to minimize the risk of 5644 theft of information or sabotage by insiders. Such procedures 5645 include publication of security policies, control of access at the 5646 physical, software, and network levels, and separation of services. 5648 11.2.2. Protecting against Data Corruption in the Network 5650 Where the risk of undetected errors in datagrams delivered by the 5651 lower layer transport services is considered to be too great, 5652 additional integrity protection is required. If this additional 5653 protection were provided in the application-layer, the SCTP header 5654 would remain vulnerable to deliberate integrity attacks. While the 5655 existing SCTP mechanisms for detection of packet replays are 5656 considered sufficient for normal operation, stronger protections are 5657 needed to protect SCTP when the operating environment contains 5658 significant risk of deliberate attacks from a sophisticated 5659 adversary. 5661 The SCTP Authentication extension SCTP-AUTH 5662 [I-D.ietf-tsvwg-sctp-auth] MAY be used when the threat environment 5663 requires stronger integrity protections, but does not require 5664 confidentiality. 5666 11.2.3. Protecting Confidentiality 5668 In most cases, the risk of breach of confidentiality applies to the 5669 signaling data payload, not to the SCTP or lower-layer protocol 5670 overheads. If that is true, encryption of the SCTP user data only 5671 might be considered. As with the supplementary checksum service, 5672 user data encryption MAY be performed by the SCTP user application. 5673 Alternately, the user application MAY use an implementation-specific 5674 API to request that the IP Encapsulating Security Payload (ESP) 5675 [RFC4303] be used to provide confidentiality and integrity. 5677 Particularly for mobile users, the requirement for confidentiality 5678 might include the masking of IP addresses and ports. In this case 5679 ESP SHOULD be used instead of application-level confidentiality. If 5680 ESP is used to protect confidentiality of SCTP traffic, an ESP 5681 cryptographic transform that includes cryptographic integrity 5682 protection MUST be used, because if there is a confidentiality threat 5683 there will also be a strong integrity threat. 5685 Whenever ESP is in use, application-level encryption is not generally 5686 required. 5688 Regardless of where confidentiality is provided, the IKEv2 [RFC4306] 5689 SHOULD be used for key management. 5691 Operators should consult [RFC4301] for more information on the 5692 security services available at and immediately above the Internet 5693 Protocol layer. 5695 11.2.4. Protecting against Blind Denial of Service Attacks 5697 A blind attack is one where the attacker is unable to intercept or 5698 otherwise see the content of data flows passing to and from the 5699 target SCTP node. Blind denial of service attacks may take the form 5700 of flooding, masquerade, or improper monopolization of services. 5702 11.2.4.1. Flooding 5704 The objective of flooding is to cause loss of service and incorrect 5705 behavior at target systems through resource exhaustion, interference 5706 with legitimate transactions, and exploitation of buffer-related 5707 software bugs. Flooding may be directed either at the SCTP node or 5708 at resources in the intervening IP Access Links or the Internet. 5709 Where the latter entities are the target, flooding will manifest 5710 itself as loss of network services, including potentially the breach 5711 of any firewalls in place. 5713 In general, protection against flooding begins at the equipment 5714 design level, where it includes measures such as: 5716 - avoiding commitment of limited resources before determining that 5717 the request for service is legitimate 5719 - giving priority to completion of processing in progress over the 5720 acceptance of new work 5722 - identification and removal of duplicate or stale queued requests 5723 for service. 5725 - not responding to unexpected packets sent to non-unicast 5726 addresses. 5728 Network equipment should be capable of generating an alarm and log if 5729 a suspicious increase in traffic occurs. The log should provide 5730 information such as the identity of the incoming link and source 5731 address(es) used which will help the network or SCTP system operator 5732 to take protective measures. Procedures should be in place for the 5733 operator to act on such alarms if a clear pattern of abuse emerges. 5735 The design of SCTP is resistant to flooding attacks, particularly in 5736 its use of a four-way start-up handshake, its use of a cookie to 5737 defer commitment of resources at the responding SCTP node until the 5738 handshake is completed, and its use of a Verification Tag to prevent 5739 insertion of extraneous packets into the flow of an established 5740 association. 5742 The IP Authentication Header and Encapsulating Security Payload might 5743 be useful in reducing the risk of certain kinds of denial of service 5744 attacks. 5746 The use of the Host Name feature in the INIT chunk could be used to 5747 flood a target DNS server. A large backlog of DNS queries, resolving 5748 the Host Name received in the INIT chunk to IP addresses, could be 5749 accomplished by sending INIT's to multiple hosts in a given domain. 5750 In addition, an attacker could use the Host Name feature in an 5751 indirect attack on a third party by sending large numbers of INITs to 5752 random hosts containing the host name of the target. In addition to 5753 the strain on DNS resources, this could also result in large numbers 5754 of INIT ACKs being sent to the target. One method to protect against 5755 this type of attack is to verify that the IP addresses received from 5756 DNS include the source IP address of the original INIT. If the list 5757 of IP addresses received from DNS does not include the source IP 5758 address of the INIT, the endpoint MAY silently discard the INIT. 5759 This last option will not protect against the attack against the DNS. 5761 11.2.4.2. Blind Masquerade 5763 Masquerade can be used to deny service in several ways: 5765 - by tying up resources at the target SCTP node to which the 5766 impersonated node has limited access. For example, the target 5767 node may by policy permit a maximum of one SCTP association with 5768 the impersonated SCTP node. The masquerading attacker may attempt 5769 to establish an association purporting to come from the 5770 impersonated node so that the latter cannot do so when it requires 5771 it. 5773 - by deliberately allowing the impersonation to be detected, thereby 5774 provoking counter-measures which cause the impersonated node to be 5775 locked out of the target SCTP node. 5777 - by interfering with an established association by inserting 5778 extraneous content such as a SHUTDOWN request. 5780 SCTP reduces the risk of blind masquerade attacks through IP spoofing 5781 by use of the four-way startup handshake. Because the initial 5782 exchange is memory less, no lockout mechanism is triggered by blind 5783 masquerade attacks. In addition, the INIT ACK containing the State 5784 Cookie is transmitted back to the IP address from which it received 5785 the INIT. Thus the attacker would not receive the INIT ACK 5786 containing the State Cookie. SCTP protects against insertion of 5787 extraneous packets into the flow of an established association by use 5788 of the Verification Tag. 5790 Logging of received INIT requests and abnormalities such as 5791 unexpected INIT ACKs might be considered as a way to detect patterns 5792 of hostile activity. However, the potential usefulness of such 5793 logging must be weighed against the increased SCTP startup processing 5794 it implies, rendering the SCTP node more vulnerable to flooding 5795 attacks. Logging is pointless without the establishment of operating 5796 procedures to review and analyze the logs on a routine basis. 5798 11.2.4.3. Improper Monopolization of Services 5800 Attacks under this heading are performed openly and legitimately by 5801 the attacker. They are directed against fellow users of the target 5802 SCTP node or of the shared resources between the attacker and the 5803 target node. Possible attacks include the opening of a large number 5804 of associations between the attacker's node and the target, or 5805 transfer of large volumes of information within a legitimately- 5806 established association. 5808 Policy limits should be placed on the number of associations per 5809 adjoining SCTP node. SCTP user applications should be capable of 5810 detecting large volumes of illegitimate or "no-op" messages within a 5811 given association and either logging or terminating the association 5812 as a result, based on local policy. 5814 11.3. SCTP Interactions with Firewalls 5816 It is helpful for some firewalls if they can inspect just the first 5817 fragment of a fragmented SCTP packet and unambiguously determine 5818 whether it corresponds to an INIT chunk (for further information, 5819 please refer to [RFC1858]). Accordingly, we stress the requirements, 5820 stated in Section 3.1, that (1) an INIT chunk MUST NOT be bundled 5821 with any other chunk in a packet, and (2) a packet containing an INIT 5822 chunk MUST have a zero Verification Tag. Furthermore, we require that 5823 the receiver of an INIT chunk MUST enforce these rules by silently 5824 discarding an arriving packet with an INIT chunk that is bundled with 5825 other chunks. 5827 11.4. Protection of Non-SCTP Capable Hosts. 5829 To provide a non-SCTP capable host with the same level of protection 5830 against attacks as for SCTP-capable ones, all SCTP stacks MUST 5831 implement the ICMP handling described in Appendix C. 5833 When an SCTP stack receives a packet containing multiple control or 5834 DATA chunks and the processing of the packet requires the sending of 5835 multiple chunks in response, the sender of the response chunk(s) MUST 5836 NOT send more than one packet. If bundling is supported, multiple 5837 response chunks that fit into a single packet MAY be bundled together 5838 into one single response packet. If bundling is not supported, then 5839 the sender MUST NOT send more than one response chunk and MUST 5840 discard all other responses. Note that this rule does NOT apply to a 5841 SACK chunk, since a SACK chunk is, in itself, a response to DATA and 5842 a SACK does not require a response of more DATA. 5844 An SCTP implementation SHOULD abort the association if it receives a 5845 SACK acknowledging a TSN that has not been sent. 5847 An SCTP implementation that receives an INIT that would require a 5848 large packet in response, due to the inclusion of multiple ERROR 5849 parameters, MAY (at its discretion) elect to omit some or all of the 5850 ERROR parameters to reduce the size of the INIT-ACK. Due to a 5851 combination of the size of the COOKIE parameter and the number of 5852 addresses a receiver of an INIT may be indicating to a peer, it is 5853 always possible that the INIT-ACK will be larger than the original 5854 INIT. An SCTP implementation SHOULD attempt to make the INIT-ACK as 5855 small as possible to reduce the possibility of byte amplification 5856 attacks. 5858 12. Network Management Considerations 5860 The MIB module for SCTP defined in [RFC3873] applies for the version 5861 of the protocol specified in this document. 5863 13. Recommended Transmission Control Block (TCB) Parameters 5865 This section details a recommended set of parameters that should be 5866 contained within the TCB for an implementation. This section is for 5867 illustrative purposes and should not be deemed as requirements on an 5868 implementation or as an exhaustive list of all parameters inside an 5869 SCTP TCB. Each implementation may need its own additional parameters 5870 for optimization. 5872 13.1. Parameters necessary for the SCTP instance 5874 Associations: A list of current associations and mappings to the data 5875 consumers for each association. This may be in the 5876 form of a hash table or other implementation dependent 5877 structure. The data consumers may be process 5878 identification information such as file descriptors, 5879 named pipe pointer, or table pointers dependent on how 5880 SCTP is implemented. 5882 Secret Key: A secret key used by this endpoint to compute the MAC. 5883 This SHOULD be a cryptographic quality random number 5884 with a sufficient length. Discussion in RFC4086 can 5885 be helpful in selection of the key. 5887 Address List: The list of IP addresses that this instance has bound. 5888 This information is passed to one's peer(s) in INIT and 5889 INIT ACK chunks. 5891 SCTP Port: The local SCTP port number the endpoint is bound to. 5893 13.2. Parameters necessary per association (i.e. the TCB) 5895 Peer : Tag value to be sent in every packet and is received 5896 Verification: in the INIT or INIT ACK chunk. 5897 Tag : 5899 My : Tag expected in every inbound packet and sent in the 5900 Verification: INIT or INIT ACK chunk. 5901 Tag : 5903 State : A state variable indicating what state the association 5904 : is in, i.e. COOKIE-WAIT, COOKIE-ECHOED, ESTABLISHED, 5905 : SHUTDOWN-PENDING, SHUTDOWN-SENT, SHUTDOWN-RECEIVED, 5906 : SHUTDOWN-ACK-SENT. 5908 Note: No "CLOSED" state is illustrated since if a 5909 association is "CLOSED" its TCB SHOULD be removed. 5911 Peer : A list of SCTP transport addresses that the peer is 5912 Transport : bound to. This information is derived from the INIT or 5913 Address : INIT ACK and is used to associate an inbound packet 5914 List : with a given association. Normally this information is 5915 : hashed or keyed for quick lookup and access of the TCB. 5917 Primary : This is the current primary destination transport 5918 Path : address of the peer endpoint. It may also specify a 5919 : source transport address on this endpoint. 5921 Overall : The overall association error count. 5922 Error Count : 5924 Overall : The threshold for this association that if the Overall 5925 Error : Error Count reaches will cause this association to be 5926 Threshold : torn down. 5928 Peer Rwnd : Current calculated value of the peer's rwnd. 5930 Next TSN : The next TSN number to be assigned to a new DATA chunk. 5931 : This is sent in the INIT or INIT ACK chunk to the peer 5932 : and incremented each time a DATA chunk is assigned a 5933 : TSN (normally just prior to transmit or during 5934 : fragmentation). 5936 Last Rcvd : This is the last TSN received in sequence. This value 5937 TSN : is set initially by taking the peer's Initial TSN, 5938 : received in the INIT or INIT ACK chunk, and 5939 : subtracting one from it. 5941 Mapping : An array of bits or bytes indicating which out of 5942 Array : order TSN's have been received (relative to the 5943 : Last Rcvd TSN). If no gaps exist, i.e. no out of order 5944 : packets have been received, this array will be set to 5945 : all zero. This structure may be in the form of a 5946 : circular buffer or bit array. 5948 Ack State : This flag indicates if the next received packet 5949 : is to be responded to with a SACK. This is initialized 5950 : to 0. When a packet is received it is incremented. 5951 : If this value reaches 2 or more, a SACK is sent and the 5952 : value is reset to 0. Note: This is used only when no 5953 : DATA chunks are received out of order.When DATA chunks 5954 : are out of order, SACK's are not delayed (see Section 5955 : 6). 5957 Inbound : An array of structures to track the inbound streams. 5958 Streams : Normally including the next sequence number expected 5959 : and possibly the stream number. 5961 Outbound : An array of structures to track the outbound streams. 5962 Streams : Normally including the next sequence number to 5963 : be sent on the stream. 5965 Reasm Queue : A re-assembly queue. 5967 Local : The list of local IP addresses bound in to this 5968 Transport : association. 5970 Address : 5971 List : 5973 Association : The smallest PMTU discovered for all of the 5974 PMTU : peer's transport addresses. 5976 13.3. Per Transport Address Data 5978 For each destination transport address in the peer's address list 5979 derived from the INIT or INIT ACK chunk, a number of data elements 5980 needs to be maintained including: 5982 Error count : The current error count for this destination. 5984 Error : Current error threshold for this destination i.e. 5985 Threshold : what value marks the destination down if Error count 5986 : reaches this value. 5988 cwnd : The current congestion window. 5990 ssthresh : The current ssthresh value. 5992 RTO : The current retransmission timeout value. 5994 SRTT : The current smoothed round trip time. 5996 RTTVAR : The current RTT variation. 5998 partial : The tracking method for increase of cwnd when in 5999 bytes acked : congestion avoidance mode (see Section 7.2.2) 6001 state : The current state of this destination, i.e. DOWN, UP, 6002 : ALLOW-HB, NO-HEARTBEAT, etc. 6004 PMTU : The current known path MTU. 6006 Per : A timer used by each destination. 6007 Destination : 6008 Timer : 6010 RTO-Pending : A flag used to track if one of the DATA chunks sent to 6011 this address is currently being used to compute a 6012 RTT. If this flag is 0, the next DATA chunk sent to 6013 this destination should be used to compute a RTT and 6014 this flag should be set. Every time the RTT 6015 calculation completes (i.e. the DATA chunk is SACK'd) 6016 clear this flag. 6018 last-time : The time this destination was last sent to. This can be 6019 used : used to determine if a HEARTBEAT is needed. 6021 13.4. General Parameters Needed 6023 Out Queue : A queue of outbound DATA chunks. 6025 In Queue : A queue of inbound DATA chunks. 6027 14. IANA Considerations 6029 This protocol will require port reservation like TCP for the use of 6030 "well known" servers within the Internet. All current TCP ports 6031 shall be automatically reserved in the SCTP port address space. New 6032 requests should follow IANA's current mechanisms for TCP. 6034 This protocol may also be extended through IANA in three ways: 6036 -- through definition of additional chunk types, 6037 -- through definition of additional parameter types, or 6038 -- through definition of additional cause codes within ERROR chunks 6040 In the case where a particular ULP using SCTP desires to have its own 6041 ports, the ULP should be responsible for registering with IANA for 6042 getting its ports assigned. 6044 14.1. IETF-defined Chunk Extension 6046 The assignment of new chunk parameter type codes is done through an 6047 IETF Consensus action, as defined in [RFC2434]. Documentation of the 6048 chunk parameter MUST contain the following information: 6050 a) A long and short name for the new chunk type; 6052 b) A detailed description of the structure of the chunk, which MUST 6053 conform to the basic structure defined in Section 3.2; 6055 c) A detailed definition and description of intended use of each 6056 field within the chunk, including the chunk flags if any; 6058 d) A detailed procedural description of the use of the new chunk type 6059 within the operation of the protocol. 6061 The last chunk type (255) is reserved for future extension if 6062 necessary. 6064 14.2. IETF-defined Chunk Parameter Extension 6066 The assignment of new chunk parameter type codes is done through an 6067 IETF Consensus action as defined in [RFC2434]. Documentation of the 6068 chunk parameter MUST contain the following information: 6070 a) Name of the parameter type. 6072 b) Detailed description of the structure of the parameter field. 6073 This structure MUST conform to the general type-length-value 6074 format described in Section 3.2.1. 6076 c) Detailed definition of each component of the parameter value. 6078 d) Detailed description of the intended use of this parameter type, 6079 and an indication of whether and under what circumstances multiple 6080 instances of this parameter type may be found within the same 6081 chunk. 6082 e) Each parameter type MUST be unique across all chunks. 6084 14.3. IETF-defined Additional Error Causes 6086 Additional cause codes may be allocated in the range 11 to 65535 6087 through a Specification Required action as defined in [RFC2434]. 6088 Provided documentation must include the following information: 6090 a) Name of the error condition. 6092 b) Detailed description of the conditions under which an SCTP 6093 endpoint should issue an ERROR (or ABORT) with this cause code. 6095 c) Expected action by the SCTP endpoint which receives an ERROR (or 6096 ABORT) chunk containing this cause code. 6098 d) Detailed description of the structure and content of data fields 6099 which accompany this cause code. 6101 The initial word (32 bits) of a cause code parameter MUST conform to 6102 the format shown in Section 3.3.10, i.e.: 6104 -- first two bytes contain the cause code value 6105 -- last two bytes contain length of the Cause Parameter. 6107 14.4. Payload Protocol Identifiers 6109 Except for value 0 which is reserved by SCTP to indicate an 6110 unspecified payload protocol identifier in a DATA chunk, SCTP will 6111 not be responsible for standardizing or verifying any payload 6112 protocol identifiers; SCTP simply receives the identifier from the 6113 upper layer and carries it with the corresponding payload data. 6115 The upper layer, i.e., the SCTP user, SHOULD standardize any specific 6116 protocol identifier with IANA if it is so desired. The use of any 6117 specific payload protocol identifier is out of the scope of SCTP. 6119 15. Suggested SCTP Protocol Parameter Values 6121 The following protocol parameters are RECOMMENDED: 6123 RTO.Initial - 3 seconds 6124 RTO.Min - 1 second 6125 RTO.Max - 60 seconds 6126 Max.Burst - 4 6127 RTO.Alpha - 1/8 6128 RTO.Beta - 1/4 6129 Valid.Cookie.Life - 60 seconds 6130 Association.Max.Retrans - 10 attempts 6131 Path.Max.Retrans - 5 attempts (per destination address) 6132 Max.Init.Retransmits - 8 attempts 6133 HB.interval - 30 seconds 6134 HB.Max.Burst - 1 6136 IMPLEMENTATION NOTE: The SCTP implementation may allow ULP to 6137 customize some of these protocol parameters (see Section 10). 6139 Note: RTO.Min SHOULD be set as recommended above. 6141 16. Acknowledgements 6143 An undertaking represented by this updated document is not a small 6144 feat and represents the summation of the initial authors of RFC2960, 6146 Q. Xie, K. Morneault, C. Sharp, H. Schwarzbauer T. Taylor, I. Rytina, 6147 M. Kalla, L. Zhang, V. Paxson , 6149 add to that the comments from every one that contributed to the 6150 original RFC: 6152 Mark Allman, R.J. Atkinson, Richard Band, Scott Bradner, Steve 6153 Bellovin, Peter Butler, Ram Dantu, R. Ezhirpavai, Mike Fisk, Sally 6154 Floyd, Atsushi Fukumoto, Matt Holdrege, Henry Houh, Christian 6155 Huitema, Gary Lehecka, Jonathan Lee, David Lehmann, John Loughney, 6156 Daniel Luan, Barry Nagelberg, Thomas Narten, Erik Nordmark, Lyndon 6157 Ong, Shyamal Prasad, Kelvin Porter, Heinz Prantner, Jarno Rajahalme, 6158 Raymond E. Reeves, Renee Revis, Ivan Arias Rodriguez, A. Sankar, Greg 6159 Sidebottom, Brian Wyld, La Monte Yarroll, and many others for their 6160 invaluable comments. 6162 then add the authors of the SCTP implementors guide, I. Arias- 6163 Rodriguez, K. Poon, A. Caro, M. Tuexen, 6165 Add to these the efforts of all the subsequent seven SCTP 6166 interoperability tests and those who commented on the RFC4460 as 6167 shown in its acknowledgments: 6169 Barry Zuckerman, La Monte Yarroll, Qiaobing Xie, Wang Xiaopeng, 6170 Jonathan Wood, Jeff Waskow, Mike Turner, John Townsend, Sabina 6171 Torrente, Cliff Thomas, Yuji Suzuki, Manoj Solanki, Sverre Slotte, 6172 Keyur Shah, Jan Rovins, Ben Robinson, Renee Revis, Ian Periam, RC 6173 Monee, Sanjay Rao, Sujith Radhakrishnan, Heinz Prantner, Biren Patel, 6174 Nathalie Mouellic, Mitch Miers, Bernward Meyknecht, Stan McClellan, 6175 Oliver Mayor, Tomas Orti Martin, Sandeep Mahajan, David Lehmann, 6176 Jonathan Lee, Philippe Langlois, Karl Knutson, Joe Keller, Gareth 6177 Keily, Andreas Jungmaier, Janardhan Iyengar, Mutsuya Irie, John 6178 Hebert, Kausar Hassan, Fred Hasle, Dan Harrison, Jon Grim, Laurent 6179 Glaude, Steven Furniss, Atsushi Fukumoto, Ken Fujita, Steve Dimig, 6180 Thomas Curran, Serkan Cil, Melissa Campbell, Peter Butler, Rob 6181 Brennan, Harsh Bhondwe, Brian Bidulock, Caitlin Bestler, Jon Berger, 6182 Robby Benedyk, Stephen Baucke, Sandeep Balani, and Ronnie Sellar. 6184 A special thanks to Mark Allman, who should actually be a co-author 6185 for his work on the max-burst, but managed to wiggle out due to a 6186 technicality. Also, we would like to acknowledge Lyndon Ong and Phil 6187 Conrad for their valuable input and many contributions. 6189 And finally you have this document, and those that have commented 6190 upon that including, Alfred Hines and Ronnie Sellars. 6192 My thanks cannot be adequately expressed for all of you who have 6193 participated in the coding, testing and updating process of this 6194 document all I can say is Thank You! 6196 Randall Stewart - Editor 6198 Appendix A. Explicit Congestion Notification 6200 ECN (Ramakrishnan, K., Floyd, S., "Explicit Congestion Notification", 6201 [RFC3168], January 1999) describes a proposed extension to IP that 6202 details a method to become aware of congestion outside of datagram 6203 loss. This is an optional feature that an implementation MAY choose 6204 to add to SCTP. This appendix details the minor differences 6205 implementers will need to be aware of if they choose to implement 6206 this feature. In general [RFC3168] should be followed with the 6207 following exceptions. 6209 Negotiation: 6211 [RFC3168] details negotiation of ECN during the SYN and SYN-ACK 6212 stages of a TCP connection. The sender of the SYN sets two bits in 6213 the TCP flags, and the sender of the SYN-ACK sets only 1 bit. The 6214 reasoning behind this is to assure both sides are truly ECN capable. 6215 For SCTP this is not necessary. To indicate that an endpoint is ECN 6216 capable an endpoint SHOULD add to the INIT and or INIT ACK chunk the 6217 TLV reserved for ECN. This TLV contains no parameters, and thus has 6218 the following format: 6220 0 1 2 3 6221 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 6222 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6223 | Parameter Type = 32768 | Parameter Length = 4 | 6224 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6226 ECN-Echo: 6228 [RFC3168] details a specific bit for a receiver to send back in its 6229 TCP acknowledgements to notify the sender of the Congestion 6230 Experienced (CE) bit having arrived from the network. For SCTP this 6231 same indication is made by including the ECNE chunk. This chunk 6232 contains one data element, i.e. the lowest TSN associated with the IP 6233 datagram marked with the CE bit, and looks as follows: 6235 0 1 2 3 6236 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 6237 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6238 | Chunk Type=12 | Flags=00000000| Chunk Length = 8 | 6239 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6240 | Lowest TSN Number | 6241 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6243 Note: The ECNE is considered a Control chunk. 6245 CWR: 6247 [RFC3168] details a specific bit for a sender to send in the header 6248 of its next outbound TCP segment to indicate to its peer that it has 6249 reduced its congestion window. This is termed the CWR bit. For SCTP 6250 the same indication is made by including the CWR chunk. This chunk 6251 contains one data element, i.e. the TSN number that was sent in the 6252 ECNE chunk. This element represents the lowest TSN number in the 6253 datagram that was originally marked with the CE bit. 6255 0 1 2 3 6256 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 6257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6258 | Chunk Type=13 | Flags=00000000| Chunk Length = 8 | 6259 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6260 | Lowest TSN Number | 6261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 6263 Note: The CWR is considered a Control chunk. 6265 Appendix B. CRC32c Checksum Calculation 6267 We define a 'reflected value' as one that is the opposite of the 6268 normal bit order of the machine. The 32-bit CRC is calculated as 6269 described for CRC-32c and uses the polynomial code 0x11EDC6F41 6270 (Castagnoli93) or x^32+x^28+x^27+x^26+x^25 +x^23+x^22+x^20+x^19+x^18+ 6271 x^14+x^13+x^11+x^10+x^9+x^8+x^6+x^0. The CRC is computed using a 6272 procedure similar to ETHERNET CRC [ITU32], modified to reflect 6273 transport level usage. 6275 CRC computation uses polynomial division. A message bit-string M is 6276 transformed to a polynomial, M(X), and the CRC is calculated from 6277 M(X) using polynomial arithmetic. 6279 When CRCs are used at the link layer, the polynomial is derived from 6280 on-the-wire bit ordering: the first bit 'on the wire' is the high- 6281 order coefficient. Since SCTP is a transport-level protocol, it 6282 cannot know the actual serial-media bit ordering. Moreover, 6283 different links in the path between SCTP endpoints may use different 6284 link-level bit orders. 6286 A convention must therefore be established for mapping SCTP transport 6287 messages to polynomials for purposes of CRC computation. The bit- 6288 ordering for mapping SCTP messages to polynomials is that bytes are 6289 taken most-significant first; but within each byte, bits are taken 6290 least-significant first. The first byte of the message provides the 6291 eight highest coefficients. Within each byte, the least-significant 6292 SCTP bit gives the most significant polynomial coefficient within 6293 that byte, and the most-significant SCTP bit is the least significant 6294 polynomial coefficient in that byte. (This bit ordering is sometimes 6295 called 'mirrored' or 'reflected' [WILLIAMS93]) CRC polynomials are to 6296 be transformed back into SCTP transport-level byte values, using a 6297 consistent mapping. 6299 The SCTP transport-level CRC value should be calculated as follows: 6301 - CRC input data are assigned to a byte stream, numbered from 0 to 6302 N-1. 6303 - The transport-level byte-stream is mapped to a polynomial value. 6304 An N-byte PDU with j bytes numbered 0 to N-1 is considered as 6305 coefficients of a polynomial M(x) of order 8N-1, with bit 0 of 6306 byte j being coefficient x^(8(N-j)-8), and bit 7 of byte j being 6307 coefficient x^(8(N-j)-1). 6308 - The CRC remainder register is initialized with all 1s and the CRC 6309 is computed with an algorithm that simultaneously multiplies by 6310 x^32 and divides by the CRC polynomial. 6311 - The polynomial is multiplied by x^32 and divided by G(x), the 6312 generator polynomial, producing a remainder R(x) of degree less 6313 than or equal to 31. 6314 - The coefficients of R(x) are considered a 32-bit sequence. 6315 - The bit sequence is complemented. The result is the CRC 6316 polynomial. 6317 - The CRC polynomial is mapped back into SCTP transport-level bytes. 6318 The coefficient of x^31 gives the value of bit 7 of SCTP byte 0, 6319 and the coefficient of x^24 gives the value of bit 0 of byte 0. 6320 The coefficient of x^7 gives bit 7 of byte 3, and the coefficient 6321 of x^0 gives bit 0 of byte 3. The resulting four-byte transport- 6322 level sequence is the 32-bit SCTP checksum value. 6324 IMPLEMENTATION NOTE: Standards documents, textbooks, and vendor 6325 literature on CRCs often follow an alternative formulation, in which 6326 the register used to hold the remainder of the long-division 6327 algorithm is initialized to zero rather than all-1s, and instead the 6328 first 32 bits of the message are complemented. The long-division 6329 algorithm used in our formulation is specified such that the initial 6330 multiplication by 2^32 and the long-division are combined into one 6331 simultaneous operation. For such algorithms, and for messages longer 6332 than 64 bits, the two specifications are precisely equivalent. That 6333 equivalence is the intent of this document. 6335 Implementors of SCTP are warned that both specifications are to be 6336 found in the literature, sometimes with no restriction on the long- 6337 division algorithm. The choice of formulation in this document is to 6338 permit non-SCTP usage, where the same CRC algorithm may be used to 6339 protect messages shorter than 64 bits. 6341 There may be a computational advantage in validating the Association 6342 against the Verification Tag, prior to performing a checksum, as 6343 invalid tags will result in the same action as a bad checksum in most 6344 cases. The exceptions for this technique would be INIT and some 6345 SHUTDOWN-COMPLETE exchanges, as well as a stale COOKIE-ECHO. These 6346 special case exchanges must represent small packets and will minimize 6347 the effect of the checksum calculation. 6349 Appendix C. ICMP Handling 6351 Whenever an ICMP message is received by an SCTP endpoint the 6352 following procedures MUST be followed to ensure proper utilization of 6353 the information being provided by layer 3. 6354 ICMP1) An implementation MAY ignore all ICMPv4 messages where the 6355 type field is not set to "Destination Unreachable". 6356 ICMP2) An implementation MAY ignore all ICMPv6 messages where the 6357 type field is not "Destination Unreachable, "Parameter Problem" or 6358 "Packet Too Big". 6359 ICMP3) An implementation MAY ignore any ICMPv4 messages where the 6360 code does not indicate "Protocol Unreachable" or "Fragmentation 6361 Needed". 6362 ICMP4) An implementation MAY ignore all ICMPv6 messages of type 6363 "Parameter Problem" if the code is not "Unrecognized next header 6364 type encountered". 6365 ICMP5) An implementation MUST use the payload of the ICMP message 6366 (V4 or V6) to locate the association that sent the message that 6367 ICMP is responding to. If the association cannot be found, an 6368 implementation SHOULD ignore the ICMP message. 6369 ICMP6) An implementation MUST validate that the Verification Tag 6370 contained in the ICMP message matches the verification tag of the 6371 peer. If the Verification Tag is not 0 and does NOT match, 6372 discard the ICMP message. If it is 0 and the ICMP message 6373 contains enough bytes to verify that the chunk type is an INIT 6374 chunk and that the initiate tag matches the tag of the peer, 6375 continue with ICMP7. If the ICMP message is too short or the 6376 chunk type or the initiate tag does not match, silently discard 6377 the packet. 6378 ICMP7) If the ICMP message is either a V6 "Packet Too Big" or a V4 6379 "Fragmentation Needed", an implementation MAY process this 6380 information as defined for PATH MTU discovery. 6381 ICMP8) If the ICMP code is a "Unrecognized next header type 6382 encountered" or a "Protocol Unreachable", an implementation MUST 6383 treat this message as an abort with the T bit set if it does not 6384 contain an INIT chunk. If it does contain an INIT chunk and the 6385 association is in COOKIE-WAIT state, handle the ICMP message like 6386 an ABORT. 6387 ICMP9) If the ICMPv6 code is "Destination Unreachable", the 6388 implementation MAY mark the destination into the unreachable state 6389 or alternatively increment the path error counter. 6391 Note that these procedures differ from [RFC1122] and from its 6392 requirements for processing of port-unreachable messages and the 6393 requirements that an implementation MUST abort associations in 6394 response to a "protocol unreachable" message. Port unreachable 6395 messages are not processed, since an implementation will send an 6396 ABORT, not a port unreachable. The stricter handling of the 6397 "protocol unreachable" message is due to security concerns for hosts 6398 that do NOT support SCTP. 6400 The following non-normative sample code is taken from an open-source 6401 CRC generator [WILLIAMS93], using the "mirroring" technique and 6402 yielding a lookup table for SCTP CRC32-c with 256 entries, each 32 6403 bits wide. While neither especially slow nor especially fast, as 6404 software table-lookup CRCs go, it has the advantage of working on 6405 both big-endian and little-endian CPUs, using the same (host-order) 6406 lookup tables, and using only the pre-defined ntohl() and htonl() 6407 operations. The code is somewhat modified from [WILLIAMS93], to 6408 ensure portability between big-endian and little-endian 6409 architectures. (Note that if the byte endian-ness of the target 6410 architecture is known to be little-endian the final bit-reversal and 6411 byte-reversal steps can be folded into a single operation.) 6413 /*************************************************************/ 6414 /* Note Definition for Ross Williams table generator would */ 6415 /* be: TB_WIDTH=4, TB_POLLY=0x1EDC6F41, TB_REVER=TRUE */ 6416 /* For Mr. Williams direct calculation code use the settings */ 6417 /* cm_width=32, cm_poly=0x1EDC6F41, cm_init=0xFFFFFFFF, */ 6418 /* cm_refin=TRUE, cm_refot=TRUE, cm_xorort=0x00000000 */ 6419 /*************************************************************/ 6421 /* Example of the crc table file */ 6422 #ifndef __crc32cr_table_h__ 6423 #define __crc32cr_table_h__ 6425 #define CRC32C_POLY 0x1EDC6F41 6426 #define CRC32C(c,d) (c=(c>>8)^crc_c[(c^(d))&0xFF]) 6428 unsigned long crc_c[256] = 6429 { 6430 0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, 6431 0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, 6432 0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL, 6433 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L, 6434 0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL, 6435 0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L, 6436 0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L, 6437 0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL, 6438 0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL, 6439 0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L, 6440 0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L, 6441 0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL, 6442 0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L, 6443 0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL, 6444 0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL, 6445 0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L, 6446 0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L, 6447 0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L, 6448 0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L, 6449 0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L, 6450 0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L, 6451 0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L, 6452 0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L, 6453 0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L, 6454 0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L, 6455 0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L, 6456 0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L, 6457 0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L, 6458 0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L, 6459 0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L, 6460 0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L, 6461 0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L, 6462 0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL, 6463 0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L, 6464 0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L, 6465 0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL, 6466 0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L, 6467 0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL, 6468 0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL, 6469 0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L, 6470 0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L, 6471 0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL, 6472 0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL, 6473 0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L, 6474 0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL, 6475 0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L, 6476 0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L, 6477 0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL, 6478 0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L, 6479 0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL, 6480 0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL, 6481 0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L, 6482 0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL, 6483 0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L, 6484 0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L, 6485 0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL, 6486 0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL, 6487 0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L, 6488 0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L, 6489 0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL, 6490 0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L, 6491 0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL, 6492 0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL, 6493 0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L, 6494 }; 6496 #endif 6498 /* Example of table build routine */ 6500 #include 6501 #include 6503 #define OUTPUT_FILE "crc32cr.h" 6504 #define CRC32C_POLY 0x1EDC6F41L 6505 FILE *tf; 6506 unsigned long 6507 reflect_32 (unsigned long b) 6508 { 6509 int i; 6510 unsigned long rw = 0L; 6512 for (i = 0; i < 32; i++){ 6513 if (b & 1) 6514 rw |= 1 << (31 - i); 6515 b >>= 1; 6516 } 6517 return (rw); 6518 } 6520 unsigned long 6521 build_crc_table (int index) 6522 { 6523 int i; 6524 unsigned long rb; 6526 rb = reflect_32 (index); 6528 for (i = 0; i < 8; i++){ 6529 if (rb & 0x80000000L) 6530 rb = (rb << 1) ^ CRC32C_POLY; 6531 else 6532 rb <<= 1; 6533 } 6534 return (reflect_32 (rb)); 6535 } 6536 main () 6537 { 6538 int i; 6540 printf ("\nGenerating CRC-32c table file <%s>\n", 6541 OUTPUT_FILE); 6542 if ((tf = fopen (OUTPUT_FILE, "w")) == NULL){ 6543 printf ("Unable to open %s\n", OUTPUT_FILE); 6544 exit (1); 6545 } 6546 fprintf (tf, "#ifndef __crc32cr_table_h__\n"); 6547 fprintf (tf, "#define __crc32cr_table_h__\n\n"); 6548 fprintf (tf, "#define CRC32C_POLY 0x%08lX\n", 6549 CRC32C_POLY); 6550 fprintf (tf, 6551 "#define CRC32C(c,d) (c=(c>>8)^crc_c[(c^(d))&0xFF])\n"); 6552 fprintf (tf, "\nunsigned long crc_c[256] =\n{\n"); 6553 for (i = 0; i < 256; i++){ 6554 fprintf (tf, "0x%08lXL, ", build_crc_table (i)); 6555 if ((i & 3) == 3) 6556 fprintf (tf, "\n"); 6557 } 6558 fprintf (tf, "};\n\n#endif\n"); 6560 if (fclose (tf) != 0) 6561 printf ("Unable to close <%s>." OUTPUT_FILE); 6562 else 6563 printf ("\nThe CRC-32c table has been written to <%s>.\n", 6564 OUTPUT_FILE); 6565 } 6567 /* Example of crc insertion */ 6569 #include "crc32cr.h" 6571 unsigned long 6572 generate_crc32c(unsigned char *buffer, unsigned int length) 6573 { 6574 unsigned int i; 6575 unsigned long crc32 = ~0L; 6576 unsigned long result; 6577 unsigned char byte0,byte1,byte2,byte3; 6579 for (i = 0; i < length; i++){ 6580 CRC32C(crc32, buffer[i]); 6581 } 6582 result = ~crc32; 6584 /* result now holds the negated polynomial remainder; 6585 * since the table and algorithm is "reflected" [williams95]. 6586 * That is, result has the same value as if we mapped the message 6587 * to a polynomial, computed the host-bit-order polynomial 6588 * remainder, performed final negation, then did an end-for-end 6589 * bit-reversal. 6590 * Note that a 32-bit bit-reversal is identical to four inplace 6591 * 8-bit reversals followed by an end-for-end byteswap. 6592 * In other words, the bytes of each bit are in the right order, 6593 * but the bytes have been byteswapped. So we now do an explicit 6594 * byteswap. On a little-endian machine, this byteswap and 6595 * the final ntohl cancel out and could be elided. 6596 */ 6598 byte0 = result & 0xff; 6599 byte1 = (result>>8) & 0xff; 6600 byte2 = (result>>16) & 0xff; 6601 byte3 = (result>>24) & 0xff; 6602 crc32 = ((byte0 << 24) | 6603 (byte1 << 16) | 6604 (byte2 << 8) | 6605 byte3); 6606 return ( crc32 ); 6607 } 6609 int 6610 insert_crc32(unsigned char *buffer, unsigned int length) 6611 { 6612 SCTP_message *message; 6613 unsigned long crc32; 6614 message = (SCTP_message *) buffer; 6615 message->common_header.checksum = 0L; 6616 crc32 = generate_crc32c(buffer,length); 6617 /* and insert it into the message */ 6618 message->common_header.checksum = htonl(crc32); 6619 return 1; 6620 } 6622 int 6623 validate_crc32(unsigned char *buffer, unsigned int length) 6624 { 6625 SCTP_message *message; 6626 unsigned int i; 6627 unsigned long original_crc32; 6628 unsigned long crc32 = ~0L; 6629 /* save and zero checksum */ 6630 message = (SCTP_message *) buffer; 6631 original_crc32 = ntohl(message->common_header.checksum); 6632 message->common_header.checksum = 0L; 6633 crc32 = generate_crc32c(buffer,length); 6634 return ((original_crc32 == crc32)? 1 : -1); 6635 } 6637 17. References 6639 17.1. Normative references 6641 [ITU32] "ITU-T Recommendation V.42, "Error-correcting procedures 6642 for DCEs using asynchronous-to-synchronous conversion".", 6643 ITU-T section 8.1.1.6.2. 6645 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 6646 August 1980. 6648 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 6649 RFC 793, September 1981. 6651 [RFC1122] Braden, R., "Requirements for Internet Hosts - 6652 Communication Layers", STD 3, RFC 1122, October 1989. 6654 [RFC1123] Braden, R., "Requirements for Internet Hosts - Application 6655 and Support", STD 3, RFC 1123, October 1989. 6657 [RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, 6658 November 1990. 6660 [RFC1981] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery 6661 for IP version 6", RFC 1981, August 1996. 6663 [RFC1982] Elz, R. and R. Bush, "Serial Number Arithmetic", RFC 1982, 6664 August 1996. 6666 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6667 Requirement Levels", BCP 14, RFC 2119, March 1997. 6669 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 6670 IANA Considerations Section in RFCs", BCP 26, RFC 2434, 6671 October 1998. 6673 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 6674 (IPv6) Specification", RFC 2460, December 1998. 6676 [RFC2581] Allman, M., Paxson, V., and W. Stevens, "TCP Congestion 6677 Control", RFC 2581, April 1999. 6679 [RFC3873] Pastor, J. and M. Belinchon, "Stream Control Transmission 6680 Protocol (SCTP) Management Information Base (MIB)", 6681 RFC 3873, September 2004. 6683 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 6684 Architecture", RFC 4291, February 2006. 6686 [RFC4301] Kent, S. and K. Seo, "Security Architecture for the 6687 Internet Protocol", RFC 4301, December 2005. 6689 [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, 6690 December 2005. 6692 [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", 6693 RFC 4303, December 2005. 6695 [RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol", 6696 RFC 4306, December 2005. 6698 [RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 6699 Discovery", RFC 4821, March 2007. 6701 17.2. Informative References 6703 [FALL96] Fall, K. and S. Floyd, "Simulation-based Comparisons of 6704 Tahoe, Reno, and SACK TCP", SIGCOMM'99 V. 26 N. 3 pp 5-21, 6705 July 1996. 6707 [SAVAGE99] 6708 Savage, S., Cardwell, N., Wetherall, D., and T. Anderson, 6709 "TCP Congestion Control with a Misbehaving Receiver", ACM 6710 Computer Communications Review 29(5), October 1999. 6712 [ALLMAN99] 6713 Allman, M. and V. Paxson, "On Estimating End-to-End 6714 Network Path Properties", SIGCOMM'99 , 1999. 6716 [WILLIAMS93] 6717 Williams, R., "A PAINLESS GUIDE TO CRC ERROR DETECTION 6718 ALGORITHMS" - Internet publication http:// 6719 www.geocities.com/SiliconValley/Pines/8659/crc.htm.", 6720 August 1993. 6722 [RFC0813] Clark, D., "Window and Acknowledgement Strategy in TCP", 6723 RFC 813, July 1982. 6725 [RFC1858] Ziemba, G., Reed, D., and P. Traina, "Security 6726 Considerations for IP Fragment Filtering", RFC 1858, 6727 October 1995. 6729 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 6730 Hashing for Message Authentication", RFC 2104, 6731 February 1997. 6733 [RFC2196] Fraser, B., "Site Security Handbook", RFC 2196, 6734 September 1997. 6736 [RFC2367] McDonald, D., Metz, C., and B. Phan, "PF_KEY Key 6737 Management API, Version 2", RFC 2367, July 1998. 6739 [RFC2522] Karn, P. and W. Simpson, "Photuris: Session-Key Management 6740 Protocol", RFC 2522, March 1999. 6742 [RFC2960] Stewart, R., Xie, Q., Morneault, K., Sharp, C., 6743 Schwarzbauer, H., Taylor, T., Rytina, I., Kalla, M., 6744 Zhang, L., and V. Paxson, "Stream Control Transmission 6745 Protocol", RFC 2960, October 2000. 6747 [RFC3309] Stone, J., Stewart, R., and D. Otis, "Stream Control 6748 Transmission Protocol (SCTP) Checksum Change", RFC 3309, 6749 September 2002. 6751 [RFC3168] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition 6752 of Explicit Congestion Notification (ECN) to IP", 6753 RFC 3168, September 2001. 6755 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6756 Requirements for Security", BCP 106, RFC 4086, June 2005. 6758 [RFC4460] Stewart, R., Arias-Rodriguez, I., Poon, K., Caro, A., and 6759 M. Tuexen, "Stream Control Transmission Protocol (SCTP) 6760 Specification Errata and Issues", RFC 4460, April 2006. 6762 [I-D.ietf-tsvwg-sctp-auth] 6763 Tuexen, M., "Authenticated Chunks for Stream Control 6764 Transmission Protocol (SCTP)", 6765 draft-ietf-tsvwg-sctp-auth-08 (work in progress), 6766 February 2007. 6768 Author's Address 6770 Randall R. Stewart 6771 Editor 6772 4875 Forest Drive 6773 Suite 200 6774 Columbia, SC 29206 6775 US 6777 Email: rrs@cisco.com 6779 Full Copyright Statement 6781 Copyright (C) The IETF Trust (2007). 6783 This document is subject to the rights, licenses and restrictions 6784 contained in BCP 78, and except as set forth therein, the authors 6785 retain all their rights. 6787 This document and the information contained herein are provided on an 6788 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 6789 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 6790 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 6791 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 6792 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 6793 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 6795 Intellectual Property 6797 The IETF takes no position regarding the validity or scope of any 6798 Intellectual Property Rights or other rights that might be claimed to 6799 pertain to the implementation or use of the technology described in 6800 this document or the extent to which any license under such rights 6801 might or might not be available; nor does it represent that it has 6802 made any independent effort to identify any such rights. Information 6803 on the procedures with respect to rights in RFC documents can be 6804 found in BCP 78 and BCP 79. 6806 Copies of IPR disclosures made to the IETF Secretariat and any 6807 assurances of licenses to be made available, or the result of an 6808 attempt made to obtain a general license or permission for the use of 6809 such proprietary rights by implementers or users of this 6810 specification can be obtained from the IETF on-line IPR repository at 6811 http://www.ietf.org/ipr. 6813 The IETF invites any interested party to bring to its attention any 6814 copyrights, patents or patent applications, or other proprietary 6815 rights that may cover technology that may be required to implement 6816 this standard. Please address the information to the IETF at 6817 ietf-ipr@ietf.org. 6819 Acknowledgment 6821 Funding for the RFC Editor function is provided by the IETF 6822 Administrative Support Activity (IASA).