SCTP(7)
π¦ SCTP(7) π¦
okay bestie, this is the SCTP(7) page from the Linux Programmer's Manual, and we are gonna make SCTP make sense together. grab a boba, we're going in. π
β¨ NAME β¨
sctp β the SCTP protocol. that's it, that's the whole name. iconic behaviour. π
πΈ SYNOPSIS πΈ
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
sctp_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP);
sctp_socket = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
π DESCRIPTION π
So. This is an implementation of the SCTP protocol, exactly as defined in RFC4960. It's a message oriented, reliable transport protocol with direct support for multihoming, and it runs on top of ip(7). It supports both the v4 and v6 versions. no cap. π«Ά
Like TCP, SCTP hands you reliable, connection oriented data delivery with congestion control. Unlike TCP, bestie, SCTP also gives you message boundary preservation, ordered and unordered message delivery, multi-streaming and multi-homing. β¨ Detection of data corruption, loss of data and duplication of data? handled with checksums and sequence numbers. And when something does get lost or corrupted, a selective retransmission mechanism swoops in to fix it. she's thorough. π
This implementation supports a mapping of SCTP into the sockets API as defined in RFC6458 (Sockets API extensions for SCTP). Two styles of interfaces are supported.
π the one-to-many style π
This one has a 1 to MANY relationship between socket and associations, where the outbound association setup is implicit. The syntax of a one-to-many style socket() call is:
sd = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
A typical server in this style uses the following socket calls, in sequence, to prepare an endpoint for servicing requests:
socket()bind()listen()recvmsg()sendmsg()close()
And a typical client uses these calls, in sequence, to set up an association with a server to request services:
socket()sendmsg()recvmsg()close()
π¦ the one-to-one style π¦
This one has a 1 to 1 relationship between socket and association, which means existing TCP applications can be ported to SCTP with very little effort. the way that's a glow-up fr fr. The syntax of a one-to-one style socket() call is:
sd = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP);
A typical server in one-to-one style uses the following system call sequence to prepare an SCTP endpoint for servicing requests:
socket()bind()listen()accept()
The accept() call blocks until a new association is set up. It returns with a new socket descriptor. The server then uses that new socket descriptor to communicate with the client, using recv() and send() calls to get requests and send back responses. Then it calls:
close()
to terminate the association.
And a typical client uses the following system call sequence to set up an association with a server to request services:
socket()connect()
After returning from connect(), the client uses send() and recv() calls to send out requests and receive responses from the server. The client calls:
close()
to terminate this association when done. and that's the whole lifecycle, periodt. π
π ADDRESS FORMATS π
SCTP is built on top of IP (see ip(7)). The address formats defined by ip(7) apply to SCTP too. π«Ά
SCTP only supports point-to-point communication. Broadcasting and multicasting are not supported. sorry babe, that's just not the vibe here. π
β SYSCTLS β
These variables can be accessed by the /proc/sys/net/sctp/* files, or with the sysctl(2) interface. On top of that, most IP sysctls also apply to SCTP. See ip(7).
Please check the kernel documentation for this, at Documentation/networking/ip-sysctl.rst. π
π STATISTICS π
These variables can be accessed by the /proc/net/sctp/* files.
assocsβ displays the following information about the active associations: assoc ptr, sock ptr, socket style, sock state, association state, hash bucket, association id, bytes in transmit queue, bytes in receive queue, user id, inode, local port, remote port, local addresses, remote addresses, heartbeat interval, in streams, out streams, max retransmissions, init retries, shutdown retries, retransmitted chunks, sock transmit queue committed bytes, sock transmit queue bytes, and sock send and receive buffer bytes. she's giving full transparency. πepsβ displays the following information about the active endpoints: endpoint ptr, sock ptr, socket style, sock state, hash bucket, local port, user id, inode and local addresses.snmpβ displays the following statistics related to SCTP states, packets and chunks. π
π the snmp counters π
SctpCurrEstabβ the number of associations for which the current state is eitherESTABLISHED,SHUTDOWN-RECEIVEDorSHUTDOWN-PENDING.SctpActiveEstabsβ the number of times that associations have made a direct transition to theESTABLISHEDstate from theCOOKIE-ECHOEDstate. The upper layer initiated the association attempt.SctpPassiveEstabsβ the number of times that associations have made a direct transition to theESTABLISHEDstate from theCLOSEDstate. The remote endpoint initiated the association attempt.SctpAbortedsβ the number of times that associations have made a direct transition to theCLOSEDstate from any state using the primitive'ABORT'. That's an ungraceful termination of the association. πSctpShutdownsβ the number of times that associations have made a direct transition to theCLOSEDstate from either theSHUTDOWN-SENTstate or theSHUTDOWN-ACK-SENTstate. That one is a graceful termination of the association. πSctpOutOfBluesβ the number of out of the blue packets received by the host. An out of the blue packet is an SCTP packet that's correctly formed, proper checksum and all, but the receiver couldn't identify an appropriate association for it. πSctpChecksumErrorsβ the number of SCTP packets received with an invalid checksum.SctpOutCtrlChunksβ the number of SCTP control chunks sent (retransmissions are not included). Control chunks are those chunks different fromDATA.SctpOutOrderChunksβ the number of SCTP ordered data chunks sent (retransmissions are not included).SctpOutUnorderChunksβ the number of SCTP unordered chunks (data chunks in which theUbit is set to 1) sent (retransmissions are not included).SctpInCtrlChunksβ the number of SCTP control chunks received (no duplicate chunks included).SctpInOrderChunksβ the number of SCTP ordered data chunks received (no duplicate chunks included).SctpInUnorderChunksβ the number of SCTP unordered chunks (data chunks in which theUbit is set to 1) received (no duplicate chunks included).SctpFragUsrMsgsβ the number of user messages that have to be fragmented because of the MTU.SctpReasmUsrMsgsβ the number of user messages reassembled, after conversion intoDATAchunks.SctpOutSCTPPacksβ the number of SCTP packets sent. RetransmittedDATAchunks are included.SctpInSCTPPacksβ the number of SCTP packets received. Duplicates are included.SctpT1InitExpiredsβ the number of timer T1 INIT expired.SctpT1CookieExpiredsβ the number of timer T1 COOKIE-ECHO expired.SctpT2ShutdownExpiredsβ the number of timer T2 SHUTDOWN expired.SctpT3RtxExpiredsβ the number of timer T3 RTX expired.SctpT4RtoExpiredsβ the number of timer T4 RTO expired.SctpT5ShutdownGuardExpiredsβ the number of timer T5 SHUTDOWN GUARD expired.SctpDelaySackExpiredsβ the number of timerDELAY_SACKexpired.SctpAutocloseExpiredsβ the number of timer AUTOCLOSE expired.SctpT3Retransmitsβ the number of T3 timer retransmission.SctpPmtudRetransmitsβ the number of PMTUD retransmission.SctpFastRetransmitsβ the number of FAST retransmission.SctpInPktSoftirqβ the number of SCTP packets received in Softirq.SctpInPktBacklogβ the number of SCTP packets received in Backlog.SctpInPktDiscardsβ the number of SCTP packets discarded in receiving.SctpInDataChunkDiscardsβ the number of SCTP data chunks discarded in receiving.
that's part 1, bestie β and there is so much more coming, don't you dare leave the group chat yet. π«Ά
π CONTROL MSGS π
okay so bestie, the ancillary data rides inside the msg_control field of struct msghdr, and that's the struct you're using in the sendmsg(2) and recvmsg(2) calls. the SCTP stack uses this ancillary data to pass the attributes around β things like SCTP_RCVINFO β for the message chillin' in msg_iov, handing it to the socket endpoint. every single ancillary data item is preceded by a struct cmsghdr, peep cmsg(3) for that. all the cmsg types for SCTP are listed right here, and every one of these macros and structures lives in /usr/include/netinet/sctp.h. periodt. β¨
SCTP_INITβ this cmsg hands over the info for initializing new SCTP associations forsendmsg()usingstruct sctp_initmsg, which is literally the same data structure as theSCTP_INITMSGsocket option's. πSCTP_SNDRCVβ this cmsg specifies SCTP options forsendmsg()and describes the SCTP header info about a received message throughrecvmsg()usingstruct sctp_sndrcvinfo. it mixes the send path and the receive path together, andSCTP_SNDINFOandSCTP_RCVINFOsplit that info apart, so those structures are the ones you should use whenever possible, becauseSCTP_SNDRCVis deprecated.sctp_sendmsg(3)andsctp_send(3)give you a simple way to use this cmsg.
no cap: an application must use the SCTP_RECVRCVINFO socket option to enable the delivery of this information. π
SCTP_EXTRCVβ this cmsg specifies SCTP options for SCTP header info about a received message viarecvmsg()usingstruct sctp_extrcvinfo, and this structure is an extended version ofSCTP_SNDRCV. note that the data in the next message is not valid unless the current message is completely read, i.e., unless theMSG_EORis set.SCTP_NXTINFOshould be used when possible, sinceSCTP_EXTRCVis considered deprecated.sctp_recvmsg(3)gives you a simple way to use this cmsg.
again bestie, the app must use the SCTP_RECVNXTINFO socket option to enable the delivery of this information. π
SCTP_RCVINFO,SCTP_NXTINFOβ these cmsgs describe SCTP receive info about a received message throughrecvmsg()usingstruct sctp_rcvinfo, plus SCTP receive info of the next message that will be delivered throughrecvmsg()if that info is already available when the current message is being delivered, usingstruct sctp_nxtinfo.sctp_recvv(3)gives you a simple way to use these cmsgs.
and yeah, an application must use theSCTP_RECVRCVINFOandSCTP_RECVNXTINFOsocket options accordingly to enable the delivery of this information. π«Ά
SCTP_SNDINFO,SCTP_PRINFO,SCTP_AUTHINFO,SCTP_DSTADDRV4,SCTP_DSTADDRV6β these cmsgs specify a couple of SCTP options forsendmsg()for SEND, PRSCTP, AUTH and DSTADDR info, usingstruct sctp_sndinfo,sctp_prinfo,sctp_authinfoandin(6)_addraccordingly.sctp_sendv(3)gives you a simple way to use these cmsgs. π
β¨ EVENTS and NOTIFICATIONS β¨
an SCTP application may need to understand and process the events and errors that happen on the SCTP stack. these events include network status changes, association startups, remote operational errors, and undeliverable messages. when a notification arrives, recvmsg() returns the notification in the application-supplied data buffer via msg_iov, and sets MSG_NOTIFICATION in msg_flags. peep the socket option SCTP_EVENT for the event enabling. the different events are listed below, and all these related macros and structures are defined in /usr/include/netinet/sctp.h. πΈ
SCTP_ASSOC_CHANGEβ communication notifications inform the application that an SCTP association has either begun or ended. the notification format isstruct sctp_assoc_change. πSCTP_PEER_ADDR_CHANGEβ when a destination address of a multi-homed peer encounters a state change, a peer address change event gets sent. the notification format isstruct sctp_paddr_change. π¦SCTP_REMOTE_ERRORβ a remote peer may send an Operation Error message to its peer. this message indicates a variety of error conditions on an association. the notification format isstruct sctp_remote_error. πSCTP_SEND_FAILEDβ if SCTP cannot deliver a message, it can return the message back as a notification if theSCTP_SEND_FAILEDevent is enabled. the notification format isstruct sctp_send_failed. please note that this notification is deprecated β useSCTP_SEND_FAILED_EVENTinstead. π₯²SCTP_SHUTDOWN_EVENTβ when a peer sends a SHUTDOWN, SCTP delivers this notification to inform the application that it should cease sending data. the notification format isstruct sctp_shutdown_event. β¨SCTP_ADAPTATION_INDICATIONβ when a peer sends an Adaptation Layer Indication parameter, SCTP delivers this notification to inform the application about the peer's adaptation layer indication. the notification format isstruct sctp_adaptation_event. πSCTP_PARTIAL_DELIVERY_EVENTβ when a receiver is engaged in a partial delivery of a message, this notification gets used to indicate various events. the notification format isstruct sctp_pdapi_event. π§SCTP_AUTHENTICATION_EVENTβ this one reports different events relating to the use of the extension to authenticate SCTP messages. the notification format isstruct sctp_authkey_event. πSCTP_SENDER_DRY_EVENTβ when the SCTP stack has no more user data to send or retransmit, this notification is given to the user. also, at the time when a user app subscribes to this event, if there's no data to be sent or retransmitted, the stack will immediately send up this notification. the notification format isstruct sctp_sender_dry_event. π§SCTP_SEND_FAILED_EVENTβ if SCTP cannot deliver a message, it can return the message back as a notification if theSCTP_SEND_FAILED_EVENTevent is enabled. the notification format isstruct sctp_send_failed_event. π₯
π SOCKET OPTIONS π
to set or get an SCTP socket option, call getsockopt(2) to read or setsockopt(2) to write the option, with the option level argument set to SOL_SCTP. note that all these macros and structures described for parameters are defined in /usr/include/netinet/sctp.h, and for one-to-one style sockets a specified assoc_id works the same as SCTP_FUTURE_ASSOC. iykyk π
SCTP_RTOINFOβ this option gets or sets the protocol parameters used to initialize and bound the retransmission timeout (RTO).
the parameter type is struct sctp_rtoinfo, for reading and writing. srto_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
default: srto_max=sysctl_net.sctp.rto_max, srto_min=sysctl_net.sctp.rto_min, srto_initial=sysctl_net.sctp.rto_initial.
SCTP_ASSOCINFOβ this option is used to both examine and set various association and endpoint parameters.
the parameter type is struct sctp_assocparams, for reading and writing. sasoc_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC. note that some fields of this structure are for reading only:
struct sctp_assocparams {
sctp_assoc_t sasoc_assoc_id;
__u16 sasoc_asocmaxrxt; (RW)
__u16 sasoc_number_peer_destinations; (R)
__u32 sasoc_peer_rwnd; (R)
__u32 sasoc_local_rwnd; (R)
__u32 sasoc_cookie_life; (RW)
};
default: sasoc_asocmaxrxt=sysctl_net.sctp.association_max_retrans, sasoc_cookie_life=sysctl_net.sctp.valid_cookie_life.
SCTP_INITMSGβ this option gets or sets the protocol parameters for the default association initialization.
the parameter type is struct sctp_initmsg, for reading and writing.
default: sinit_num_ostreams=10, sinit_max_instreams=10, sinit_max_attempts=sysctl_net.sctp.max_init_retransmits, sinit_max_init_timeo=sysctl_net.sctp.rto_max.
SCTP_NODELAYβ turns on/off any Nagle-like algorithm. this means packets are generally sent as soon as possible and no unnecessary delays are introduced, at the cost of more packets in the network.
the parameter type is int boolean, for reading and writing.
default: 0.
SCTP_AUTOCLOSEβ this socket option is applicable to the one-to-many style socket only. when set, it will cause associations that are idle for more than the specified number of seconds to automatically close. an association being idle is defined as an association that has NOT sent or received user data within a period.
the parameter type is int (seconds), for reading and writing. 0 indicates that no automatic close of any associations should be performed.
default: sysctl_net.sctp.max_autoclose.
SCTP_SET_PEER_PRIMARY_ADDRβ requests that the peer mark the enclosed address as the association primary. the enclosed address must be one of the association's locally bound addresses.
the parameter type is struct sctp_setpeerprim, for writing only. sspp_assoc_id is a specified assoc_id.
default: the 1st local address added. require: SCTP_ASCONF_SUPPORTED.
SCTP_PRIMARY_ADDRβ requests that the local SCTP stack use the enclosed peer address as the association primary. the enclosed address must be one of the association peer's addresses.
the parameter type is struct sctp_prim, for writing only. ssp_assoc_id is a specified assoc_id.
default: the 1st peer address added. require: SCTP_ASCONF_SUPPORTED.
SCTP_DISABLE_FRAGMENTSβ if enabled, no SCTP message fragmentation will be performed. instead, if a message being sent exceeds the current PMTU size, the message will NOT be sent and an error will be indicated to the user.
the parameter type is int boolean, for reading and writing.
default: 0.
SCTP_PEER_ADDR_PARAMSβ using this option, applications can enable or disable heartbeats for any peer address of an association, modify an address's heartbeat interval, force a heartbeat to be sent immediately, and adjust the address's maximum number of retransmissions sent before an address is considered unreachable.
The parameter type is struct sctp_paddrparams, bestie β for reading and writing. spp_address is a specified transport address or 0, and spp_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
Default: hbinterval=sysctl_net.sctp.hb_interval, pathmaxrxt=sysctl_net.sctp.path_max_retrans, pathmtu=dev/route's, sackdelay=sysctl_net.sctp.sack_timeout, param_flags=HB_ENABLE|PMTUD_ENABLE|SACKDELAY_ENABLE, flowlabel=0, dscp=0.
SCTP_DEFAULT_SEND_PARAMβ okay so if you're the kind of girlie who wants to use thesendto()system call directly, this lets you set up a default lil bundle of parameters that would normally come in through ancillary data. β¨ heads up though: this one has been obsoleted bySCTP_DEFAULT_SNDINFO, so it's giving legacy, not main character.
The parameter type is struct sctp_sndrcvinfo. For reading, sinfo_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, sinfo_assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Default: default_stream=0, default_flags=0, default_ppid=0, default_context=0, default_timetolive=0.
SCTP_EVENTSβ this socket option lets you say which notifications and ancillary data you wanna receive. π And yep, another obsoleted icon βSCTP_EVENTis the glow-up that replaced it.
The parameter type is struct sctp_event_subscribe, for reading and writing.
Default: 0.
SCTP_I_WANT_MAPPED_V4_ADDRβ this one flips mapped V4 addresses on or off. π¦ Turn it on and if your socket is typePF_INET6, then IPv4 addresses get mapped into V6 representation. Turn it off and no mapping happens at all β you'll just receive bothPF_INET6andPF_INETtype addresses right there on the socket.
The parameter type is int boolean, for reading and writing.
Default: 1.
SCTP_MAXSEGβ sets the max size that can go into any outgoing SCTP DATA chunk. If a message is bigger than this, SCTP will fragment it down to the size you said. π But plot twist: the underlying SCTP implementation can still fragment into smaller chunks whenever the PMTU of the association is smaller than whatever value you set. Setting it to0means you are NOT limiting fragmentation at all β only the PMTU gets a say in how SCTP picks its DATA chunk size.
The parameter type is struct sctp_assoc_value, for reading and writing. assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
Default: 0(no limit).
SCTP_STATUSβ lets an application pull the current status tea about an association, including the association state, peer receiver window size, number of unacked data chunks, and number of data chunks pending receipt. π
The parameter type is struct sctp_status, for reading only. sstat_assoc_id is a specified assoc_id.
SCTP_GET_PEER_ADDR_INFOβ want the deets on one specific peer address of an association? Reachability state, congestion window, retransmission timer values β all of it. π
The parameter type is struct sctp_paddrinfo, for reading only. spinfo_address is a specified transport address, sas_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
SCTP_GET_ASSOC_STATSβ grabs current statistics about an association: SACKs sent and received, SCTP packets sent and received. π
The parameter type is struct sctp_assoc_stats, for reading only. sas_assoc_id is a specified assoc_id.
SCTP_DELAYED_ACK,SCTP_DELAYED_ACK_TIME,SCTP_DELAYED_SACKβ these three besties all mess with how delayed SACKs get done. They let the app get or set the delayed SACK time (in milliseconds) and also change the delayed SACK frequency. Setting the frequency to1disables the delayed SACK algorithm entirely. π« And lowkey important: ifsack_delayorsack_freqis0when you're setting this option, the current values just stay unchanged. No cap.
The parameter type is struct sctp_sack_info. For reading, sack_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, sack_assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Default: sackdelay=sysctl_net.sctp.sack_timeout,sackfreq=2.
SCTP_CONTEXTβ this one lets you set, on an association basis, a default context that you'll receive when reading messages from the peer. π«Ά It's literally so helpful when you're using one-to-many style sockets and you want to keep some reference to an internal state machine that's processing messages on the association. Just know that setting this value only affects messages received from the peer β it does not touch the value saved with outbound messages.
The parameter type is struct sctp_assoc_value. For reading, assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Default: 0.
SCTP_FRAGMENT_INTERLEAVEβ fragmented interleave controls how messages get presented to the receiver. π There are three levels, and the way that they stack is genuinely iconic:- level 0:
SCTP_FRAGMENT_INTERLEAVE = 0 - level 1:
SCTP_FRAGMENT_INTERLEAVE = 1 - level 2:
SCTP_FRAGMENT_INTERLEAVE = 1 & SCTP_INTERLEAVING_SUPPORTED = 1
- level 0:
The parameter type is int boolean, for reading and writing.
Default: 0.
SCTP_PARTIAL_DELIVERY_POINTβ sets or gets the SCTP partial delivery point. This point is the size of a message where the partial delivery API gets invoked, which helps free up rwnd space for the peer. Lower value = partial deliveries happening more often. π This option expects an integer that sets or gets the partial delivery point in bytes.
Not me forgetting to mention: the call will fail if you try to set this value larger than the socket receive buffer size. π
Also, any single message with a length smaller than or equal to the SCTP partial delivery point gets delivered in a single read call β as long as the buffer you provided is big enough to hold the message. π
The parameter type is uint32_t, for reading and writing.
Default: 0.
SCTP_MAX_BURSTβ lets you change the maximum burst of packets that can be emitted by this association. π₯
The parameter type is struct sctp_assoc_value. For reading, assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Default: sysctl_net.sctp.max_burst.
SCTP_AUTH_CHUNKβ adds a chunk type that you're requesting to be received only in an authenticated way. And note bestie: it only affects future associations. π§
The parameter type is struct sauth_chunk, for writing only.
Default: no chunks. Require: SCTP_AUTH_SUPPORTED. RFC: RFC4895.
SCTP_HMAC_IDENTβ gets or sets the list of Hashed Message Authentication Code (HMAC) algorithms that the local endpoint requires the peer to use. π
The parameter type is struct sctp_hmacalgo, for reading and writing. shmac_idents can include SCTP_AUTH_HMAC_ID_{SHA1|SHA256}.
Default: SCTP_AUTH_HMAC_ID_SHA1. Require: SCTP_AUTH_SUPPORTED.
SCTP_AUTH_KEYβ sets a shared secret key that's used to build an association shared key. π
The parameter type is struct sctp_authkey, for writing only. sca_assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Default: null_key. Require: SCTP_AUTH_SUPPORTED.
SCTP_AUTH_ACTIVE_KEYβ gets or sets the active shared key used to build the association shared key.
The parameter type is struct sctp_authkeyid, for writing only. scact_assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Default: 0. Require: SCTP_AUTH_SUPPORTED.
SCTP_AUTH_DEACTIVATE_KEYβ this set option says the application will no longer send user messages using the indicated key identifier. π
The parameter type is struct sctp_authkeyid, for writing only. scact_assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Require: SCTP_AUTH_SUPPORTED.
SCTP_AUTH_DELETE_KEYβ this set option deletes an SCTP association's shared secret key that has already been deactivated. bye bestie π
The parameter type is struct sctp_authkeyid, for writing only. scact_assoc_id is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
Require: SCTP_AUTH_SUPPORTED.
SCTP_PEER_AUTH_CHUNKSβ gets a list of chunk types for a specified association that the peer requires to be received authenticated only. πΈ
The parameter type is struct sctp_authchunks, for reading only. gauth_assoc_id is a specified assoc_id.
Require: SCTP_AUTH_SUPPORTED.
SCTP_LOCAL_AUTH_CHUNKSβ gets a list of chunk types for a specified association that the local endpoint requires to be received authenticated only. π
The parameter type is struct sctp_authchunks, for reading only. gauth_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
Require: SCTP_AUTH_SUPPORTED.
SCTP_GET_ASSOC_NUMBERβ gets the current number of associations attached to a one-to-many style socket. β
Careful bestie, this number is only a snapshot. Meaning the number of associations may have totally changed by the time the caller gets back the option result. π
The parameter type is uint32_t, for reading only.
SCTP_GET_ASSOC_ID_LISTβ gets the current list of SCTP association identifiers of the SCTP associations handled by a one-to-many style socket. π It usesstruct sctp_assoc_idsand you must provide a buffer large enough to hold all the association identifiers. If the buffer is too small, an error must be returned. You can hit up theSCTP_GET_ASSOC_NUMBERsocket option to get an idea of how big that buffer has to be. π¦
The parameter type is struct sctp_assoc_ids, for reading only.
SCTP_EXPOSE_POTENTIALLY_FAILED_STATE,SCTP_EXPOSE_PF_STATEβ bestie this one is literally the PF-state privacy slider π it lets applications control the exposure of the PF path state in theSCTP_PEER_ADDR_CHANGEevent. Ifpf_exposeis not'enabled', no notification will be sent for a transport state change toSCTP_PF. It also affects theSCTP_GET_PEER_ADDR_INFOsocket option, and ifpf_exposeis'disabled', users can not access the transport info via theSCTP_GET_PEER_ADDR_INFOoption. So like, gatekeeping but make it a socket option π«Ά- param type:
struct sctp_assoc_value, for reading and writing assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC- Default:
sysctl_net.sctp.pf_expose
- param type:
SCTP_PEER_ADDR_THLDSβ lets applications control the SCTP-PF behavior by getting or setting the number of consecutive timeouts before a peer address is considered PF or unreachable. Counting strikes, basically β- param type:
struct sctp_paddrthlds, for reading and writing spt_addressis a specified transport address or0,spt_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC- Default:
pathmaxrxt=sysctl_net.sctp.path_max_retrans,ps_retrans=sysctl_net.sctp.ps_retrans
- param type:
SCTP_PEER_ADDR_THLDS_V2β same energy asSCTP_PEER_ADDR_THLDSβ¨ but it can also be used by applications to set and get the number of timeouts before the primary path is changed automatically by the Primary Path Switchover function. Glow up version, no cap.- param type:
struct sctp_paddrthlds_v2, for reading and writing spt_addressis a specified transport address or0,spt_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC- Default:
pathmaxrxt=sysctl_net.sctp.path_max_retrans,ps_retrans=sysctl_net.sctp.ps_retrans,pf_retrans=sysctl_net.sctp.pf_retrans
- param type:
SCTP_RECVRCVINFOβ setting this option specifies thatSCTP_RCVINFO(SCTP receive information about a received message) is returned as ancillary data byrecvmsg(). See CONTROL MSGS for more details, iykyk π- param type:
int, for reading and writing - Default:
0
- param type:
SCTP_RECVNXTINFOβ setting this option specifies thatSCTP_NXTINFO(SCTP receive information of the next message) is returned as ancillary data byrecvmsg(). See CONTROL MSGS for details. Peeking at what's next, main character behavior πΈ- param type:
int, for reading and writing - Default:
0
- param type:
SCTP_DEFAULT_SNDINFOβ okay so this option obsoletesSCTP_DEFAULT_SEND_PARAM, rip to that one πͺ¦- param type:
struct sctp_sndinfo. For reading,snd_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,snd_assoc_idis a specifiedassoc_idorSCTP_{FUTURE|CURRENT|ALL}_ASSOC - Default:
default_stream=0,default_flags=0,default_ppid=0,default_context=0
- param type:
SCTP_REUSE_PORTβ this option is similar to the socket level optionSO_REUSEADDR, besides only supports one-to-one style SCTP sockets and must not be used after callingbind()orsctp_bindx()π¨ so like, timing matters bestie.- param type:
int, for reading and writing - Default:
0
- param type:
SCTP_SOCKOPT_BINDX_ADDβ this option allows the user to bind a specific subset of addresses or, if the SCTP extension ASCONF is supported (seeSCTP_ASCONF_SUPPORTED), add specific addresses. The APIsctp_bindx()is based on this.- param type:
struct sockaddr[], for writing only
- param type:
SCTP_SOCKOPT_BINDX_REMβ similar toSCTP_SOCKOPT_BINDX_ADD, but delete specific addresses. The APIsctp_bindx()is based on this. Subtract era π- param type:
struct sockaddr[], for writing only
- param type:
SCTP_SOCKOPT_PEELOFFβ this option branches off an UDP type association into a separate socket returned back to users. The APIsctp_peeloff()is based on this option. It's giving "new socket, who dis" π¦- param type:
sctp_peeloff_arg_t, for reading only.associdis a specifiedassoc_id
- param type:
SCTP_SOCKOPT_PEELOFF_FLAGSβ peel off an UDP type association from a socket similar toSCTP_SOCKOPT_PEELOFFoption, but it allows the flags likeO_CLOEXECandO_NONBLOCKto be used when creating the new socket. The APIsctp_peeloff_flags()is based on this option. Same peel, extra sprinkles β¨- param type:
sctp_peeloff_flags_arg_t, for reading only.associdis a specifiedassoc_id
- param type:
SCTP_SOCKOPT_CONNECTX_OLDβ this option allows a user to specify multiple addresses at which a peer can be reached, and the kernel stack will use the list of addresses to set up the association. The APIsctp_connectx()is based on this option. The old one, respect your elders π- param type:
struct sockaddr[], for writing only
- param type:
SCTP_SOCKOPT_CONNECTXβ similar toSCTP_SOCKOPT_CONNECTX_OLD, but it returns the new assoc's id. The APIsctp_connectx2()is based on this option.- param type:
struct sockaddr[], for writing only. The new assoc's id is passed to users by the return value
- param type:
SCTP_SOCKOPT_CONNECTX3β similar toSCTP_SOCKOPT_CONNECTX, but it uses different type parameter. The APIsctp_connectx3()is based on this option. Third time's the charm, fr fr π₯- param type:
struct sctp_getaddrs_old, for reading only.assoc_idis set to the new assoc's id by kernel and passed to users
- param type:
SCTP_GET_PEER_ADDRSβ this option is used to gets all peer addresses in an association. The APIsctp_getpaddrs()is based on this option.- param type:
struct sctp_getaddrs, for reading only.assoc_idis a specifiedassoc_id
- param type:
SCTP_GET_LOCAL_ADDRSβ this option is used to get all local addresses in an association. The APIsctp_getladdrs()is based on this option.- param type:
struct sctp_getaddrs, for reading only.assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC
- param type:
SCTP_ADAPTATION_LAYERβ this option requests that the local endpoint set the specified Adaptation Layer Indication parameter for all future INIT and INIT-ACK exchanges. Setting the vibe for every future handshake π- param type:
struct sctp_setadaptation, for reading and writing - Default:
0
- param type:
SCTP_EVENTβ this option obsoletesSCTP_EVENTSsocket option, and it can set or get one specific type of event for a specified association. One event at a time, queen π- param type:
struct sctp_event. For reading,se_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,se_assoc_idis a specifiedassoc_idorSCTP_{FUTURE|CURRENT|ALL}_ASSOC.se_typecan be one ofenum sctp_sn_type - Default:
0
- param type:
SCTP_PR_SUPPORTEDβ this socket option allows the enabling or disabling of the negotiation of PR-SCTP support for future associations.- param type:
struct sctp_assoc_value. For reading,assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idisSCTP_FUTURE_ASSOC - Default:
sysctl_net.sctp.prsctp_enable - RFC: RFC7496
- param type:
SCTP_DEFAULT_PRINFOβ this option sets and gets the default parameters for PR-SCTP.- param type:
struct sctp_default_prinfo. For reading,pr_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,pr_assoc_idis a specifiedassoc_idorSCTP_{FUTURE|CURRENT|ALL}_ASSOC.pr_policycan beSCTP_PR_SCTP_{NONE|TTL|RTX|PRIO} - Default:
SCTP_PR_SCTP_NONE - Require:
SCTP_DEFAULT_PRINFO
- param type:
SCTP_PR_ASSOC_STATUSβ this option is used to get Association-Specific PR-SCTP Status. Receipts, but for PR-SCTP π§Ύ- param type:
struct sctp_prstatus, for reading only.sprstat_assoc_idis a specifiedassoc_id,sprstat_policycan beSCTP_PR_SCTP_{TTL|RTX|PRIO|ALL}
- param type:
SCTP_PR_STREAM_STATUSβ this option is used to get Stream-Specific PR-SCTP Status.- param type:
struct sctp_prstatus, for reading only.sprstat_assoc_idis a specifiedassoc_id,sprstat_policycan beSCTP_PR_SCTP_{TTL|RTX|PRIO|ALL}
- param type:
SCTP_RECONFIG_SUPPORTEDβ enable the Stream Reconfiguration(RECONF) for the future associations. For different type of requests enabling, seeSCTP_ENABLE_STREAM_RESEToption.- param type:
struct sctp_assoc_value. For reading,assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idisSCTP_FUTURE_ASSOC - Default:
sysctl_net.sctp.reconf_enable - RFC: RFC6525
- param type:
SCTP_ENABLE_STREAM_RESETβ this option allows a user to control whether the kernel processes or denies incoming requests in RECONF chunks. Bouncer energy, but for chunks πͺ- param type:
struct sctp_assoc_value. For reading,assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idis a specifiedassoc_idorSCTP_{FUTURE|CURRENT|ALL}_ASSOC.assoc_valuecan beSCTP_ENABLE_{RESET_STREAM_REQ|RESET_ASSOC_REQ|CHANGE_ASSOC_REQ} - Default:
0 - Require:
SCTP_RECONFIG_SUPPORTED
- param type:
SCTP_RESET_STREAMSβ this option allows the user to request the reset of incoming and/or outgoing streams. Fresh start, we love to see it π- param type:
struct sctp_reset_streams, for writing only.srs_assoc_idis a specifiedassoc_id - Require:
SCTP_ENABLE_STREAM_RESET
- param type:
SCTP_RESET_ASSOCβ this option allows a user to request the reset of the SSN/TSN. Clean slate, literally β¨- param type:
sctp_assoc_t, for writing only. It is a specifiedassoc_id - Require:
SCTP_ENABLE_STREAM_RESET
- param type:
SCTP_ADD_STREAMSβ this option allows a user to request the addition of a number of incoming and/or outgoing streams. More streams, more problems? no bestie, more streams more opportunities π- param type:
struct sctp_add_streams, for writing only.sas_assoc_idis a specifiedassoc_id - Require:
SCTP_ENABLE_STREAM_RESET
- param type:
SCTP_STREAM_SCHEDULERβ this option is used to select a stream scheduler for data sending. Choose your fighter π- param type:
struct sctp_assoc_value. For reading,assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idis a specifiedassoc_idorSCTP_{FUTURE|CURRENT|ALL}_ASSOC.assoc_valuecan beSCTP_SS_{FCFS|PRIO|RR|FC|WFQ} - Default:
SCTP_SS_FCFS - RFC: RFC8260
- param type:
SCTP_STREAM_SCHEDULER_VALUEβ some stream schedulers require additional information to be set for individual streams. Not every scheduler is low-maintenance, and that's okay π¦- param type:
struct sctp_assoc_value. For reading,assoc_idis a specifiedassoc_id. For writing,assoc_idis a specifiedassoc_idorSCTP_CURRENT_ASSOC - Require:
SCTP_STREAM_SCHEDULER
- param type:
SCTP_INTERLEAVING_SUPPORTEDβ okay so this one lets you enable or disable the negotiation of user message interleaving support for future associations. π- The parameter type is
struct sctp_assoc_value. - For reading,
assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idisSCTP_FUTURE_ASSOC. - Default:
sysctl_net.sctp.intl_enable. Require:SCTP_FRAGMENT_INTERLEAVE. RFC:RFC8260.
- The parameter type is
SCTP_ASCONF_SUPPORTEDβ this turns on Dynamic Address Reconfiguration(ASCONF) for the future associations. π- The parameter type is
struct sctp_assoc_value. - For reading,
assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idisSCTP_FUTURE_ASSOC. - Default:
sysctl_net.sctp.addip_enable. RFC:RFC5061.
- The parameter type is
SCTP_AUTO_ASCONFβ enables or disables the use of the automatic generation of ASCONF chunks to add and delete addresses to an existing association. π«Ά- Note that this option has two caveats, namely a) it only affects sockets that are bound to all addresses available to the SCTP stack, and b) the system administrator may have an overriding control that turns the ASCONF feature off no matter what setting the socket option may have.
- The parameter type is
intboolean, for reading and writing. - Default:
sysctl_net.sctp.default_auto_asconf.
SCTP_AUTH_SUPPORTEDβ enables AUTH for the future associations. β¨- The parameter type is
struct sctp_assoc_value. - For reading,
assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,ssoc_idisSCTP_FUTURE_ASSOC. (yes bestie,ssoc_idβ we are keeping the original spelling exactly, no cap π ) - Default:
sysctl_net.sctp.auth_enable. RFC:RFC4895.
- The parameter type is
SCTP_ECN_SUPPORTEDβ enables ECN for the future associations. π- The parameter type is
struct sctp_assoc_value. - For reading,
assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC. For writing,assoc_idisSCTP_FUTURE_ASSOC. - Default:
sysctl_net.sctp.ecn_enable.
- The parameter type is
SCTP_REMOTE_UDP_ENCAPS_PORTβ this option is used to set the encapsulation port (a remote listening or dest port) for SCTP over UDP, which allows SCTP traffic to pass through legacy NATs that do not provide native SCTP support. π¦- The parameter type is
struct sctp_udpencaps, for reading and writing. sue_addressis a specified transport address or0,sue_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC.- Default:
sysctl_net.sctp.encap_port. RFC:RFC6951.
- The parameter type is
SCTP_PLPMTUD_PROBE_INTERVALβ this option is used to configure thePROBE_INTERVALfor the Packetization Layer Path MTU Discovery(PLPMTUD). It can be set to a value>= 5000or0(disabled). π₯- The parameter type is
struct sctp_probeinterval, for reading and writing. spi_addressis a specified transport address or0,spi_assoc_idis a specifiedassoc_idorSCTP_FUTURE_ASSOC.- Default:
0(disabled). RFC:RFC8899.
- The parameter type is
π AUTHORS π
The iconic author of this page is Sridhar Samudrala <sri@us.ibm.com>. Give them their flowers, bestie. π
π SEE ALSO π
socket(7), socket(2), ip(7), bind(2), listen(2), accept(2), connect(2), sendmsg(2), recvmsg(2), sysctl(2), getsockopt(2), sctp_bindx(3), sctp_connectx(3), sctp_sendmsg(3), sctp_sendv(3), sctp_send(3), sctp_recvmsg(3), sctp_recvv(3), sctp_peeloff(3), sctp_getladdrs(3), sctp_getpaddrs(3), sctp_opt_info(3).
RFC2960, RFC3309 for the SCTP specification.
And that's the whole vibe, bestie β this page is from the Linux Man Page, dated 2005-10-25, and it's literally SCTP(7). Periodt. πβ¨π
π¦ where this page comes from
- arch rolling: lksctp-tools 1.0.21-1 Β· GPL-2.0-or-later AND LGPL-2.1-only
- centos-stream 10: lksctp-tools 1.0.21-1.el10 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- debian trixie: libsctp-dev 1.0.21+dfsg-1 Β· GPL-2.0-or-later
- fedora 43: lksctp-tools 1.0.21-1.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 43: lksctp-tools 1.0.21-1.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 44: lksctp-tools 1.0.21-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 44: lksctp-tools 1.0.21-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- nixos 26.05: lksctp-tools 1.0.21
- nixpkgs unstable: lksctp-tools 1.0.21
- opensuse-leap 16.0: lksctp-tools 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- ubuntu questing: libsctp-dev 1.0.21+dfsg-1build1
- ubuntu resolute: libsctp-dev 1.0.21+dfsg-1build2 Β· GPL-2.0-or-later
- ubuntu stonking: libsctp-dev 1.0.21+dfsg-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms