Skip to content

Conversation

@bmk
Copy link
Contributor

@bmk bmk commented Nov 20, 2025

Add SCTP support to socket.
This is experimental for now.
This branch is actually based on 28.0, but this cannot be spec'ed above.
There are still some issues with bind/3 on FreeBSD.
The example is not complete.

bmk added 12 commits November 20, 2025 10:48
* Add prim_socket:bind/3
* Add peeloff
* Add socknames/2 and peernames/2
* Connect with list of addresses (connectx)
* Add gitopt/3

OTP-19834
* Update for SOLARIS
* Add tests for more event(s) subscribe
  Add configure tests for more event(s) subscribe.

OTP-19834
* Add command callback function to the I/O backend(s)
* Add support for bind/3 (bindx)
* Verify that bindx is available
* Add SCTP connect
* Add peeloff
* Add socknames/2 and peernames/2
* Add support for various option(s)
  Add support for option 'set primary addr', 'primary addr', 'adaptation-layer',
  ''i-want-mapped-v4-addr', status and 'peer-address-parameters'.
* Add options and add/update sctp types
  Add support for option 'default-send-param'
  Add support for option 'get-assoc-stats'
* Fixes for FreeBSD
   The member (field) names of the type 'struct sctp_send_failed_event'
   differ for linux and FreeBSD. Add some if-def'ing to glue it together.
* Encoding (send-failed-event) flags
* Add getopt function with value argument
* If-def'ing for SOLARIS
* FreeBSD if-def tweaking
* Add support for various events
  Add support for assoc-reset, stream change and stream reset event(s).
* Fixed sending with empty iov
*  Solaris does not (seem to) allow sending a message
    with sendmsg with an empty iov (a message with *only*
    ctrl data). So fake it on Solaris.
* Add error code translation

OTP-19834
* Add SCTP connect
* Add peeloff
* Add socknames/2 and peernames/2
* Add options and add/update sctp types
* Add and document SCTP type(s)
* Add sctp listen clause
* Add getopt/3 with value arg
* Peeloff
* Remove use of "old style getopt/3"
* Add support for varous event(s)

OTP-19834
Removed use of "old style" getopt/3

OTP-19834
Some of the SCTP socket options require a value (with assoc-id
and maybe other parts). Thses options cannot be retrieved here
since we do not have the "values".

OTP-19834
@bmk bmk changed the base branch from master to maint November 20, 2025 09:56
@bmk bmk requested a review from RaimoNiskanen November 20, 2025 09:57
@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Nov 24, 2025
* If we don *not* have sctp support,
* then this will never actually be used.
*/
typedef int ESockAssocId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not used; why is it needed?

local_rwnd := 0..16#ffffffff,
cookie_life := 0..16#ffffffff}.
#{assoc_id := sctp_assoc_id(),
asocmaxrxt := 0..16#ffff,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should have types a'la uint16(), uint32() and so on, probably defined in socket.

-type msg_recv() :: msg_data_recv() | msg_notification_recv().


-type sctp_notification() :: sctp_notif_assoc_change() |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In RFC 6458 these are named for example sctp_assoc_change without the _notif infix. Shouldn't these too?

cant_str_assoc |
integer().

-type sctp_rfc4960_error() :: unknown |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named just sctp_error() or sctp_operation_error(). I don't think rfc_4960 belongs here. More error codes for SCTP Operation Error:s may be added in other RFC:s.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sctp_operation_error()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference the standard (RFC 4960) in the type doc

-type sctp_notif_remote_error() ::
#{type := remote_error,
flags := 0..16#FFFF, % Should be [flag()]
error := integer(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this field be decoded into a sctp_operation_error()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:PS Assigned to OTP team PS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants