Feature #6077
closedDynamic reconfiguration of SCTP IP addresses & primary flag in an active SCTP association through VTY
100%
Description
Right now, libosmo-sccp allows configuring several "local-ip" and several "remote-ip" which will be used during SCTP association setup (socket(), sctp_bindx(), sctp_connectx(), 3-way handhsake, etc.).
It will eventually also support specifying the "primary" local & remote IP addresses, as described in #6076.
local-ip:¶
SCTP also supports dynamic addition and removal of IP addresses locally as well as announcing those changes to the peer, as per what's described in RFC5061, using the ASCONF/ASCONF-ACK messages.
The linux kernel seems to be implementing those SCTP messages/procedures on the wire.
Furthermore, the kernel allows adding and removing IP addresses on an already created association by using setsockopt(SCTP_SOCKOPT_BINDX_ADD|SCTP_SOCKOPT_BINDX_REM).
These kernel sockopts are used internally by libsctp, which is expected to be used through sctp_bindx() (/usr/include/netinet/sctp.h):
int sctp_bindx(int sd, struct sockaddr * addrs, int addrcnt, int flags); The flags parameter can be either SCTP_BINDX_ADD_ADDR or SCTP_BINDX_REM_ADDR. An application can use SCTP_BINDX_ADD_ADDR to associate additional ad‐ dresses with an endpoint after calling bind(2). SCTP_BINDX_REM_ADDR directs SCTP to remove the given addresses from the association. A caller may not remove all addresses from an association. It will fail with EINVAL.Hence, if the asociation for the related "asp" is already connected (socket created), extra work is done:
- if "no local-ip A.B.C.D" is used, "sctp_bindx(fd, addr, 1, SCTP_BINDX_REM_ADDR);" is called (after checking the addr is in the list)
- if "local-ip A.B.C.D" is used:
- If the IP address is not in the list, "sctp_bindx(fd, addr, 1, SCTP_BINDX_ADD_ADDR);" is called.
- if "local-ip A.B.C.D primary" is used:
- If the IP address is not in the list, "sctp_bindx(fd, addr, 1, SCTP_BINDX_ADD_ADDR);" is as the primary flag is applied (setsockopt(SCTP_SET_PEER_PRIMARY_ADDR)).
- If the IP address is in the list, the primary flag is applied (setsockopt(SCTP_SET_PEER_PRIMARY_ADDR)).
remote-ip:¶
- In here changing the IP address doesn't make much sense since the remote-ip configured is only really used to do the initial 3-way handshake. Once connected, the SCTP association uses the remote address list received in INIT/INIT-ACK.
- Setting the primary flag calls (setsockopt(SCTP_SET_PRIMARY_ADDR).
Related RFCs:
https://datatracker.ietf.org/doc/html/rfc4960
https://www.rfc-editor.org/rfc/rfc5061
Related issues
Updated by pespin about 1 year ago
- Related to Feature #6076: Configure SCTP primary path explicitly (local-ip A.B.C.D [primary] && remote-ip A.B.C.D [primary]) added
Updated by pespin 10 months ago
- % Done changed from 0 to 50
libosmocore patch to add/del addresses to an active socket can be found here:
https://gerrit.osmocom.org/c/libosmocore/+/34607 socket: Introduce APIs osmo_sock_multiaddr_{add,del}_local_addr()
Updated by pespin 10 months ago
- Status changed from In Progress to Feedback
- % Done changed from 50 to 90
Implemented by:
https://gerrit.osmocom.org/c/libosmo-sccp/+/34609 asp: Apply SCTP primary address changes after the ASP was started
https://gerrit.osmocom.org/c/libosmo-sccp/+/34610 asp: Apply SCTP peer primary address changes after the ASP was started
https://gerrit.osmocom.org/c/libosmo-sccp/+/34611 asp: Support adding new local addresses after the ASP was started
https://gerrit.osmocom.org/c/libosmo-sccp/+/34612 asp: Support removing local & remote addresses
https://gerrit.osmocom.org/c/libosmo-sccp/+/34613 xua_server: asp: Support removing local addresses