laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35063?usp=email )
Change subject: osmo_io: Reject unknown/unsupported modes in osmo_iofd_setup()
......................................................................
osmo_io: Reject unknown/unsupported modes in osmo_iofd_setup()
The current code does not check the value range of the 'mode' parameter
and would later run into OSMO_ASSERT(), rather than rejecting such a
mode from the very beginning.
Change-Id: I10dd612487638f456d0ad59c2cca203f1e098da3
Related: OS#5751
---
M src/core/osmo_io.c
1 file changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/35063/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 6677d34..c1a639a 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -448,6 +448,15 @@
if (!iofd)
return NULL;
+ /* reject unsupported/unknown modes */
+ switch (mode) {
+ case OSMO_IO_FD_MODE_READ_WRITE:
+ case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
+ break;
+ default:
+ return NULL;
+ }
+
iofd->fd = fd;
iofd->mode = mode;
IOFD_FLAG_SET(iofd, IOFD_FLAG_CLOSED);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35063?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I10dd612487638f456d0ad59c2cca203f1e098da3
Gerrit-Change-Number: 35063
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35062?usp=email )
Change subject: osmo_io: rename unsupported SCTP mode to OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND
......................................................................
osmo_io: rename unsupported SCTP mode to OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND
The two functions of the SCTP socket interface we use in osmo-* are
sctp_send() and sctp_recvmsg(). We do not use sctp_sendmsg() at all,
so let's make sure the mode is named correctly.
Change-Id: Ie2d1c7ce6f211dbe025a0e843ad733443102ea15
Related: OS#5751
---
M include/osmocom/core/osmo_io.h
M src/core/osmo_io.c
M src/core/osmo_io_poll.c
3 files changed, 19 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/35062/1
diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h
index b3d248f..46e1a53 100644
--- a/include/osmocom/core/osmo_io.h
+++ b/include/osmocom/core/osmo_io.h
@@ -21,8 +21,8 @@
OSMO_IO_FD_MODE_READ_WRITE,
/*! use recvfrom() / sendto() calls */
OSMO_IO_FD_MODE_RECVFROM_SENDTO,
- /*! emulate sctp_recvmsg() and sctp_sendmsg() */
- OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG,
+ /*! emulate sctp_recvmsg() and sctp_send() */
+ OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND,
};
enum osmo_io_backend {
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 05fb9fc..6677d34 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -337,7 +337,7 @@
case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
iofd->io_ops.recvfrom_cb(iofd, rc, msg, &hdr->osa);
break;
- case OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG:
+ case OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND:
/* TODO Implement */
OSMO_ASSERT(false);
break;
@@ -687,7 +687,7 @@
else
osmo_iofd_ops.read_disable(iofd);
break;
- case OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG:
+ case OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND:
default:
OSMO_ASSERT(0);
}
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index a9aaea4..2c1e422 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -98,7 +98,7 @@
case OSMO_IO_FD_MODE_RECVFROM_SENDTO:
iofd->io_ops.sendto_cb(iofd, rc, msg, &msghdr->osa);
break;
- case OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG:
+ case OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND:
OSMO_ASSERT(false);
break;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35062?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie2d1c7ce6f211dbe025a0e843ad733443102ea15
Gerrit-Change-Number: 35062
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
Attention is currently required from: fixeria.
jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35046?usp=email )
Change subject: soft_uart: add unit tests for the receiver and transmitter
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35046?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icdfa0c644548964d37940c32dc9dcfcfc53c3a19
Gerrit-Change-Number: 35046
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 18 Nov 2023 11:07:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35022?usp=email )
Change subject: soft_uart: rework osmo_uart_rx_bit() to use flow state
......................................................................
Patch Set 2:
(1 comment)
File src/core/soft_uart.c:
https://gerrit.osmocom.org/c/libosmocore/+/35022/comment/7ad7446c_7d9e634f
PS2, Line 128: suart->rx.shift_reg |= 0x80
Misaligned, as I stated in previous patch.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35022?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I40ab5d12b6f7087daa51405468f5c4ea639561ea
Gerrit-Change-Number: 35022
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 18 Nov 2023 11:06:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment