pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-pcap/+/39367?usp=email )
Change subject: server: Implement non-blocking write to pcap file with osmo_io
......................................................................
server: Implement non-blocking write to pcap file with osmo_io
Actual zero-copy msgb passing from read tcp socket will be implemented
in follow-up patches.
Change-Id: I098a9455a2a4cc626444e6fc13aa88c4cc9694f0
Related: SYS#7080
---
M include/osmo-pcap/osmo_pcap_server.h
M src/osmo_pcap_wr_file.c
M src/osmo_server_core.c
3 files changed, 173 insertions(+), 39 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/67/39367/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39367?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I098a9455a2a4cc626444e6fc13aa88c4cc9694f0
Gerrit-Change-Number: 39367
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, osmith.
Hello Jenkins Builder, laforge, osmith,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-pcap/+/39343?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review+1 by osmith
Change subject: server: Use osmo_stream_srv for non-tls read tcp sock
......................................................................
server: Use osmo_stream_srv for non-tls read tcp sock
TLS handling adds a lot of complexity, so TLS sockets are still read
through the previous code paths, and conversion to osmo_stream_srv is
left as a future improvement.
Related: SYS#7080
Depends: libosmo-netif.git Change-Id I6e8dd6ece13397074075f05a1a0a8dbdd80d8848
Depends: libosmo-netif.git Change-Id I80a1c4b227629e3ca0c8c587a103db6057322cb4
Depends: libosmocore.git Change-Id I6f9125916a301414301587f84fc3db98549a2f3f
Change-Id: I537620fcad6c8e65206a41a1c21bd4b6453fbed4
---
A TODO-RELEASE
M include/osmo-pcap/osmo_pcap_server.h
M src/osmo_server_core.c
M src/osmo_server_network.c
4 files changed, 113 insertions(+), 64 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/43/39343/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39343?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I537620fcad6c8e65206a41a1c21bd4b6453fbed4
Gerrit-Change-Number: 39343
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/39369?usp=email )
Change subject: stream: Add osmo_stream_srv_link_set_msgb_alloc_info()
......................................................................
stream: Add osmo_stream_srv_link_set_msgb_alloc_info()
This is needed so that user can set desired headroom+size info on
rx-allocated msgbs, so that osmo_stream_srv can inherit them upon
osmo_stream_srv_create2().
Manually obtaining the iofd through osmo_stream_srv_get_iofd() and
changing the params directly in the iofd produces undesired effects,
since the first msgbs are alredy allocated during
osmo_stream_srv_create2 (which calls osmo_iofd_register()) before the
object is available to the user.
As a result, first rx messages may come with unexpected size/headroom.
Ideally we'd had written the osmo_stream_srv APIs to have a 2 step
setup, eg _alloc() + _run()/_start(), but too late to do so now.
This approach is already follwed by existing
osmo_stream_srv_link_set_tx_queue_max_length() API.
Change-Id: I80a1c4b227629e3ca0c8c587a103db6057322cb4
---
M TODO-RELEASE
M include/osmocom/netif/stream.h
M src/stream_srv.c
3 files changed, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/69/39369/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index e66b421..dfdbd89 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -11,3 +11,4 @@
libosmo-netif add API osmo-stream_cli_set_tx_queue_max_length(), osmo_stream_srv_link_set_tx_queue_max_length()
libosmo-netif add API struct osmo_ipa_ka_fsm_inst
libosmo-netif add API osmo_stream_{cli,srv}_set_segmentation_cb2()
+libosmo-netif add API osmo_stream_srv_link_set_msgb_alloc_info()
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 2866ea3..951f42a 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -85,6 +85,7 @@
char *osmo_stream_srv_link_get_sockname(const struct osmo_stream_srv_link *link);
struct osmo_fd *osmo_stream_srv_link_get_ofd(struct osmo_stream_srv_link *link);
int osmo_stream_srv_link_get_fd(const struct osmo_stream_srv_link *link);
+int osmo_stream_srv_link_set_msgb_alloc_info(struct osmo_stream_srv_link *link, unsigned int size, unsigned int headroom);
bool osmo_stream_srv_link_is_opened(const struct osmo_stream_srv_link *link);
int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link);
void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link);
diff --git a/src/stream_srv.c b/src/stream_srv.c
index c2b187a..261539b 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -69,6 +69,15 @@
* Server side.
*/
+struct msgb_alloc_info {
+ /*! Whether it was set by user or we use iofd defaults */
+ bool set_by_user;
+ /*! size of msgb to allocate (excluding headroom) */
+ unsigned int size;
+ /*! headroom to allocate when allocating msgb's */
+ unsigned int headroom;
+};
+
#define OSMO_STREAM_SRV_F_RECONF (1 << 0)
#define OSMO_STREAM_SRV_F_NODELAY (1 << 1)
@@ -88,6 +97,7 @@
void *data;
int flags;
unsigned int tx_queue_max_length; /* Max amount of msgbs which can be enqueued */
+ struct msgb_alloc_info msgb_alloc;
struct osmo_sock_init2_multiaddr_pars ma_pars;
};
@@ -506,6 +516,26 @@
link->accept_cb = accept_cb;
}
+/*! Set the msgb allocation parameters on child osmo_stream_srv objects
+ * \param[in] link Stream Server Link
+ * \param[in] size Size of msgb to allocate (excluding headroom)
+ * \param[in] headroom Headroom to allocate when allocating msgb's
+ *
+ * The parameters are applied to osmo_stream_srv objects upon creation.
+ * Setting both to 0 leaves it as implementation default.
+ **/
+int osmo_stream_srv_link_set_msgb_alloc_info(struct osmo_stream_srv_link *link, unsigned int size, unsigned int headroom)
+{
+ if (size == 0 && headroom == 0) {
+ link->msgb_alloc.set_by_user = false;
+ } else {
+ link->msgb_alloc.set_by_user = true;
+ link->msgb_alloc.headroom = headroom;
+ link->msgb_alloc.size = size;
+ }
+ return 0;
+}
+
/*! Destroy the stream server link. Closes + Releases Memory.
* \param[in] link Stream Server Link */
void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link)
@@ -962,6 +992,8 @@
}
osmo_iofd_set_txqueue_max_length(conn->iofd, conn->srv->tx_queue_max_length);
+ if (conn->srv->msgb_alloc.set_by_user)
+ osmo_iofd_set_alloc_info(conn->iofd, conn->srv->msgb_alloc.size, conn->srv->msgb_alloc.headroom);
if (osmo_iofd_register(conn->iofd, fd) < 0) {
LOGSSRV(conn, LOGL_ERROR, "could not register FD %d\n", fd);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/39369?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I80a1c4b227629e3ca0c8c587a103db6057322cb4
Gerrit-Change-Number: 39369
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/39368?usp=email )
Change subject: msgb: msgb_copy_resize_c: Fix validation check to avoid memcpy buffer overflow
......................................................................
msgb: msgb_copy_resize_c: Fix validation check to avoid memcpy buffer overflow
If msg->data pointer is not allocated at the start of the msgb, (eg.
because it was pull()ed or had some headroom), the existing check
wouldn't catch it and memcpy() would write passed the allocated chunk
(msg->data - msg->_data) bytes.
Change-Id: If4c84162a4e5b44b82813fb58029fae04bd38230
---
M src/core/msgb.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/68/39368/1
diff --git a/src/core/msgb.c b/src/core/msgb.c
index 713510c..6f081bb 100644
--- a/src/core/msgb.c
+++ b/src/core/msgb.c
@@ -327,10 +327,10 @@
{
struct msgb *new_msg;
- if (new_len < msgb_length(msg)) {
+ if (new_len < (msg->data - msg->_data) + msgb_length(msg)) {
LOGP(DLGLOBAL, LOGL_ERROR,
- "Data from old msgb (%u bytes) won't fit into new msgb (%u bytes) after reallocation\n",
- msgb_length(msg), new_len);
+ "Data from old msgb (%u bytes at offset %u) won't fit into new msgb (%u total bytes) after reallocation\n",
+ msgb_length(msg), (uint16_t)(msg->data - msg->_data), new_len);
return NULL;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39368?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If4c84162a4e5b44b82813fb58029fae04bd38230
Gerrit-Change-Number: 39368
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, osmith, pespin.
Hello Jenkins Builder, laforge, osmith,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-pcap/+/39353?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review+1 by osmith, Verified-1 by Jenkins Builder
Change subject: server: Introduce struct osmo_pcap_wr_file
......................................................................
server: Introduce struct osmo_pcap_wr_file
This encloses file state and operation, allowing for further improvement
later on:
* Making non-blocking/async writes
* Writing to new file while finishing writes to previous files
Related: SYS#7080
Change-Id: I5244fbc7a5dc047e1f5f7b77954cbb9c1f610181
---
M include/osmo-pcap/osmo_pcap_server.h
M src/Makefile.am
A src/osmo_pcap_wr_file.c
M src/osmo_server_core.c
M src/osmo_server_network.c
M tests/rotate_localtime/Makefile.am
6 files changed, 226 insertions(+), 132 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/53/39353/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39353?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I5244fbc7a5dc047e1f5f7b77954cbb9c1f610181
Gerrit-Change-Number: 39353
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Attention is currently required from: daniel, jolly, laforge.
Hello Jenkins Builder, daniel, jolly, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/39363?usp=email
to look at the new patch set (#3).
Change subject: osmo_io: Support writing to files with mode OSMO_IO_FD_MODE_READ_WRITE
......................................................................
osmo_io: Support writing to files with mode OSMO_IO_FD_MODE_READ_WRITE
Trying to use IORING_OP_SENDMSG on local files fails with "Socket
operation on non-socket" errors.
Change-Id: Iefcbc7d09f429f4ecc611227cb5ef796f50c0539
---
M src/core/osmo_io_poll.c
M src/core/osmo_io_uring.c
M tests/osmo_io/osmo_io_test.c
M tests/osmo_io/osmo_io_test.ok
4 files changed, 136 insertions(+), 24 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/39363/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39363?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iefcbc7d09f429f4ecc611227cb5ef796f50c0539
Gerrit-Change-Number: 39363
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Attention is currently required from: daniel, jolly, laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/39363?usp=email )
Change subject: osmo_io: Support writing to files with mode OSMO_IO_FD_MODE_READ_WRITE
......................................................................
Patch Set 2:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39363?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iefcbc7d09f429f4ecc611227cb5ef796f50c0539
Gerrit-Change-Number: 39363
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 17 Jan 2025 15:45:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No