View page as slide show

Communications Software Protocols and Architecture

Stream Control Transmission Protocol

  • Transport layer protocol
    • Developed to run on top of connectionless packet based network protocol that can be unreliable e.g. IP
  • Offers TCP like acknowledged, error-free, non-duplicated transfer of messages.
    • Detection of data corruption, loss of data, duplication of data
      • checksums
      • sequence numbers
    • Recovery
      • Selective retransmission mechanism
    • Congestion avoidance methods
  • Solution to bypass some TCP limitations
    • To be used instead of TCP (or UDP)

TCP limitations

  • Provides only BYTE (OCTET) stream
    • upper layer has to take care of its own message boundaries since TCP does not do that
  • Head-of-line blocking
    • Message sequencing may not be needed, while reliable transfer is wanted
  • no multihoming
  • vulnerable to Denial of Service (DoS) attacks
    • e.g. SYN flood

SCTP features

  • Resistance to flooding and masquerade attacks.
    • 4-way handshake
  • Multihoming
  • Path management
  • Multistreaming
    • Eliminates head of line blocking
  • Delivered messages stay intact
    • SCTP stream is message stream compared to TCP which provides transmission of octet stream
    • User data may be fragmented and reassembled
  • Path failure detection
    • hearbeat messages
  • Combining several messages within one packet
    • multiple chunks
  • Packet validation

RFCs

  • 2960 - Stream control Transmission protocol
    • First version from Oct 2000
  • 3257 - SCTP applicapibility
    • Text document about SCTP use
  • 3286 - An introduction to SCTP
  • 3309 - SCTP checksum change
    • Change from Adler-32 to CRC32c and reasons behind that
  • 3436 - Transport layer security over SCTP
    • How use TLS with SCTP
  • 4960 - Stream Control Transmission protocol
    • updated specification
    • Differences to RFC 2960 are described in RFC 4460 - Stream Control Transmission Protocol (SCTP) Specification Errata and Issues

SCTP packets

  • SCTP packet consists of common header and chunks
    • chunk may contain payload (from upper layer) or SCTP control infromation
  • Multiple chunks may be multiplexed in one packet
    • MTU is the limit
  • SCTP statemachine is activated by chunk rather than packet.
    • chunks are decoded from SCTP packet

SCTP common header

  • Source port and destination port (16 bits each)
    • Just like in TCP and UDP
  • Verification tag (32 bits)
    • For validating the connection to which this packet is for
    • must be zero when connection INITiation is done
  • Checksum (32 bits)

SCTP chunks

  • Chunk header
    • Chunk type field
      • 8 bits that identify the chunk type
    • Chunk flags
      • 8 bits, which use depends on the type of chunk in question
    • Chunk length
      • 16 bits The whole length of Chunk in Bytes excluding padding in Chunk Value field
    • Chunk Value
      • optional and variable length parameters and data
      • length must be multiple of 4 Bytes, otherwise field has to be padded with zeroes (maximum padding is 3 Bytes)
  • Parameter Format
    • Parameter type (16bits)
    • Parameter length (16 bits)
    • Parameter Value
      • Special encoding (chapter 3.2.1 in RFC 4960 contains the details)

SCTP Chunk types

  • Payload Data
  • Initiation (INIT)
  • Initiation Acknowledgement (INIT ACK)
  • Selective Acknowledgement (SACK)
  • Heartbeat Request (HEARTBEAT)
  • Heartbeat Acknowledgement (HEARTBEAT ACK)
  • Abort Association (ABORT)
  • Shutdown Association (SHUTDOWN)
  • Shutdown Acknowledgement (SHUTDOWN ACK)
  • Operation Error (ERROR)
  • Cookie Echo (COOKIE ECHO)
  • Cookie Acknowledgement (COOKIE ACK)
  • Shutdown Complete (SHUTDOWN COMPLETE)

SCTP primitives

  • Primitives to SCTP
  • Initialize
  • Associate
  • Shutdown
  • Abort
  • Send
  • Set Primary
  • Receive
  • Status
  • Change Heartbeat
  • Request HeartBeat
  • Get SRTT Report
  • Set Failure Threshold
  • Set Protocol Parameters
  • Receive unsent message
  • Receive unacknowledged message
  • Destroy SCTP instance
  • primitives from SCTP
  • DATA ARRIVE notification
  • SEND FAILURE notification
  • NETWORK STATUS CHANGE notification
  • COMMUNICATION UP notification
  • COMMUNICATION LOST notification
  • COMMUNICATION ERROR notification
  • RESTART notification
  • SHUTDOWN COMPLETE notification

SCTP connection forming

  • 4-way handshake
  • Starts with ASSOCIATE primitive from upper layer to A
  1. A→B: INIT
  2. B→A: INIT-ACK
    • Contains state cookie that contains timestamp, lifespan of cookie, values needed for association and MAC(see details in RFC 4960, chapter 5.1.3)
    • No resources reserved at this point for connection.
  3. A→B: Cookie echo
    • Contains the cookie data. cookie MAC is verified.
    • Values in cookie are used to initialise SCTP connection instance
    • packet with cookie-echo chunk may also contain data chunks
  4. B→A: Cookie-ACK
    • acknowledging he connection forming

SCTP INIT chunk

  • Chunk headers:
    • Type = 1,
    • chunk flags = none (all zeroes
    • chunk length
  • Mandatory parameters:
    • Initiate tag (32 bits)
      • Copied to verification tag field of packet to identify the connection
    • advertised receiver window (32 bits)
      • buffer space
    • number of outbound streams (16 bits)
    • number of inbound streams (16 bits)
    • Initial Transmission Sequence number (TSN)
      • Where the sequence numbering of packets start

SCTP INIT ACK chunk

  • Chunk headers:
    • Type = 2
    • chunk flags
    • chunk length
  • Mandatory parameters:
    • Initiate tag (32 bits)
      • Copied to verification tag field of packet to identify the connection. (both sides have their own tag value)
    • advertised receiver window 32 bits
      • buffer space
    • number of outbound streams 16 bits
    • number of inbound streams 16 bits
    • Initial Transmission Sequence number (TSN)
      • Where the sequence numbering of packets start
  • State Cookie (variable size)
    • Parameter headers:
      • parameter type: 7
      • Parameter Lenght
    • Parameter value (e.g. the cookie itself)
      • Creation of cookie:
        • Based on transmission control block (TCB) that contains information about the connection (recommended content in chapter 13)
          • associations, secret key, address list, SCTP ports
        • Add creation time and wanted lifespan of cookie
        • Create MAC with secret key and subset of TCB information
        • Combine MAC and the TCB subset == Cookie

SCTP DATA chunk

  • Chunk headers:
    • Type = 0,
    • chunk flags
      • first 5 bits reserver (set to zero)
      • U bit : set for unoredered data
      • B bit: Beginning of fragment. Set for the first piece of fragmented user message
      • E bit: End of fragment. Set for the last piece of fragmented user message
      • For non fragmented message both B and E bits are set.
      • For middle part of fragmented message neither B or E are set. TSN state the order of middle pieces.
    • chunk length
    • Stream identifier
      • Identifies the stream the data belongs to
    • Stream sequence number
      • Sequence number of data within the given stream
    • Payload protocol identifier
      • Identifier coming from the upper layer
    • User data

SCTP connection closing

  • a→b: SHUTDOWN
  • b→a: pending data transmitted
  • b→a: SHUTDOWN-ACK
  • A→B: SHUTDOWN COMPLETE

Multihoming

  • Client with multiple IPs can inform server about them in INIT chunk optional address parameter
  • Each ip address is considered as an end point of independent path.
  • Path condition is monitored with HEARTBEAT chunks
  • retransmission are conducted via different PATH than what original transmission was done, if possible.

SCTP example

Last modified: 2013/07/01 14:42