laforge has uploaded this change for review.
stream_{cli,srv}: Add support for SCTP in OSMO_IO mode
Let's enable the OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND mode for SCTP
sockets, allowing OSMO_STREAM_MODE_OSMO_IO to be used with SCTP.
Change-Id: I6cf5bad5f618e71c80017960c38009b089dbd6a1
Depends: libosmocore Change-Id: I89eb519b22d21011d61a7855b2364bc3c295df82
Closes: OS#5753
---
M TODO-RELEASE
M src/stream_cli.c
M src/stream_srv.c
3 files changed, 26 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/69/35069/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..8b70043 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# 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
+libosmo-netif update-dependency libosmocore > 1.9.0 required for I89eb519b22d21011d61a7855b2364bc3c295df82
diff --git a/src/stream_cli.c b/src/stream_cli.c
index ef571cc..0be897f 100644
--- a/src/stream_cli.c
+++ b/src/stream_cli.c
@@ -890,8 +890,12 @@
goto error_close_socket;
break;
case OSMO_STREAM_MODE_OSMO_IO:
- if (!cli->iofd)
- cli->iofd = osmo_iofd_setup(cli, fd, cli->name, OSMO_IO_FD_MODE_READ_WRITE, &osmo_stream_cli_ioops, cli);
+ if (!cli->iofd) {
+ enum osmo_io_fd_mode iofd_mode = OSMO_IO_FD_MODE_READ_WRITE;
+ if (cli->proto == IPPROTO_SCTP)
+ iofd_mode = OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND;
+ cli->iofd = osmo_iofd_setup(cli, fd, cli->name, iofd_mode, &osmo_stream_cli_ioops, cli);
+ }
if (!cli->iofd)
goto error_close_socket;
configure_cli_segmentation_cb(cli->iofd, cli->segmentation_cb);
diff --git a/src/stream_srv.c b/src/stream_srv.c
index 1370e42..2677d38 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -724,9 +724,13 @@
osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data)
{
struct osmo_stream_srv *conn;
+ enum osmo_io_fd_mode iofd_mode = OSMO_IO_FD_MODE_READ_WRITE;
OSMO_ASSERT(link);
+ if (link->proto == IPPROTO_SCTP)
+ iofd_mode = OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND;
+
conn = talloc_zero(ctx, struct osmo_stream_srv);
if (conn == NULL)
return NULL;
@@ -736,8 +740,7 @@
osmo_sock_get_name_buf(conn->sockname, sizeof(conn->sockname), fd);
- conn->iofd = osmo_iofd_setup(conn, fd, conn->sockname,
- OSMO_IO_FD_MODE_READ_WRITE, &srv_ioops, conn);
+ conn->iofd = osmo_iofd_setup(conn, fd, conn->sockname, iofd_mode, &srv_ioops, conn);
if (!conn->iofd) {
talloc_free(conn);
return NULL;
To view, visit change 35069. To unsubscribe, or for help writing mail filters, visit settings.