Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SCTP introduction

1,995 views

Published on

It is a introduction of SCTP for software developer.

Published in: Technology
  • Be the first to comment

SCTP introduction

  1. 1. SCTP introduction Richard Xiong 2013/2/8
  2. 2. Motivations• Provide reliable transfer without sequence maintenance.• The stream-oriented nature of TCP is often an inconvenience. SCTP provides message based transfer.• TCP is relatively vulnerable to denial-of- service attacks, such as SYN attacks.• …
  3. 3. History• First implementation on 1991• submitted to IETF on 1998. RFC 4960 defines the protocol. RFC 3286 provides an introduction. (RFC2960 and RFC3309 are obsoleted).• Designed for telecom signaling transfer at first, and used on other applications• supported by Cisco, Linux, HP, Solaris, Alcatel- Lucent,… » refrence
  4. 4. Network layers Upper layer applicationsTCP UDP SCTP IP Link Layer Physical Layer
  5. 5. Features• Message-based• Multi-homing• Multi-stream• Reliable transfer• Robust and safety ( four way handshake ,heartbeat, three way shutdown )
  6. 6. Multi-homing SW HUB 1 1 10.0.0.1 Alternate Path 10.0.0.3End-point A End-point Z 10.0.0.65 10.0.0.68 SW HUB 2 2 Primary path
  7. 7. Multi-stream Strm1 Strm2 Strm3 End-point SSN 1 SSN 1 SSN 1 End-point A ZStrm1 Strm2 Strm3SSN 2 SSN 2 SSN 2Strm1 Strm2 Strm3SSN 3 SSN 3 SSN 3 SSN: Stream Sequence Number
  8. 8. Multi-stream End-point End-point A Z Strm2 Strm3 Strm1 Strm2 Strm3 SSN 2 SSN 2 SSN 1 SSN 1 SSN 1Strm1SSN 2Strm1 Strm2 Strm3SSN 3 SSN 3 SSN 3
  9. 9. Multi-stream End-point End-point A Z Strm2 Strm3 SSN 2 SSN 2 Strm1 Strm2 Strm3Strm1 SSN 1 SSN 1 SSN 1SSN 2Strm1 Strm2 Strm3SSN 3 SSN 3 SSN 3
  10. 10. Multi-stream End-point End-point A Z Strm2 Strm3 Strm2 Strm1 SSN 2 SSN 2 SSN 3 SSN 2 Strm1 Strm2 Strm3 SSN 1 SSN 1 SSN 1Strm1 Strm3SSN 3 SSN 3
  11. 11. Multi-stream End-point End-point A Z Strm2 Strm3 SSN 2 SSN 2 Strm2 Strm1 Strm1 Strm2 Strm3 SSN 3 SSN 2 SSN 1 SSN 1 SSN 1Strm1 Strm3SSN 3 SSN 3
  12. 12. Multi-stream End-point End-point A Z Strm2 Strm1 Strm1 Strm2 Strm3 SSN 3 SSN 2 SSN 1 SSN 1 SSN 1 Strm2 Strm3Strm1 Strm3 SSN 2 SSN 2SSN 3 SSN 3
  13. 13. Multi-streamEnd-point End-point A Z Strm3 Strm1 SSN 3 SSN 3 Strm2 Strm1 Strm1 Strm2 Strm3 SSN 3 SSN 2 SSN 1 SSN 1 SSN 1 Strm2 Strm3 SSN 2 SSN 2
  14. 14. Multi-streamEnd-point End-point A Z Strm2 Strm1 Strm1 Strm2 Strm3 SSN 3 SSN 2 SSN 1 SSN 1 SSN 1 Strm2 Strm3 SSN 2 SSN 2 Strm1 Strm3 SSN 3 SSN 3
  15. 15. Multi-streamEnd-point End-point A Z Strm1 Strm2 Strm3Strm2 Strm1 SSN 1 SSN 1 SSN 1SSN 3 SSN 2 Strm2 Strm3 SSN 2 SSN 2 Strm1 Strm3 SSN 3 SSN 3
  16. 16. Multi-stream Strm2 Strm1End-point SSN 3 SSN 2 End-point A Z Strm1 Strm2 Strm3 SSN 1 SSN 1 SSN 1 Strm2 Strm3 SSN 2 SSN 2 Strm1 Strm3 SSN 3 SSN 3
  17. 17. Multi-streamEnd-point End-point A Z Strm1 Strm2 Strm3 SSN 1 SSN 1 SSN 1 Strm1 Strm2 Strm3 SSN 2 SSN 2 SSN 2 Strm1 Strm2 Strm3 SSN 3 SSN 3 SSN 3
  18. 18. Status of Association CLOSED COOKIE_WAIT COOKIE_ECHOED SHUTDOWN- ACK-SENT SHUTDOWN- RECIEVED ESTABLISHEDSHUTDOWN- SENT SHUTDOWN- PENDING
  19. 19. SCTP messages• Data -- SACK• INIT -- INIT ACK -- COOKIE ECHO -- COOKIE ACK• Heartbeat -- Heartbeat ACK• Shutdown – Shutdown ACK -- SHUTDOWN COMPLETE• Abort
  20. 20. Setting Up Endpoint A Endpoint Z CLOSED CLOSED INIT 1 COOKIE-WAIT INIT-ACK COOKIE-ECHO *COOKIE-ECHOED 2 * COOKIE-ACKESTABLISHED ESTABLISHED * -- User data can be attached
  21. 21. Transfer data
  22. 22. Close Endpoint A Endpoint ZShutdown from applicationSHUTDOWN-PENDING Transfer remaining data SHUTDOWN SHUTDOWN-SENT SHUTDOWN-RECEIVED SHUTDOWN ACK SHUTDOWN-ACK-SENT SHUTDOWN COMPLETE CLOSED CLOSED
  23. 23. Packet Structure Refer to wikipedia
  24. 24. Chunk structure--DATA chunk
  25. 25. Chunk structure--SACK chunk
  26. 26. Fault management• Primary/alternate Path detection• Resend mechanism• Congestion control (RFC2581)
  27. 27. Installation on Linux (lksctp)• Check if SCTP is installed – grep SCTP /proc/net/protocols – checksctp• Download code from http://lksctp.sourceforge.net/
  28. 28. SCTP socket API• One-to-many style and one-to-one style are supported.• Please read the API standard before programming, there are lots of different features comparing to TCP socket.• One-to-many server – socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP) – bind(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr)) – setsockopt(m_fds[i].fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); – listen(sock, 2); – sctp_recvmsg(sock, buffer, BUFFER_SIZE, NULL, 0, NULL, &flags) – close(sock)• One-to-many client – socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) – connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr) – send(sock, buffer, MSG_SIZE, 0) – close(sock) » Refer SCTP API
  29. 29. Others• shortages – http://datatag.web.cern.ch/datatag/WP3/sctp/tests.• New research – Concurrent multipath transfer
  30. 30. Reference• http://en.wikipedia.org/wiki/Stream_Control_Transmission_Pro• RFC4960• RFC 2581• http://www.youtube.com/watch?v=dIPwN-z6lVA• http://www.sctp.org/• http://www.sourceforge.net/projects/lksctp• http://linux.die.net/man/7/sctp• http://www.ibm.com/developerworks/library/l-sctp/• http://www.linuxjournal.com/article/9784
  31. 31. Q&A

×