Académique Documents
Professionnel Documents
Culture Documents
SCTP
indigoo.com
STREAM CONTROL
TRANSMISSION PROTOCOL
INTRODUCTION TO SCTP, A GENERAL PURPOSE
TRANSPORT PROTOCOL SUITED FOR HIGH
RELIABILITY APPLICATIONS
PETER R. EGLI
INDIGOO.COM
1/45
Rev. 2.00
indigoo.com
Contents
1. What is SCTP?
2. Why use SCTP?
3. Main features of SCTP
4. The SCTP model
5. SCTP packet format
6. Association setup with SCTP
7. Association shutdown with SCTP
8. Multihoming with SCTP
9. SCTP fragmentation
10. SCTP flow control
11. SCTP congestion control
12. SCTP error control
13. Security with SCTP
14. SCTP support in different OSs and platforms
15. SCTP API in Linux (socket interface)
2/45
Rev. 2.00
indigoo.com
1. What is SCTP?
SCTP (Stream Control Transmission Protocol, RFC4960) is a transport protocol on OSI layer 4
(like TCP or UDP).
SCTP was specifically designed as a transport protocol for public telephony network signalling
message transport. However, SCTP is generic and may supersede TCP in other applications as
well.
Simplified OSI stack (session and presentation layers omitted):
Physical Layer
Physical Layer
3/45
Rev. 2.00
indigoo.com
4/45
Rev. 2.00
indigoo.com
5/45
Rev. 2.00
indigoo.com
Congestion avoidance:
Similar functionality as in TCP to avoid congestion to build up in the network.
Peter R. Egli 2015
6/45
Rev. 2.00
indigoo.com
UM:
H:
L1,L2:
ULP:
SCTP user
application (ULP)
Streams
U
M
U
M
U
M
U
M
U
M
H
Bundling
U
M
SCTP socket
interface
SCTP data chunks
Multiplexing /
demultiplexing of chunks
into an SCTP packet
U U U U
M M M M
SCTP layer
H H H H
SCTP H.
SCTP packet
SCTP
endpoint
U
M
U
M
U
M
U
M
U
M
U
M
Bundling
SCTP H.
H H H H
U U U U
M M M M
Transport
address
IP layer
L1 & L2
Peter R. Egli 2015
User Message
Header
Layer 1, Layer 2
Upper Layer Protocol
L1 & L2
7/45
Rev. 2.00
indigoo.com
Bundling:
Bundling packs multiple chunks (user data chunks and SCTP control chunks) into an SCTP
packet.
Chunk:
Unit of information within an SCTP packet. Chunks contain either user data (user data chunk)
or SCTP control information (control chunk). Each chunk has its own header (chunk header).
Endpoint:
An SCTP endpoint is an addressable logical endpoint of an SCTP association. An SCTP
endpoint represents exactly 1 SCTP port number, but may contain multiple transport addresses
in case of multihoming (1 SCTP port number, multiple IP addresses).
Stream:
A stream is a logical channel transporting in-order application messages.
Streams are unidirectional. If an application requires a bidirectional stream, it must open 1
outgoing and 1 incoming unidirectional stream and treat them together as a bidirectional
stream.
Peter R. Egli 2015
8/45
Rev. 2.00
indigoo.com
User application:
Application that opens an SCTP association to a peer SCTP user application and exchanges
messages with the peer application through the SCTP socket interface.
Also called ULP (Upper Layer Protocol).
User message:
Unit of data sent by the SCTP user application over the SCTP socket interface. In protocol
speek, a user message is an 'APDU' (Aplication Protocol Data Unit).
Peter R. Egli 2015
9/45
Rev. 2.00
indigoo.com
SCTP
Association
1
Endpoint 1
transport
address
SCTP
socket
<<represents>>
SCTP
Endpoint
Endpoint 2 transport
addresses (2 IP addresses
sharing the same port number)
1
An SCTP endpoint may contain
multiple transport addresses that
each contain one IP address and
share the same SCTP port number.
Thus an SCTP endpoint has exactly
one port number.
1..*
A specific port number
or IP address may be used
by multiple endpoints.
Only the combination of
IP address and port number
(=transport address) is
unique to an endpoint.
Transport
address
1
1
IP address
1
SCTP port
number
1
10/45
Rev. 2.00
indigoo.com
Verification tag
Cecksum
Chunk #1
SCTP payload:
Chunk #n
Chunk type
Chunk flags
Chunk value
Chunk length
Chunk:
Chunk type:
Chunk flags:
Chunk length:
Chunk value:
11/45
Rev. 2.00
indigoo.com
Type = 0
U B E
TSN
Stream Identifier (S)
Data chunk:
U bit:
If set to 1, indicates that this is an unordered chunk. Unordered chunks are transmitted and sent to the
receiving application as is without re-ordering based on the sequence number.
B bit:
Begin of fragment bit. If set to 1 this is the first fragment of a larger fragmented user data message.
E bit:
End of fragment bit. If set to 1 this is the last fragment of a larger fragmented user data message.
Stream identifier: Identifies the stream to which this chunk belongs.
Stream seq. no.:
Sequence number of user data within this stream. In case of fragmentation this numer is identical for all
fragments.
Payload proto. id.: Identifies the upper (application) layer protocol (e.g. HTTP).
User data:
Application user data (e.g. HTTP header and payload).
12/45
Rev. 2.00
indigoo.com
ID
Description
DATA
INIT
INIT_ACK
Initiation Acknowledegment.
SACK
HEARTBEAT
HEARTBEAT_ACK
Heartbeat Acknowledgement.
ABORT
SHUTDOWN
SHUTDOWN_ACK
Shutdown Acknowledgement.
SHUTDOWN_COMPLETE
14
ERROR
Used for reporting an error condition to the SCTP peer. An ERROR chunk may be
followed by an ABORT (fatal error).
COOKIE_ECHO
10
COOKIE_ACK
11
Cookie Acknowledgement.
13/45
Rev. 2.00
indigoo.com
SCTP 'A'
SCTP 'Z'
1
INIT chunk
* Init. tag
INIT_ACK chunk
* Cookie
TCB
COOKIE_ECHO chunk
* Cookie
* Optionally bundled with user DATA chunks
COOKIE_ACK chunk
* Optionally bundled with user DATA chunks
TCB
14/45
Rev. 2.00
T:
A:
T:
A:
T:
A:
T:
A:
or
T:
A:
CLOSED
T:
A:
COOKIEWAIT
Rx valid COOKIE_ECHO
Create TCB
Tx COOKIE_ACK
T:
A:
COOKIEECHOED
or
T:
A:
Abort()
Tx ABORT
Delete TCB
ESTABLISHED
T:
A:
Key:
T:
A:
Rx:
Tx:
ABORT:
Abort():
ULP:
indigoo.com
Trigger causing the transition
Action to be carried out
Receive
Transmit
SCTP chunks are in uppercase
SCTP API call
Upper Layer Protocol
Rx INIT
Tx INIT_ACK
Rx INIT_ACK
Tx COOKIE_ECHO
Stop init timer
Start cookie timer
T:
A:
Rx COOKIE_ECHO
Tx COOKIE_ACK
Rx COOKIE_ACK
Stop cookie timer
15/45
Rev. 2.00
indigoo.com
SCTP 'Z'
SCTP 'A'
CLOSED
TCB
INIT chunks
* Init. tag
INIT_ACK chunks
* Cookie
COOKIE_ECHO chunks
* Cookie
COOKIE_ACK chunks
TCB
COOKIEWAIT
COOKIEECHOED
ESTABLISHED
16/45
Rev. 2.00
indigoo.com
TCP 'A'
1
SCTP 'Z'
SCTP 'A'
1
INIT chunk
* Init. tag
ABORT chunk
17/45
Rev. 2.00
indigoo.com
SCTP 'Z'
1
SHUTDOWN chunk
SHUTDOWN_ACK chunk
SHUTDOWN_COMPLETE chunk
SCTP 'A'
SCTP 'Z'
1
SHUTDOWN chunks
SHUTDOWN_ACK chunks
SHUTDOWN_COMPLETE chunks
18/45
Rev. 2.00
indigoo.com
ESTABLISHED
Shutdown()
Check outstanding
DATA chunks
T:
A:
Rx SHUTDOWN
Check outstanding
DATA chunks
SHUTDOWN
PENDING
T:
A:
SHUTDOWN
SENT
T:
A:
Key:
T:
A:
Rx:
Tx:
ABORT:
Abort():
Rx SHUTDOWN
Tx SHUTDOWN_ACK
Start shutdown timer
T:
No more outstanding
DATA chunks
Tx SHUTDOWN_ACK
Start shutdown timer
A:
SHUTDOWN
_ACK SENT
Rx SHUTDOWN_ACK
Stop shutdown timer
Tx SHUTDOWN_COMPLETE
Delete TCB
T:
A:
SHUTDOWN
RECEIVED
T:
A:
CLOSED
Rx SHUTDOWN COMPLETE
Stop shutdown timer
Delete TCB
or
T:
Rx SHUTDOWN_ACK
A: Stop shutdown timer
Tx SHUTDOWN_COMPLETE
Delete TCB
19/45
Rev. 2.00
indigoo.com
One of the transmission paths is the primary path. If connectivity over the primary path fails
(timeouts of sent packets), SCTP falls back to a secondary (alternate) path for transmitting.
N.B.: SCTP does not perform load balancing or load sharing.
The ULP can request SCTP to send data to a specific destination transport address.
Multihoming scenario with a mobile device and a primary and secondary path:
Primary path
IP 1
Network 1
IP A
Server
Mobile
device
IP 2
Network 2
IP B
Secondary path
Peter R. Egli 2015
20/45
Rev. 2.00
indigoo.com
9. SCTP fragmentation
SCTP includes an (optional) fragmentation on the transmit side to avoid fragmentation in the
IP layer. An SCTP receiver must support fragmentation (be able to reassemble a fragmented
packet).
An SCTP sender must fragment DATA chunks if they do not fit into an SCTP packet including
chunk headers (exceed the association path MTU = smallest MTU of all paths to all peers in a
multihomed scenario).
SCTP user
application
SCTP user
application
2500
300
User messages
300
H SCTP H.
1500
1000
300
H SCTP H.
2500
Fragmentation of
2500 byte
user message and
bundling of DATA chunks
in the SCTP layer
1000
1500
IP Layer
H SCTP H.
H SCTP H.
IP Layer
1500
300
H SCTP H.
IP H.
1000
300
H SCTP H.
IP H.
21/45
Rev. 2.00
indigoo.com
SCTP Layer
A
SCTP Layer
Z
Transmit
buffer (queue)
Receive
buffer (queue)
SCTP User
Application
Z (ULP Z)
Application
writes
Application
reads
Z rwnd
T3-rtx
cwnd
TSN
rwnd
Network
Receive
buffer (queue)
Transmit
buffer (queue)
Application
reads
Application
writes
A rwnd
T3-rtx
SCTP socket
interface
Peter R. Egli 2015
cwnd
TSN
SCTP socket
interface
22/45
Rev. 2.00
indigoo.com
23/45
Rev. 2.00
indigoo.com
24/45
Rev. 2.00
indigoo.com
25/45
Rev. 2.00
indigoo.com
ULP A
SCTP Layer A
INIT [Initial-TSN=X,
a_rwnd=5000]
socket()
rwnd
T3-rtx
2500 cwnd
TSN
0
Association
Setup
SCTP Layer Z
ULP Z
socket()
INIT_ACK [Initial-TSN=Y,
a_rwnd=2500]
4380
X+0
COOKIE_ECHO
COOKIE_ACK
X+0
write(D=500)
rwnd
T3-rtx
2000 cwnd
TSN
0
4380
X+0
rwnd
T3-rtx
5000 cwnd
TSN
0
4380
Y+0
X+0
2
DATA [TSN=X+0, CL=500]
rwnd
T3-rtx
X+1 X+0
5000 cwnd
TSN
0
4380
Y+0
X+1 X+0
write(D=1000)
rwnd
T3-rtx
1000 cwnd
TSN
0
4380
X+1
rwnd
T3-rtx
5000 cwnd
TSN
0
4380
Y+0
26/45
Rev. 2.00
indigoo.com
SCTP Layer A
SCTP Layer Z
1000 cwnd
TSN
0
X+1 X+0
4380
X+1
rwnd
T3-rtx
rwnd
T3-rtx
1500 cwnd
TSN
0
4380
X+1
Y+0
500
0
cwnd
TSN
4380
X+4
5000 cwnd
TSN
0
4380
Y+0
X+2 X+1
6
DATA [TSN=X+2, CL=1000]
SACK [Cumulative TSN=Y,
a_rwnd=4000]
rwnd
T3-rtx
read(D=500)
Y+0
write(D=1000)
write(D=800)
4380
Y+0
write(D=1000)
rwnd
T3-rtx
rwnd
T3-rtx
5000 cwnd
TSN
0
X+1
5
DATA [TSN=Y, CL=1000]
SACK [Cumulative
TSN=X+1, a_rwnd=1500]
Y+0
write(D=1000)
ULP Z
5000 cwnd
TSN
0
4380
Y+0
27/45
Rev. 2.00
indigoo.com
28/45
Rev. 2.00
indigoo.com
Slow Start
Congestion
Avoidance
29/45
Rev. 2.00
indigoo.com
TSN
Bytes sent
and acknowledged
(cum. TSN ack.)
(data in flight,
i.e. sent but not
acknowledged)
10
Can be
sent
anytime
11
12
13
14
15
indigoo.com
Key:
PMTU: Association Path MTU
SS:
Slow Start
CA:
Congestion Avoidance
ssthresh
cwnd
Packet loss
(T3-rtx timeout)
Packet loss
(Fast Retransmit)
Congestion
avoidance phase
5
Congestion
avoidance phase
SS
phase
= , ,
= ( _)
= ,
= = ,
= 4
CA
phase
31/45
Rev. 2.00
indigoo.com
+ < = +
Description
Slow start threshold (threshold between slow start and congestion avoidance phase).
If , SCTP is in the slow start phase. If > , SCTP is in the
congestion avoidance phase.
Congestion window size. Maximum permissible number of outstanding bytes (sent data which
are not yet acknowledged).
32/45
Rev. 2.00
indigoo.com
33/45
Rev. 2.00
indigoo.com
34/45
Rev. 2.00
indigoo.com
Router 1
SCTP
Router 3
Packets dropped
by router 3.
Router 2
35/45
Rev. 2.00
indigoo.com
No
Yes
Retransm.
timer expiry
Retransmit as many
outstanding DATA
chunks in a single SCTP
packet as permitted by
MTU
Restart retransmission
timer (T3-rtx) with
current RTO
RTORTO*2
(back off the timer)
No
Restart retransmission
timer (T3-rtx) with
current RTO
Receive SACK chunk
Yes
Stop retransmission
timer (T3-rtx)
Recalculate RTO
36/45
Rev. 2.00
indigoo.com
Probability
0.4
RTO1 RTO2
RTTVAR
0.3
0.2
0.1
10
20
30
40
50
60
= +
= +
= +
where
=
=
=
= ( = /)
= ( = /)
=
Peter R. Egli 2015
37/45
Rev. 2.00
indigoo.com
SCTP 'Z'
Received DATA chunks (TSN)
DATA [TSN=10]
10
0
10
0
11
0
12
0
10
0
11
0
12
0
10
0
11
0
12
0
13
0
10
0
11
0
12
0
13
0
14
0
15
0
10
0
11
0
12
0
13
1
14
0
15
0
10
0
11
0
12
0
13
1
14
0
15
0
16
0
10
0
11
0
12
0
13
1
14
0
15
0
16
0
17
0
10
10
11
12
10
11
12
14
15
10
11
12
14
15
17
DATA [TSN=11,12]
DATA [TSN=13]
Lost!
DATA [TSN=14,15]
SACK [Cum. TSN Ack=12,
DATA [TSN=16]
Lost!
DATA [TSN=17]
38/45
Rev. 2.00
indigoo.com
SCTP 'Z'
11
0
12
0
13
2
14
0
15
0
16
1
17
0
10
0
11
0
12
0
13
2
14
0
15
0
16
1
17
0
18
0
10
DATA [TSN=18]
10
11
12
14
15
17
18
10
11
12
13
14
15
17
18
10
11
12
13
14
15
16
17
18
11
0
12
0
13
3
14
0
15
0
16
2
17
0
18
0
10
0
11
0
12
0
13
0
14
0
15
0
16
2
17
0
18
0
12
10
0
11
0
12
0
13
0
14
0
15
0
16
3
17
0
18
0
10
0
11
0
12
0
13
0
14
0
15
0
16
0
17
0
18
0
10
0
11
0
12
0
13
0
14
0
15
0
16
0
17
0
18
0
13
14
15
indigoo.com
40/45
Rev. 2.00
indigoo.com
41/45
Rev. 2.00
indigoo.com
New SCTP
chunk(s) to
be sent
New SCTP
chunk(s)
received
Yes
Send SCTP packet
Process
SCTP packet
CRCs
match?
Silently discard
SCTP packet
42/45
Rev. 2.00
indigoo.com
Standard
Description
RFC3354
RFC3436
IETF Draft
43/45
Rev. 2.00
indigoo.com
Description
Linux
Yes
FreeBSD / OpenBSD
Yes
Mac OSX
Yes
Solaris
Yes
Windows
No
.Net
No
Java
(Yes)
Cisco IOS
Yes
Yes
Since 6.3.0.
Android
Yes
OS / Platform
44/45
Rev. 2.00
indigoo.com
SCTP
L3
L1 & L2
Peter R. Egli 2015
45/45
Rev. 2.00