lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

February 2024

  • 1 participants
  • 1748 discussions
[S] Change in libosmocore[master]: osmo_io_uring: Cancel pending request, free msghdr on completion
by laforge 29 Feb '24

29 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35981?usp=email ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: osmo_io_uring: Cancel pending request, free msghdr on completion ...................................................................... osmo_io_uring: Cancel pending request, free msghdr on completion There is always a completion after cancelling a uring request. Because uring requests use msghdr pointer as user data, we cannot just free the msghdr after cancelling. Upon completion (received after cancelling), the user data still points to the msghdr. To prevent a use-after-free bug, msghdr is not freed, but detached from iofd instance. Then upon completion, the msghdr (if it was detached from iofd) is freed. Additionally it is not required to keep IOFD_FLAG_IN_CALLBACK set anymore, if there is a msghdr attached to iofd. As described above, all msghdr get detached, if iofd is freed (uring request get cancelled) during callback. Related: OS#5751 Change-Id: Ic253f085dd6362db85f029f46350951472210a02 --- M src/core/osmo_io_uring.c 1 file changed, 43 insertions(+), 4 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve daniel: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index af1c790..3812b50 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -230,8 +230,7 @@ OSMO_ASSERT(0) } - if (!iofd->u.uring.read_msghdr && !iofd->u.uring.write_msghdr) - IOFD_FLAG_UNSET(iofd, IOFD_FLAG_IN_CALLBACK); + IOFD_FLAG_UNSET(iofd, IOFD_FLAG_IN_CALLBACK); if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_TO_FREE) && !iofd->u.uring.read_msghdr && !iofd->u.uring.write_msghdr) talloc_free(iofd); @@ -252,6 +251,11 @@ io_uring_cqe_seen(ring, cqe); continue; } + if (!msghdr->iofd) { + io_uring_cqe_seen(ring, cqe); + iofd_msghdr_free(msghdr); + continue; + } rc = cqe->res; /* Hand the entry back to the kernel before */ @@ -307,20 +311,31 @@ static int iofd_uring_unregister(struct osmo_io_fd *iofd) { struct io_uring_sqe *sqe; + struct iofd_msghdr *msghdr; + if (iofd->u.uring.read_msghdr) { + msghdr = iofd->u.uring.read_msghdr; sqe = io_uring_get_sqe(&g_ring.ring); OSMO_ASSERT(sqe != NULL); io_uring_sqe_set_data(sqe, NULL); LOGPIO(iofd, LOGL_DEBUG, "Cancelling read\n"); - io_uring_prep_cancel(sqe, iofd->u.uring.read_msghdr, 0); + iofd->u.uring.read_msghdr = NULL; + talloc_steal(OTC_GLOBAL, msghdr); + msghdr->iofd = NULL; + io_uring_prep_cancel(sqe, msghdr, 0); } if (iofd->u.uring.write_msghdr) { + msghdr = iofd->u.uring.write_msghdr; sqe = io_uring_get_sqe(&g_ring.ring); OSMO_ASSERT(sqe != NULL); io_uring_sqe_set_data(sqe, NULL); LOGPIO(iofd, LOGL_DEBUG, "Cancelling write\n"); - io_uring_prep_cancel(sqe, iofd->u.uring.write_msghdr, 0); + iofd->u.uring.write_msghdr = NULL; + talloc_steal(OTC_GLOBAL, msghdr); + msgb_free(msghdr->msg); + msghdr->iofd = NULL; + io_uring_prep_cancel(sqe, msghdr, 0); } io_uring_submit(&g_ring.ring); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35981?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: Ic253f085dd6362db85f029f46350951472210a02 Gerrit-Change-Number: 35981 Gerrit-PatchSet: 9 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: osmo_io_uring: Detach msghdr from iofd before calling iofd_handle_sen...
by laforge 29 Feb '24

29 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35982?usp=email ) Change subject: osmo_io_uring: Detach msghdr from iofd before calling iofd_handle_send_completion() ...................................................................... osmo_io_uring: Detach msghdr from iofd before calling iofd_handle_send_completion() msghdr must be detached, because subsequent callback at iofd_handle_send_completion() may destroy the iofd (which in turn frees this msghdr, if still attached) and frees the msghdr, causing a double free. Related: OS#5751 Change-Id: Ia349f73de2145fa360b20dd40deb73a8ffc71f07 --- M src/core/osmo_io_uring.c 1 file changed, 24 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index 3812b50..cb636da 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -195,6 +195,15 @@ { struct osmo_io_fd *iofd = msghdr->iofd; + /* Detach msghdr from iofd. It might get freed here or it is freed during iofd_handle_send_completion(). + * If there is pending data to send, iofd_uring_submit_tx() will attach it again. + * iofd_handle_send_completion() will invoke a callback function to signal the possibility of write/send. + * This callback function might close iofd, leading to the potential freeing of iofd->u.uring.write_msghdr if + * still attached. Since iofd_handle_send_completion() frees msghdr at the end of the function, detaching + * msghdr here prevents a double-free bug. */ + if (iofd->u.uring.write_msghdr == msghdr) + iofd->u.uring.write_msghdr = NULL; + if (OSMO_UNLIKELY(IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))) { msgb_free(msghdr->msg); iofd_msghdr_free(msghdr); @@ -202,7 +211,6 @@ iofd_handle_send_completion(iofd, rc, msghdr); } - iofd->u.uring.write_msghdr = NULL; /* submit the next to-be-transmitted message for this file descriptor */ if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) iofd_uring_submit_tx(iofd); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35982?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: Ia349f73de2145fa360b20dd40deb73a8ffc71f07 Gerrit-Change-Number: 35982 Gerrit-PatchSet: 9 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: osmo_io_poll: Declare local functions "static"
by laforge 29 Feb '24

29 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35983?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: osmo_io_poll: Declare local functions "static" ...................................................................... osmo_io_poll: Declare local functions "static" Change-Id: I6ba88cd7bbd5b5ef42eb460679696f105c9158cb --- M src/core/osmo_io_poll.c 1 file changed, 17 insertions(+), 8 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c index 74f137b..2e726d9 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -123,7 +123,7 @@ return 0; } -int iofd_poll_register(struct osmo_io_fd *iofd) +static int iofd_poll_register(struct osmo_io_fd *iofd) { struct osmo_fd *ofd = &iofd->u.poll.ofd; int rc; @@ -137,7 +137,7 @@ return rc; } -int iofd_poll_unregister(struct osmo_io_fd *iofd) +static int iofd_poll_unregister(struct osmo_io_fd *iofd) { struct osmo_fd *ofd = &iofd->u.poll.ofd; @@ -149,7 +149,7 @@ return 0; } -int iofd_poll_close(struct osmo_io_fd *iofd) +static int iofd_poll_close(struct osmo_io_fd *iofd) { iofd_poll_unregister(iofd); osmo_fd_close(&iofd->u.poll.ofd); @@ -157,27 +157,27 @@ return 0; } -void iofd_poll_read_enable(struct osmo_io_fd *iofd) +static void iofd_poll_read_enable(struct osmo_io_fd *iofd) { osmo_fd_read_enable(&iofd->u.poll.ofd); } -void iofd_poll_read_disable(struct osmo_io_fd *iofd) +static void iofd_poll_read_disable(struct osmo_io_fd *iofd) { osmo_fd_read_disable(&iofd->u.poll.ofd); } -void iofd_poll_write_enable(struct osmo_io_fd *iofd) +static void iofd_poll_write_enable(struct osmo_io_fd *iofd) { osmo_fd_write_enable(&iofd->u.poll.ofd); } -void iofd_poll_write_disable(struct osmo_io_fd *iofd) +static void iofd_poll_write_disable(struct osmo_io_fd *iofd) { osmo_fd_write_disable(&iofd->u.poll.ofd); } -void iofd_poll_notify_connected(struct osmo_io_fd *iofd) +static void iofd_poll_notify_connected(struct osmo_io_fd *iofd) { int rc; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35983?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: I6ba88cd7bbd5b5ef42eb460679696f105c9158cb Gerrit-Change-Number: 35983 Gerrit-PatchSet: 9 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: Use poll/select to notify socket connection at osmo_io_uring.c
by laforge 29 Feb '24

29 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35910?usp=email ) ( 8 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: osmo_io: Use poll/select to notify socket connection at osmo_io_uring.c ...................................................................... osmo_io: Use poll/select to notify socket connection at osmo_io_uring.c In order to receive a connect notification from SCTP socket, poll/select event must be used instead of a write notification via io_uring completion event. Once the connect notification has been received, subsequent write notifications via io_uring are used. Change-Id: I4eca9ea72beb0d6ea4d44cce81ed620033f07270 Related: OS#5751 --- M src/core/osmo_io_internal.h M src/core/osmo_io_uring.c 2 files changed, 93 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h index af47a3d..a4b0749 100644 --- a/src/core/osmo_io_internal.h +++ b/src/core/osmo_io_internal.h @@ -104,6 +104,8 @@ void *read_msghdr; void *write_msghdr; /* TODO: index into array of registered fd's? */ + /* osmo_fd for non-blocking connect handling */ + struct osmo_fd connect_ofd; } uring; } u; }; diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index aa9df85..af1c790 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -324,6 +324,11 @@ } io_uring_submit(&g_ring.ring); + if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) { + osmo_fd_unregister(&iofd->u.uring.connect_ofd); + IOFD_FLAG_UNSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED); + } + return 0; } @@ -334,6 +339,10 @@ if (iofd->u.uring.write_msghdr) return; + /* This function is called again, once the socket is connected. */ + if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) + return; + if (osmo_iofd_txqueue_len(iofd) > 0) iofd_uring_submit_tx(iofd); else if (iofd->mode == OSMO_IO_FD_MODE_READ_WRITE) { @@ -379,6 +388,10 @@ if (iofd->u.uring.read_msghdr) return; + /* This function is called again, once the socket is connected. */ + if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) + return; + switch (iofd->mode) { case OSMO_IO_FD_MODE_READ_WRITE: iofd_uring_submit_recv(iofd, IOFD_ACT_READ); @@ -407,6 +420,66 @@ return close(iofd->fd); } +/* called via osmocom poll/select main handling once outbound non-blocking connect() completes */ +static int iofd_uring_connected_cb(struct osmo_fd *ofd, unsigned int what) +{ + struct osmo_io_fd *iofd = ofd->data; + + LOGPIO(iofd, LOGL_DEBUG, "Socket connected or failed."); + + if (!(what & OSMO_FD_WRITE)) + return 0; + + /* Unregister from poll/select handling. */ + osmo_fd_unregister(ofd); + IOFD_FLAG_UNSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED); + + /* Notify the application about this via a zero-length write completion call-back. */ + IOFD_FLAG_SET(iofd, IOFD_FLAG_IN_CALLBACK); + switch (iofd->mode) { + case OSMO_IO_FD_MODE_READ_WRITE: + iofd->io_ops.write_cb(iofd, 0, NULL); + break; + case OSMO_IO_FD_MODE_RECVFROM_SENDTO: + iofd->io_ops.sendto_cb(iofd, 0, NULL, NULL); + break; + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: + iofd->io_ops.sendmsg_cb(iofd, 0, NULL); + break; + } + IOFD_FLAG_UNSET(iofd, IOFD_FLAG_IN_CALLBACK); + + /* If write/read notifications are pending, enable it now. */ + if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) + iofd_uring_write_enable(iofd); + if (iofd->u.uring.read_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) + iofd_uring_read_enable(iofd); + + if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_TO_FREE) && !iofd->u.uring.read_msghdr && !iofd->u.uring.write_msghdr) + talloc_free(iofd); + return 0; +} + +static void iofd_uring_notify_connected(struct osmo_io_fd *iofd) +{ + if (iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG) { + /* Don't call this function after enabling read or write. */ + OSMO_ASSERT(!iofd->u.uring.write_enabled && !iofd->u.uring.read_enabled); + + /* Use a temporary osmo_fd which we can use to notify us once the connection is established + * or failed (indicated by FD becoming writable). + * This is needed as (at least for SCTP sockets) one cannot submit a zero-length writev/sendmsg + * in order to get notification when the socekt is writable.*/ + if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED)) { + osmo_fd_setup(&iofd->u.uring.connect_ofd, iofd->fd, OSMO_FD_WRITE, + iofd_uring_connected_cb, iofd, 0); + osmo_fd_register(&iofd->u.uring.connect_ofd); + IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED); + } + } else + iofd_uring_write_enable(iofd); +} + const struct iofd_backend_ops iofd_uring_ops = { .register_fd = iofd_uring_register, .unregister_fd = iofd_uring_unregister, @@ -415,7 +488,7 @@ .write_disable = iofd_uring_write_disable, .read_enable = iofd_uring_read_enable, .read_disable = iofd_uring_read_disable, - .notify_connected = iofd_uring_write_enable, + .notify_connected = iofd_uring_notify_connected, }; #endif /* defined(__linux__) */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35910?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: I4eca9ea72beb0d6ea4d44cce81ed620033f07270 Gerrit-Change-Number: 35910 Gerrit-PatchSet: 9 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: Move notify_connected function to backend
by laforge 29 Feb '24

29 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35909?usp=email ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: osmo_io: Move notify_connected function to backend ...................................................................... osmo_io: Move notify_connected function to backend This relocation is necessary as the backend (osmo_io_fd or osmo_io_uring) requires a different approach in handling connect notifications. As a result, a function call has been introduced to struct iofd_backend_ops. In a subsequent patch, the process for the osmo_io_uring backend will be modified to handle SCTP connect notifications using poll/select. If connect notification is requested using poll/select, the file descriptior must be registered to osmo_fd, using osmo_fd_register. If read / write notification is requested by application, the file descriptior must be registered also. A flag is used prevent calling osmo_fd_register / osmo_fd_unregister multiple times, which would cause a crash. Change-Id: I905ec85210570aff8addadfc9603335d04eb057a Related: OS#5751 --- M src/core/osmo_io.c M src/core/osmo_io_internal.h M src/core/osmo_io_poll.c M src/core/osmo_io_uring.c 4 files changed, 54 insertions(+), 2 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index 9de9e2e..71249cf 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -781,7 +781,8 @@ void osmo_iofd_notify_connected(struct osmo_io_fd *iofd) { OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE); - osmo_iofd_ops.write_enable(iofd); + OSMO_ASSERT(osmo_iofd_ops.notify_connected); + osmo_iofd_ops.notify_connected(iofd); } diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h index e8f4ea2..9c86e05 100644 --- a/src/core/osmo_io_internal.h +++ b/src/core/osmo_io_internal.h @@ -31,12 +31,14 @@ void (*write_disable)(struct osmo_io_fd *iofd); void (*read_enable)(struct osmo_io_fd *iofd); void (*read_disable)(struct osmo_io_fd *iofd); + void (*notify_connected)(struct osmo_io_fd *iofd); }; #define IOFD_FLAG_CLOSED (1<<0) #define IOFD_FLAG_IN_CALLBACK (1<<1) #define IOFD_FLAG_TO_FREE (1<<2) #define IOFD_FLAG_NOTIFY_CONNECTED (1<<3) +#define IOFD_FLAG_FD_REGISTERED (1<<4) #define IOFD_FLAG_SET(iofd, flag) \ (iofd)->flags |= (flag) diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c index d7f80c0..8398a30 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -119,20 +119,32 @@ int iofd_poll_register(struct osmo_io_fd *iofd) { struct osmo_fd *ofd = &iofd->u.poll.ofd; + int rc; + + if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) + return 0; osmo_fd_setup(ofd, iofd->fd, 0, &iofd_poll_ofd_cb_dispatch, iofd, 0); - return osmo_fd_register(ofd); + rc = osmo_fd_register(ofd); + if (!rc) + IOFD_FLAG_SET(iofd, IOFD_FLAG_FD_REGISTERED); + return rc; } int iofd_poll_unregister(struct osmo_io_fd *iofd) { struct osmo_fd *ofd = &iofd->u.poll.ofd; + + if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) + return 0; osmo_fd_unregister(ofd); + IOFD_FLAG_UNSET(iofd, IOFD_FLAG_FD_REGISTERED); return 0; } int iofd_poll_close(struct osmo_io_fd *iofd) { + iofd_poll_unregister(iofd); osmo_fd_close(&iofd->u.poll.ofd); return 0; @@ -158,6 +170,16 @@ osmo_fd_write_disable(&iofd->u.poll.ofd); } +void iofd_poll_notify_connected(struct osmo_io_fd *iofd) +{ + int rc; + + rc = iofd_poll_register(iofd); + if (rc < 0) + return; + osmo_fd_write_enable(&iofd->u.poll.ofd); +} + const struct iofd_backend_ops iofd_poll_ops = { .register_fd = iofd_poll_register, .unregister_fd = iofd_poll_unregister, @@ -166,6 +188,7 @@ .write_disable = iofd_poll_write_disable, .read_enable = iofd_poll_read_enable, .read_disable = iofd_poll_read_disable, + .notify_connected = iofd_poll_notify_connected, }; #endif /* defined(__linux__) */ diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index 1aa17d4..24d1e08 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -402,6 +402,7 @@ .write_disable = iofd_uring_write_disable, .read_enable = iofd_uring_read_enable, .read_disable = iofd_uring_read_disable, + .notify_connected = iofd_uring_write_enable, }; #endif /* defined(__linux__) */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35909?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: I905ec85210570aff8addadfc9603335d04eb057a Gerrit-Change-Number: 35909 Gerrit-PatchSet: 6 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: sendmsg/recvmsg support
by laforge 29 Feb '24

29 Feb '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35068?usp=email ) Change subject: osmo_io: sendmsg/recvmsg support ...................................................................... osmo_io: sendmsg/recvmsg support Add support osmo_io operations resembling sendmsg() and recvmsg() socket operations. This is what will enable the implementation of higher-layer functions like equivalents of sctp_recvmsg() and sctp_send() in libosmo-netif and/or other users. Change-Id: I89eb519b22d21011d61a7855b2364bc3c295df82 Related: OS#5751 --- M include/osmocom/core/osmo_io.h M src/core/libosmocore.map M src/core/osmo_io.c M src/core/osmo_io_internal.h M src/core/osmo_io_poll.c M src/core/osmo_io_uring.c 6 files changed, 184 insertions(+), 20 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index 3c704be..dda9e6d 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -4,6 +4,8 @@ #pragma once +#include <sys/socket.h> + #include <osmocom/core/linuxlist.h> #include <osmocom/core/logging.h> #include <osmocom/core/msgb.h> @@ -21,8 +23,8 @@ OSMO_IO_FD_MODE_READ_WRITE, /*! use recvfrom() / sendto() calls */ OSMO_IO_FD_MODE_RECVFROM_SENDTO, - /*! emulate sctp_recvmsg() and sctp_send() */ - OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND, + /*! emulate recvmsg() / sendmsg() */ + OSMO_IO_FD_MODE_RECVMSG_SENDMSG, }; enum osmo_io_backend { @@ -65,12 +67,20 @@ struct msgb *msg, const struct osmo_sockaddr *daddr); }; + + /* mode OSMO_IO_FD_MODE_RECVMSG_SENDMSG: */ + struct { + void (*recvmsg_cb)(struct osmo_io_fd *iofd, int res, + struct msgb *msg, const struct msghdr *msgh); + void (*sendmsg_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg); + }; }; void osmo_iofd_init(void); struct osmo_io_fd *osmo_iofd_setup(const void *ctx, int fd, const char *name, enum osmo_io_fd_mode mode, const struct osmo_io_ops *ioops, void *data); +int osmo_iofd_set_cmsg_size(struct osmo_io_fd *iofd, size_t cmsg_size); int osmo_iofd_register(struct osmo_io_fd *iofd, int fd); int osmo_iofd_unregister(struct osmo_io_fd *iofd); unsigned int osmo_iofd_txqueue_len(struct osmo_io_fd *iofd); @@ -83,6 +93,8 @@ int osmo_iofd_write_msgb(struct osmo_io_fd *iofd, struct msgb *msg); int osmo_iofd_sendto_msgb(struct osmo_io_fd *iofd, struct msgb *msg, int sendto_flags, const struct osmo_sockaddr *dest); +int osmo_iofd_sendmsg_msgb(struct osmo_io_fd *iofd, struct msgb *msg, int sendmsg_flags, + const struct msghdr *msgh); void osmo_iofd_set_alloc_info(struct osmo_io_fd *iofd, unsigned int size, unsigned int headroom); void osmo_iofd_set_txqueue_max_length(struct osmo_io_fd *iofd, unsigned int size); diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index b66e37d..a50a9ed 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -266,7 +266,10 @@ osmo_iofd_ops; osmo_iofd_register; osmo_iofd_sendto_msgb; +osmo_iofd_sctp_send_msgb; +osmo_iofd_sendmsg_msgb; osmo_iofd_set_alloc_info; +osmo_iofd_set_cmsg_size; osmo_iofd_set_data; osmo_iofd_set_ioops; osmo_iofd_set_priv_nr; diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index 71249cf..5d25f66 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -1,8 +1,8 @@ /*! \file osmo_io.c * New osmocom async I/O API. * - * (C) 2022 by Harald Welte <laforge(a)osmocom.org> - * (C) 2022-2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * (C) 2022-2024 by Harald Welte <laforge(a)osmocom.org> + * (C) 2022-2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * Author: Daniel Willmann <dwillmann(a)sysmocom.de> * * All Rights Reserved. @@ -105,8 +105,10 @@ * \param[in] iofd the osmo_io file structure * \param[in] action the action this msg(hdr) is for (read, write, ..) * \param[in] msg the msg buffer to use. Will allocate a new one if NULL + * \param[in] cmsg_size size (in bytes) of iofd_msghdr.cmsg buffer. Can be 0 if cmsg is not used. * \returns the newly allocated msghdr or NULL in case of error */ -struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg) +struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg, + size_t cmsg_size) { bool free_msg = false; struct iofd_msghdr *hdr; @@ -120,7 +122,7 @@ talloc_steal(iofd, msg); } - hdr = talloc_zero(iofd, struct iofd_msghdr); + hdr = talloc_zero_size(iofd, sizeof(struct iofd_msghdr) + cmsg_size); if (!hdr) { if (free_msg) talloc_free(msg); @@ -339,8 +341,10 @@ 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_SEND: - /* TODO Implement */ + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: + iofd->io_ops.recvmsg_cb(iofd, rc, msg, &hdr->hdr); + break; + default: OSMO_ASSERT(false); break; } @@ -378,6 +382,9 @@ case IOFD_ACT_SENDTO: iofd->io_ops.sendto_cb(iofd, rc, msg, &msghdr->osa); break; + case IOFD_ACT_SENDMSG: + iofd->io_ops.sendmsg_cb(iofd, rc, msg); + break; default: OSMO_ASSERT(0); } @@ -408,7 +415,7 @@ return -EINVAL; } - struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_WRITE, msg); + struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_WRITE, msg, 0); if (!msghdr) return -ENOMEM; @@ -450,7 +457,7 @@ return -EINVAL; } - struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_SENDTO, msg); + struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_SENDTO, msg, 0); if (!msghdr) return -ENOMEM; @@ -475,16 +482,97 @@ return 0; } +/*! ismo_io equivalent of the sendmsg(2) socket API call + * + * Appends the message to the internal transmit queue. + * If the function returns success (0), it will take ownership of the msgb and + * internally call msgb_free() after the write request completes. + * In case of an error the msgb needs to be freed by the caller. + * \param[in] iofd file descriptor to write to + * \param[in] msg message buffer to send; is used to fill msgh->iov[] + * \param[in] sendmsg_flags Flags to pass to the send call + * \param[in] msgh 'struct msghdr' for name/control/flags. iov must be empty! + * \returns 0 in case of success; a negative value in case of error + */ +int osmo_iofd_sendmsg_msgb(struct osmo_io_fd *iofd, struct msgb *msg, int sendmsg_flags, const struct msghdr *msgh) +{ + int rc; + struct iofd_msghdr *msghdr; + + OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG); + if (OSMO_UNLIKELY(!iofd->io_ops.sendmsg_cb)) { + LOGPIO(iofd, LOGL_ERROR, "sendmsg_cb not set, Rejecting msgb\n"); + return -EINVAL; + } + + if (OSMO_UNLIKELY(msgh->msg_namelen > sizeof(msghdr->osa))) { + LOGPIO(iofd, LOGL_ERROR, "osmo_iofd_sendmsg msg_namelen (%u) > supported %zu bytes\n", + msgh->msg_namelen, sizeof(msghdr->osa)); + return -EINVAL; + } + + if (OSMO_UNLIKELY(msgh->msg_iovlen)) { + LOGPIO(iofd, LOGL_ERROR, "osmo_iofd_sendmsg must have all in 'struct msgb', not in 'msg_iov'\n"); + return -EINVAL; + } + + msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_SENDMSG, msg, msgh->msg_controllen); + if (!msghdr) + return -ENOMEM; + + /* copy over optional address */ + if (msgh->msg_name) { + memcpy(&msghdr->osa, msgh->msg_name, msgh->msg_namelen); + msghdr->hdr.msg_name = &msghdr->osa.u.sa; + msghdr->hdr.msg_namelen = msgh->msg_namelen; + } + + /* build iov from msgb */ + msghdr->iov[0].iov_base = msgb_data(msghdr->msg); + msghdr->iov[0].iov_len = msgb_length(msghdr->msg); + msghdr->hdr.msg_iov = &msghdr->iov[0]; + msghdr->hdr.msg_iovlen = 1; + + /* copy over the cmsg from the msghdr */ + if (msgh->msg_control && msgh->msg_controllen) { + msghdr->hdr.msg_control = msghdr->cmsg; + msghdr->hdr.msg_controllen = msgh->msg_controllen; + memcpy(msghdr->cmsg, msgh->msg_control, msgh->msg_controllen); + } + + /* copy over msg_flags */ + msghdr->hdr.msg_flags = sendmsg_flags; + + rc = iofd_txqueue_enqueue(iofd, msghdr); + if (rc < 0) { + iofd_msghdr_free(msghdr); + LOGPIO(iofd, LOGL_ERROR, "enqueueing message failed (%d). Rejecting msgb\n", rc); + return rc; + } + + return 0; +} + static int check_mode_callback_compat(enum osmo_io_fd_mode mode, const struct osmo_io_ops *ops) { switch (mode) { case OSMO_IO_FD_MODE_READ_WRITE: if (ops->recvfrom_cb || ops->sendto_cb) return false; + if (ops->recvmsg_cb || ops->sendmsg_cb) + return false; break; case OSMO_IO_FD_MODE_RECVFROM_SENDTO: if (ops->read_cb || ops->write_cb) return false; + if (ops->recvmsg_cb || ops->sendmsg_cb) + return false; + break; + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: + if (ops->recvfrom_cb || ops->sendto_cb) + return false; + if (ops->read_cb || ops->write_cb) + return false; break; default: break; @@ -511,6 +599,7 @@ switch (mode) { case OSMO_IO_FD_MODE_READ_WRITE: case OSMO_IO_FD_MODE_RECVFROM_SENDTO: + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: break; default: return NULL; @@ -547,6 +636,16 @@ return iofd; } +/*! Set the size of the control message buffer allocated when submitting recvmsg */ +int osmo_iofd_set_cmsg_size(struct osmo_io_fd *iofd, size_t cmsg_size) +{ + if (iofd->mode != OSMO_IO_FD_MODE_RECVMSG_SENDMSG) + return -EINVAL; + + iofd->cmsg_size = cmsg_size; + return 0; +} + /*! Register the fd with the underlying backend. * * \param[in] iofd the iofd file descriptor @@ -567,7 +666,8 @@ IOFD_FLAG_UNSET(iofd, IOFD_FLAG_CLOSED); if ((iofd->mode == OSMO_IO_FD_MODE_READ_WRITE && iofd->io_ops.read_cb) || - (iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO && iofd->io_ops.recvfrom_cb)) { + (iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO && iofd->io_ops.recvfrom_cb) || + (iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG && iofd->io_ops.recvmsg_cb)) { osmo_iofd_ops.read_enable(iofd); } @@ -767,7 +867,12 @@ else osmo_iofd_ops.read_disable(iofd); break; - case OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND: + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: + if (iofd->io_ops.recvmsg_cb) + osmo_iofd_ops.read_enable(iofd); + else + osmo_iofd_ops.read_disable(iofd); + break; default: OSMO_ASSERT(0); } @@ -780,7 +885,8 @@ * \param[in] iofd the file descriptor */ void osmo_iofd_notify_connected(struct osmo_io_fd *iofd) { - OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE); + OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE || + iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG); OSMO_ASSERT(osmo_iofd_ops.notify_connected); osmo_iofd_ops.notify_connected(iofd); } diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h index 9c86e05..af47a3d 100644 --- a/src/core/osmo_io_internal.h +++ b/src/core/osmo_io_internal.h @@ -4,6 +4,7 @@ #include <unistd.h> #include <stdbool.h> +#include <netinet/sctp.h> #include <osmocom/core/osmo_io.h> #include <osmocom/core/linuxlist.h> @@ -72,6 +73,9 @@ /*! private number, extending \a data */ unsigned int priv_nr; + /*! size of iofd_msghdr.cmsg[] when allocated in recvmsg path */ + size_t cmsg_size; + struct { /*! talloc context from which to allocate msgb when reading */ const void *ctx; @@ -109,7 +113,8 @@ IOFD_ACT_WRITE, IOFD_ACT_RECVFROM, IOFD_ACT_SENDTO, - // TODO: SCTP_* + IOFD_ACT_RECVMSG, + IOFD_ACT_SENDMSG, }; @@ -132,6 +137,9 @@ struct msgb *msg; /*! I/O file descriptor on which we perform this I/O operation */ struct osmo_io_fd *iofd; + + /*! control message buffer for passing sctp_sndrcvinfo along */ + char cmsg[0]; /* size is determined by iofd->cmsg_size on recvmsg, and by mcghdr->msg_controllen on sendmsg */ }; enum iofd_seg_act { @@ -140,7 +148,7 @@ IOFD_SEG_ACT_DEFER, }; -struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg); +struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg, size_t cmsg_size); void iofd_msghdr_free(struct iofd_msghdr *msghdr); struct msgb *iofd_msgb_alloc(struct osmo_io_fd *iofd); diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c index 8398a30..52e806d 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -49,6 +49,7 @@ if (what & OSMO_FD_READ) { struct iofd_msghdr hdr; + msg = iofd_msgb_pending_or_alloc(iofd); if (!msg) { LOGPIO(iofd, LOGL_ERROR, "Could not allocate msgb for reading\n"); @@ -64,6 +65,10 @@ .msg_name = &hdr.osa.u.sa, .msg_namelen = sizeof(struct osmo_sockaddr), }; + if (iofd->mode == OSMO_IO_FD_MODE_RECVMSG_SENDMSG) { + hdr.hdr.msg_control = alloca(iofd->cmsg_size); + hdr.hdr.msg_controllen = iofd->cmsg_size; + } rc = recvmsg(ofd->fd, &hdr.hdr, flags); if (rc > 0) @@ -90,13 +95,15 @@ case OSMO_IO_FD_MODE_RECVFROM_SENDTO: iofd->io_ops.sendto_cb(iofd, 0, NULL, NULL); break; + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: + iofd->io_ops.sendmsg_cb(iofd, 0, NULL); + break; default: break; } if (osmo_iofd_txqueue_len(iofd) == 0) iofd_poll_ops.write_disable(iofd); } - } } diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index 24d1e08..aa9df85 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -3,6 +3,7 @@ * * (C) 2022-2023 by sysmocom s.f.m.c. * Author: Daniel Willmann <daniel(a)sysmocom.de> + * (C) 2023-2024 by Harald Welte <laforge(a)osmocom.org> * * All Rights Reserved. * @@ -35,6 +36,8 @@ #include <stdbool.h> #include <errno.h> +#include <netinet/in.h> +#include <netinet/sctp.h> #include <sys/eventfd.h> #include <liburing.h> @@ -114,7 +117,7 @@ OSMO_ASSERT(0); } - msghdr = iofd_msghdr_alloc(iofd, action, msg); + msghdr = iofd_msghdr_alloc(iofd, action, msg, iofd->cmsg_size); if (!msghdr) { LOGPIO(iofd, LOGL_ERROR, "Could not allocate msghdr for reading\n"); OSMO_ASSERT(0); @@ -126,6 +129,10 @@ switch (action) { case IOFD_ACT_READ: break; + case IOFD_ACT_RECVMSG: + msghdr->hdr.msg_control = msghdr->cmsg; + msghdr->hdr.msg_controllen = iofd->cmsg_size; + /* fall-through */ case IOFD_ACT_RECVFROM: msghdr->hdr.msg_iov = &msghdr->iov[0]; msghdr->hdr.msg_iovlen = 1; @@ -146,6 +153,7 @@ case IOFD_ACT_READ: io_uring_prep_readv(sqe, iofd->fd, msghdr->iov, 1, 0); break; + case IOFD_ACT_RECVMSG: case IOFD_ACT_RECVFROM: io_uring_prep_recvmsg(sqe, iofd->fd, &msghdr->hdr, msghdr->flags); break; @@ -210,10 +218,12 @@ switch (msghdr->action) { case IOFD_ACT_READ: case IOFD_ACT_RECVFROM: + case IOFD_ACT_RECVMSG: iofd_uring_handle_recv(msghdr, res); break; case IOFD_ACT_WRITE: case IOFD_ACT_SENDTO: + case IOFD_ACT_SENDMSG: iofd_uring_handle_tx(msghdr, res); break; default: @@ -273,6 +283,7 @@ switch (msghdr->action) { case IOFD_ACT_WRITE: case IOFD_ACT_SENDTO: + case IOFD_ACT_SENDMSG: io_uring_prep_sendmsg(sqe, msghdr->iofd->fd, &msghdr->hdr, msghdr->flags); break; default: @@ -334,21 +345,20 @@ LOGPIO(iofd, LOGL_ERROR, "Could not allocate msgb for writing\n"); OSMO_ASSERT(0); } - msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_WRITE, msg); + msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_WRITE, msg, 0); if (!msghdr) { LOGPIO(iofd, LOGL_ERROR, "Could not allocate msghdr for writing\n"); OSMO_ASSERT(0); } msghdr->iov[0].iov_base = msgb_data(msg); - msghdr->iov[0].iov_len = msgb_tailroom(msg); + msghdr->iov[0].iov_len = msgb_length(msg); sqe = io_uring_get_sqe(&g_ring.ring); if (!sqe) { LOGPIO(iofd, LOGL_ERROR, "Could not get io_uring_sqe\n"); OSMO_ASSERT(0); } - // Prep msgb/iov io_uring_prep_writev(sqe, iofd->fd, msghdr->iov, 1, 0); io_uring_sqe_set_data(sqe, msghdr); @@ -376,6 +386,9 @@ case OSMO_IO_FD_MODE_RECVFROM_SENDTO: iofd_uring_submit_recv(iofd, IOFD_ACT_RECVFROM); break; + case OSMO_IO_FD_MODE_RECVMSG_SENDMSG: + iofd_uring_submit_recv(iofd, IOFD_ACT_RECVMSG); + break; default: OSMO_ASSERT(0); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35068?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: I89eb519b22d21011d61a7855b2364bc3c295df82 Gerrit-Change-Number: 35068 Gerrit-PatchSet: 12 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: jolly <andreas(a)eversberg.eu> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: osmo_io: Assign const name when stealing TX msg from iofd ctx
by laforge 29 Feb '24

29 Feb '24
Attention is currently required from: jolly, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36121?usp=email ) Change subject: osmo_io: Assign const name when stealing TX msg from iofd ctx ...................................................................... Patch Set 1: (1 comment) File src/core/osmo_io.c: https://gerrit.osmocom.org/c/libosmocore/+/36121/comment/c22c89d0_daada4dd PS1, Line 339: talloc_set_name(msg, "osmo_io_rx_msgb"); > It happens at time the msgb is allocated, where as name we use a pointer to the (dynamically allocat […] I think it would be better to not even set the msgb name to the name of the iofd in the first place, avoiding having to change it later on here. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36121?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: Ib8dae924fa2d94a7f636136ba7279b965a18cf5b Gerrit-Change-Number: 36121 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 29 Feb 2024 14:27:56 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: osmo_io: Assign const name when stealing TX msg from iofd ctx
by laforge 29 Feb '24

29 Feb '24
Attention is currently required from: jolly, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36121?usp=email ) Change subject: osmo_io: Assign const name when stealing TX msg from iofd ctx ...................................................................... Patch Set 1: Code-Review+1 (1 comment) File src/core/osmo_io.c: https://gerrit.osmocom.org/c/libosmocore/+/36121/comment/cf4b934b_354b7230 PS1, Line 339: talloc_set_name(msg, "osmo_io_rx_msgb"); > Can you point to the place which is setting this name so I can understand what's going on? It happens at time the msgb is allocated, where as name we use a pointer to the (dynamically allocated) name of the iofd. However, the iofd might be closed befoere the msgb's is released (think of queues, ...) and in that case a talloc report would try to print a string at an already-free'd address. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36121?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: Ib8dae924fa2d94a7f636136ba7279b965a18cf5b Gerrit-Change-Number: 36121 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 29 Feb 2024 14:27:17 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: sendmsg/recvmsg support
by laforge 29 Feb '24

29 Feb '24
Attention is currently required from: daniel, jolly, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35068?usp=email ) Change subject: osmo_io: sendmsg/recvmsg support ...................................................................... Patch Set 12: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35068?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: I89eb519b22d21011d61a7855b2364bc3c295df82 Gerrit-Change-Number: 35068 Gerrit-PatchSet: 12 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: jolly <andreas(a)eversberg.eu> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Thu, 29 Feb 2024 14:24:31 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmo-sccp[master]: fix regression in sctp-role / transport-role
by fixeria 29 Feb '24

29 Feb '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/36114?usp=email ) Change subject: fix regression in sctp-role / transport-role ...................................................................... fix regression in sctp-role / transport-role We saw some fall-out in automatic testing where configs with sctp-role would suddenly save as transport-role. Let's avoid this by keeping sctp-role for users of SCTP. Change-Id: Ic666b62948880445e030c637298d4e369b4c7e8e Fixes: 4d7e201 "VTY: rename 'sctp-role' to 'transport-role', add an alias" Related: SYS#5424, OS#6380 --- M src/osmo_ss7_vty.c M tests/vty/ss7_asp_test.vty 2 files changed, 20 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 890dded..9d58fb6 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -1726,7 +1726,10 @@ vty_out(vty, " qos-class %u%s", asp->cfg.qos_class, VTY_NEWLINE); vty_out(vty, " role %s%s", osmo_str_tolower(get_value_string(osmo_ss7_asp_role_names, asp->cfg.role)), VTY_NEWLINE); - vty_out(vty, " transport-role %s%s", asp->cfg.is_server ? "server" : "client", VTY_NEWLINE); + if (asp->cfg.trans_proto == IPPROTO_SCTP) + vty_out(vty, " sctp-role %s%s", asp->cfg.is_server ? "server" : "client", VTY_NEWLINE); + else + vty_out(vty, " transport-role %s%s", asp->cfg.is_server ? "server" : "client", VTY_NEWLINE); if (asp->cfg.sctp_init.num_ostreams_present) vty_out(vty, " sctp-param init num-ostreams %u%s", asp->cfg.sctp_init.num_ostreams_value, VTY_NEWLINE); if (asp->cfg.sctp_init.max_instreams_present) diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty index b8df809..7168d20 100644 --- a/tests/vty/ss7_asp_test.vty +++ b/tests/vty/ss7_asp_test.vty @@ -423,7 +423,7 @@ remote-ip 127.0.0.200 remote-ip 127.0.0.201 role sg - transport-role server + sctp-role server as my-ass m3ua asp my-asp routing-key 0 3.2.1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/36114?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: Ic666b62948880445e030c637298d4e369b4c7e8e Gerrit-Change-Number: 36114 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • ...
  • 175
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.