aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-09-08 13:15:54 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-09-08 13:15:56 +0200
commit839c90e149ffb3ad73a3e0ff6cf8ef416bc44a73 (patch)
tree0652f82279c88cb23812a0c294c05dd10782dd5c
parent23f7d850a33301a4719f36ba78f5a05f4837a953 (diff)
stream: Use new libosmocore API osmo_sock_init2_multiaddr2()
Use the new API available in libosmocore to set sockopts related to ASCONF SCTP features. The old flag OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED has been dropped. This only affects master builds since there's no release ever done with that flag defined. Depends: libosmocore.git Change-Id I1f6fd09a79b0a2bd794e5669d933be25bbf1eeaa Related: SYS#6501 Related: SYS#6558 Change-Id: I2b2073de72625b4f4f99892179c9406163d28592
-rw-r--r--TODO-RELEASE2
-rw-r--r--src/stream_cli.c30
-rw-r--r--src/stream_srv.c16
3 files changed, 40 insertions, 8 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index a4b381f..830e77b 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,5 +7,5 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
-libosmocore >1.8.0 osmo_iofd
+libosmocore >1.8.0 osmo_iofd, osmo_sock_init2_multiaddr2()
stream NEW API osmo_stream_srv_link_set_name(), osmo_stream_srv_set_name(), osmo_stream_cli_set_name() \ No newline at end of file
diff --git a/src/stream_cli.c b/src/stream_cli.c
index b5ef66c..8f18bfb 100644
--- a/src/stream_cli.c
+++ b/src/stream_cli.c
@@ -733,6 +733,9 @@ void osmo_stream_cli_destroy(struct osmo_stream_cli *cli)
*/
int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect)
{
+#ifdef HAVE_LIBSCTP
+ struct osmo_sock_init2_multiaddr_pars ma_pars;
+#endif
int ret;
/* we are reconfiguring this socket, close existing first. */
@@ -744,10 +747,18 @@ int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect)
switch (cli->proto) {
#ifdef HAVE_LIBSCTP
case IPPROTO_SCTP:
- ret = osmo_sock_init2_multiaddr(AF_UNSPEC, SOCK_STREAM, cli->proto,
+ ma_pars = (struct osmo_sock_init2_multiaddr_pars){
+ .sctp = {
+ .version = 0,
+ .sockopt_auth_supported = {.set = true, .abort_on_failure = false, .value = 1 },
+ .sockopt_asconf_supported = {.set = true, .abort_on_failure = false, .value = 1 },
+ }
+ };
+ ret = osmo_sock_init2_multiaddr2(AF_UNSPEC, SOCK_STREAM, cli->proto,
(const char **)cli->local_addr, cli->local_addrcnt, cli->local_port,
(const char **)cli->addr, cli->addrcnt, cli->port,
- OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK|OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED);
+ OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK,
+ &ma_pars);
break;
#endif
default:
@@ -805,6 +816,9 @@ void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay)
* \return negative on error, 0 on success */
int osmo_stream_cli_open(struct osmo_stream_cli *cli)
{
+#ifdef HAVE_LIBSCTP
+ struct osmo_sock_init2_multiaddr_pars ma_pars;
+#endif
int ret, fd = -1;
/* we are reconfiguring this socket, close existing first. */
@@ -823,10 +837,18 @@ int osmo_stream_cli_open(struct osmo_stream_cli *cli)
switch (cli->proto) {
#ifdef HAVE_LIBSCTP
case IPPROTO_SCTP:
- ret = osmo_sock_init2_multiaddr(cli->sk_domain, cli->sk_type, cli->proto,
+ ma_pars = (struct osmo_sock_init2_multiaddr_pars){
+ .sctp = {
+ .version = 0,
+ .sockopt_auth_supported = {.set = true, .abort_on_failure = false, .value = 1 },
+ .sockopt_asconf_supported = {.set = true, .abort_on_failure = false, .value = 1 },
+ }
+ };
+ ret = osmo_sock_init2_multiaddr2(cli->sk_domain, cli->sk_type, cli->proto,
(const char **)cli->local_addr, cli->local_addrcnt, cli->local_port,
(const char **)cli->addr, cli->addrcnt, cli->port,
- OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK|OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED);
+ OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK,
+ &ma_pars);
break;
#endif
default:
diff --git a/src/stream_srv.c b/src/stream_srv.c
index f46175b..9818864 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -387,6 +387,9 @@ void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link)
* \return negative on error, 0 on success */
int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link)
{
+#ifdef HAVE_LIBSCTP
+ struct osmo_sock_init2_multiaddr_pars ma_pars;
+#endif
int ret;
if (link->ofd.fd >= 0) {
@@ -409,9 +412,16 @@ int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link)
switch (link->proto) {
#ifdef HAVE_LIBSCTP
case IPPROTO_SCTP:
- ret = osmo_sock_init2_multiaddr(link->sk_domain, link->sk_type, link->proto,
- (const char **)link->addr, link->addrcnt, link->port,
- NULL, 0, 0, OSMO_SOCK_F_BIND|OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED);
+ ma_pars = (struct osmo_sock_init2_multiaddr_pars){
+ .sctp = {
+ .version = 0,
+ .sockopt_auth_supported = {.set = true, .abort_on_failure = false, .value = 1 },
+ .sockopt_asconf_supported = {.set = true, .abort_on_failure = false, .value = 1 },
+ }
+ };
+ ret = osmo_sock_init2_multiaddr2(link->sk_domain, link->sk_type, link->proto,
+ (const char **)link->addr, link->addrcnt, link->port,
+ NULL, 0, 0, OSMO_SOCK_F_BIND, &ma_pars);
break;
#endif
default: