9. Termination of Association
SCTP provides two mechanisms for association termination: graceful shutdown and forced abort.
9.1. Abort of an Association
The ABORT chunk is used to immediately terminate an association. This is an abnormal termination with no guarantee of data delivery.
9.1.1. Sending ABORT
An endpoint MAY send an ABORT chunk in the following situations:
- Protocol violation detected
- Unrecoverable error received
- Application layer requests immediate termination
- Resource exhaustion
ABORT Chunk Format:
ABORT chunk contains:
- Chunk Type = 6
- T bit: Indicates Verification Tag usage
- Error Causes (optional): Describes abort reason
9.1.2. Receiving ABORT
Upon receiving an ABORT chunk, an endpoint MUST:
1. Stop sending any new data to the association
2. Discard all unsent and unacknowledged data
3. Report association abort to upper layer
4. Destroy the TCB
5. Send no response
Important: ABORT is unidirectional; the receiver MUST NOT send any response.
9.1.3. ABORT Causes
Common ABORT causes include:
| Cause Code | Name | Description |
|---|---|---|
| 1 | Invalid Stream Identifier | Invalid stream identifier |
| 2 | Missing Mandatory Parameter | Missing mandatory parameter |
| 3 | Stale Cookie Error | Stale cookie |
| 4 | Out of Resource | Resource shortage |
| 5 | Unresolvable Address | Unresolvable address |
| 6 | Unrecognized Chunk Type | Unrecognized chunk type |
| 7 | Invalid Mandatory Parameter | Invalid mandatory parameter |
| 8 | Unrecognized Parameters | Unrecognized parameters |
| 9 | No User Data | No user data |
| 10 | Cookie Received While Shutting Down | Cookie received while shutting down |
| 11 | Restart with New Addresses | Restart with new addresses |
| 12 | User Initiated Abort | User-initiated abort |
| 13 | Protocol Violation | Protocol violation |
9.1.4. T Bit Usage
The T bit controls Verification Tag selection in ABORT chunk:
T=0:
- Use normal Verification Tag
- Used for ABORT in normal association
T=1:
- Use Verification Tag from received packet
- Used for response to "Out of the Blue" packets
- Or when unsure of correct Tag
9.2. Shutdown of an Association
SHUTDOWN is a normal, orderly association termination process ensuring all data is reliably delivered.
9.2.1. Shutdown Process Overview
Normal shutdown involves exchange of three chunks:
Endpoint A Endpoint Z
(No more data to send)
--------[SHUTDOWN]--------->
(Transmit remaining data)
<------[SHUTDOWN ACK]-------
-----[SHUTDOWN COMPLETE]---->
Both sides destroy TCB
9.2.2. Initiating SHUTDOWN
When ULP requests association closure:
Sender Behavior:
1. Stop accepting new user data
2. Complete transmission of all unsent data
3. Wait for all unacknowledged data to be acknowledged
4. Send SHUTDOWN chunk with Cumulative TSN Ack
5. Start T2-shutdown timer
SHUTDOWN Chunk Format:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = 7 | Flags | Length = 8 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cumulative TSN Ack |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
9.2.3. Receiving SHUTDOWN
Upon receiving a SHUTDOWN chunk, an endpoint MUST:
1. Stop accepting new user data
2. Verify all data up to Cumulative TSN Ack has been sent
3. If unsent data exists, continue transmission
4. Once all data is acknowledged, send SHUTDOWN ACK
5. Start T2-shutdown timer
State Transition:
ESTABLISHED -> SHUTDOWN-RECEIVED
9.2.4. Sending SHUTDOWN ACK
SHUTDOWN ACK Chunk Format:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = 8 | Flags | Length = 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Sending Timing:
- All received data delivered to ULP
- All local data acknowledged by peer
9.2.5. Receiving SHUTDOWN ACK
Upon receiving SHUTDOWN ACK, an endpoint MUST:
1. Send SHUTDOWN COMPLETE chunk
2. Stop T2-shutdown timer
3. Report association closure to ULP
4. Destroy TCB
State Transition:
SHUTDOWN-SENT -> CLOSED
9.2.6. SHUTDOWN COMPLETE
SHUTDOWN COMPLETE Chunk Format:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = 14 |Reserved |T| Length = 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
T Bit Usage:
- T=0: Normal case, use local Tag
- T=1: Use when responding to unexpected SHUTDOWN ACK
Receiving SHUTDOWN COMPLETE:
1. Stop T2-shutdown timer
2. Report association closure to ULP
3. Destroy TCB
State Transition:
SHUTDOWN-ACK-SENT -> CLOSED
9.2.7. T2-shutdown Timer
Purpose: Ensure SHUTDOWN process doesn't wait indefinitely.
Timeout Handling:
If in SHUTDOWN-SENT state:
- Retransmit SHUTDOWN chunk
- Double RTO
- Restart T2-shutdown timer
If in SHUTDOWN-ACK-SENT state:
- Retransmit SHUTDOWN ACK chunk
- Double RTO
- Restart T2-shutdown timer
If retransmissions exceed Association.Max.Retrans:
- Report error to ULP
- Destroy TCB
9.2.8. Data Handling During Shutdown
In SHUTDOWN-PENDING state:
- Continue normal transmission and reception of data
- Wait for all unacknowledged data to be acknowledged
In SHUTDOWN-SENT state:
- Do not accept new user data
- May receive peer's data
- Send SACK to acknowledge received data
In SHUTDOWN-RECEIVED state:
- Do not accept new user data
- Continue transmitting unsent data
- Receive and acknowledge peer's data
In SHUTDOWN-ACK-SENT state:
- Do not accept new user data
- Do not transmit new data
- Retransmit SHUTDOWN ACK in response to duplicate SHUTDOWN
9.2.9. SHUTDOWN vs ABORT Comparison
| Feature | SHUTDOWN | ABORT |
|---|---|---|
| Data Guarantee | All sent data acknowledged | No data guarantee |
| Termination Speed | Slower (with handshake) | Immediate |
| Resource Cleanup | Graceful cleanup | Immediate cleanup |
| Use Case | Normal closure | Error or emergency |
| Response Required | Requires peer response | Unidirectional, no response |
Summary
SCTP provides flexible association termination mechanisms:
- SHUTDOWN: For normal closure, guarantees data integrity
- ABORT: For exceptional situations, immediate termination
Best Practices:
- Prefer SHUTDOWN for normal closure
- Use ABORT only for errors or resource issues
- Handle T2-shutdown timer timeouts properly
- Implement appropriate retransmission mechanisms