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

April 2024

  • 1 participants
  • 1128 discussions
[S] Change in libosmo-netif[master]: tests/stream: Fix missing msgb_free()
by pespin 17 Apr '24

17 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36583?usp=email ) Change subject: tests/stream: Fix missing msgb_free() ...................................................................... tests/stream: Fix missing msgb_free() Change-Id: I7e7579175aa6a7c1c22eb3bc147a67f6f62ad6bc --- M tests/stream/stream_test.c 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/83/36583/1 diff --git a/tests/stream/stream_test.c b/tests/stream/stream_test.c index e50752b..f52a675 100644 --- a/tests/stream/stream_test.c +++ b/tests/stream/stream_test.c @@ -592,6 +592,7 @@ osmo_stream_srv_send(conn, m); } else if (msgnum_srv == 7 && *msgt == IPAC_MSGT_PONG) { test_segm_ipa_stream_srv_all_msgs_processed = true; + msgb_free(msg); osmo_stream_srv_destroy(conn); } return 0; -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36583?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I7e7579175aa6a7c1c22eb3bc147a67f6f62ad6bc Gerrit-Change-Number: 36583 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: osmo_io: Add iofd param to segmentation_cb
by pespin 17 Apr '24

17 Apr '24
Attention is currently required from: daniel, fixeria, jolly, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/36582?usp=email ) Change subject: osmo_io: Add iofd param to segmentation_cb ...................................................................... Patch Set 2: (1 comment) Patchset: PS1: Please read https://osmocom.org/issues/6437 before reviewing this patch -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36582?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: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079 Gerrit-Change-Number: 36582 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <daniel(a)totalueberwachung.de> Gerrit-Reviewer: fixeria <vyanitskiy(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: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: daniel <daniel(a)totalueberwachung.de> Gerrit-Comment-Date: Wed, 17 Apr 2024 12:26:19 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: osmo_io: Add iofd param to segmentation_cb
by pespin 17 Apr '24

17 Apr '24
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/36582?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified-1 by Jenkins Builder Change subject: osmo_io: Add iofd param to segmentation_cb ...................................................................... osmo_io: Add iofd param to segmentation_cb See related ticket for full rant and historical facts about this callback. Since anyway we are still developing osmo_io stuff and there will be ABI breaks when releasing new version, let's udpate the callback signature too. Related: OS#6437 Change-Id: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079 --- M include/osmocom/core/osmo_io.h M include/osmocom/gsm/cbsp.h M src/core/osmo_io.c M src/gsm/cbsp.c 4 files changed, 32 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/36582/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36582?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: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079 Gerrit-Change-Number: 36582 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in libosmocore[master]: osmo_io: Add iofd param to segmentation_cb
by pespin 17 Apr '24

17 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/36582?usp=email ) Change subject: osmo_io: Add iofd param to segmentation_cb ...................................................................... osmo_io: Add iofd param to segmentation_cb See related ticket for full rant and historical facts about this callback. Since anyway we are still developing osmo_io stuff and there will be ABI breaks when releasing new version, let's udpate the callback signature too. Related: OS#6437 Change-Id: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079 --- M include/osmocom/core/osmo_io.h M include/osmocom/gsm/cbsp.h M src/core/osmo_io.c M src/gsm/cbsp.c 4 files changed, 30 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/36582/1 diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index 8c931dd..f86e968 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -100,6 +100,7 @@ * \param[in] msg message buffer containing the read data. Ownership is transferred to the * call-back, and it must make sure to msgb_free() it eventually! */ void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg); + /*! completion call-back function when write issued via osmo_iofd_write_msgb() has completed * on fd. Only valid in OSMO_IO_FD_MODE_READ_WRITE. * \param[in] iofd on which a write() has completed. @@ -108,9 +109,15 @@ * call-back; it is automatically freed after the call-back terminates! */ void (*write_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg); - /*! optional call-back function to segment the data at message boundaries. This is useful when - * message boundaries are to be preserved over a SOCK_STREAM transport socket like TCP. Can - * be NULL for any application not requiring de-segmentation of received data. + + /*! optional call-back function to segment the data at message boundaries. + * \param[in] iofd handling msg + * \param[in] msg message buffer whose data is to be segmented + * \returns See full function description. + * + * This is useful when message boundaries are to be preserved over a SOCK_STREAM transport + * socket like TCP. Can be NULL for any application not requiring de-segmentation of + * received data. * * The call-back needs to return the size of the next message. If it returns * -EAGAIN or a value larger than msgb_length() (message is incomplete) @@ -120,7 +127,7 @@ * the msgb will be trimmed to size by osmo_io and forwarded to the read call-back. Any * parsing done to the msgb by segmentation_cb() will be preserved for the read_cb() * (e.g. setting lxh or msgb->cb). */ - int (*segmentation_cb)(struct msgb *msg); + int (*segmentation_cb)(struct osmo_io_fd *iofd, struct msgb *msg); }; /* mode OSMO_IO_FD_MODE_RECVFROM_SENDTO: */ diff --git a/include/osmocom/gsm/cbsp.h b/include/osmocom/gsm/cbsp.h index efa4ce6..d15e6f8 100644 --- a/include/osmocom/gsm/cbsp.h +++ b/include/osmocom/gsm/cbsp.h @@ -312,4 +312,4 @@ struct osmo_cbsp_decoded *osmo_cbsp_decoded_alloc(void *ctx, enum cbsp_msg_type msg_type); int osmo_cbsp_recv_buffered(void *ctx, int fd, struct msgb **rmsg, struct msgb **tmp_msg); -int osmo_cbsp_segmentation_cb(struct msgb *msg); +int osmo_cbsp_segmentation_cb(struct osmo_io_fd *iofd, struct msgb *msg); diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index b589cb7..f908e80 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -280,7 +280,7 @@ return IOFD_SEG_ACT_HANDLE_ONE; } - int expected_len = iofd->io_ops.segmentation_cb(msg); + int expected_len = iofd->io_ops.segmentation_cb(iofd, msg); if (expected_len == -EAGAIN) { goto defer; } else if (expected_len < 0) { diff --git a/src/gsm/cbsp.c b/src/gsm/cbsp.c index a5e58f4..dbc3830 100644 --- a/src/gsm/cbsp.c +++ b/src/gsm/cbsp.c @@ -1570,7 +1570,7 @@ /*! call-back function to segment the data at message boundaries. * Returns the size of the next message. If it returns -EAGAIN or a value larger than msgb_length() (message * is incomplete), the caller (e.g. osmo_io) has to wait for more data to be read. */ -int osmo_cbsp_segmentation_cb(struct msgb *msg) +int osmo_cbsp_segmentation_cb(struct osmo_io_fd *iofd, struct msgb *msg) { const struct cbsp_header *h; int len; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/36582?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: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079 Gerrit-Change-Number: 36582 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmo-netif[master]: stream_cli: Remove unused write_cb field
by pespin 17 Apr '24

17 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36580?usp=email ) Change subject: stream_cli: Remove unused write_cb field ...................................................................... stream_cli: Remove unused write_cb field Change-Id: I50bee754d01d8de01f4a25c14abf90275a1ac78e --- M src/stream_cli.c 1 file changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/80/36580/1 diff --git a/src/stream_cli.c b/src/stream_cli.c index 11c88ae..0427032 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -107,7 +107,6 @@ int (*disconnect_cb)(struct osmo_stream_cli *cli); int (*read_cb)(struct osmo_stream_cli *cli); int (*iofd_read_cb)(struct osmo_stream_cli *cli, struct msgb *msg); - int (*write_cb)(struct osmo_stream_cli *cli); int (*segmentation_cb)(struct msgb *msg); void *data; int flags; -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36580?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I50bee754d01d8de01f4a25c14abf90275a1ac78e Gerrit-Change-Number: 36580 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmo-netif[master]: stream: Define types for each API callback
by pespin 17 Apr '24

17 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36581?usp=email ) Change subject: stream: Define types for each API callback ...................................................................... stream: Define types for each API callback The amount and complexity of callbacks is increasing over time. Use typedefs to define each of them so that callbacks: - Are easier to identify (which types is used where) - Are easier to document (have a 1st class place to write doxygen documentation) Change-Id: Ib0c4a9713fa4c755e457b8c2cbde6a7724d36e28 --- M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c 3 files changed, 65 insertions(+), 33 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/81/36581/1 diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index 61bc1ad..398b277 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -62,6 +62,8 @@ /*! \brief Osmocom Stream Server Link: A server socket listening/accepting */ struct osmo_stream_srv_link; +typedef int (*osmo_stream_srv_link_accept_cb_t)(struct osmo_stream_srv_link *link, int fd); + struct osmo_stream_srv_link *osmo_stream_srv_link_create(void *ctx); void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link); @@ -74,7 +76,7 @@ void osmo_stream_srv_link_set_proto(struct osmo_stream_srv_link *link, uint16_t proto); int osmo_stream_srv_link_set_type(struct osmo_stream_srv_link *link, int type); int osmo_stream_srv_link_set_domain(struct osmo_stream_srv_link *link, int domain); -void osmo_stream_srv_link_set_accept_cb(struct osmo_stream_srv_link *link, int (*accept_cb)(struct osmo_stream_srv_link *link, int fd)); +void osmo_stream_srv_link_set_accept_cb(struct osmo_stream_srv_link *link, osmo_stream_srv_link_accept_cb_t accept_cb); void osmo_stream_srv_link_set_data(struct osmo_stream_srv_link *link, void *data); void *osmo_stream_srv_link_get_data(struct osmo_stream_srv_link *link); char *osmo_stream_srv_link_get_sockname(const struct osmo_stream_srv_link *link); @@ -98,12 +100,20 @@ * osmo_stream_srv_link */ struct osmo_stream_srv; -struct osmo_stream_srv *osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, int (*read_cb)(struct osmo_stream_srv *conn), int (*closed_cb)(struct osmo_stream_srv *conn), void *data); +typedef int (*osmo_stream_srv_read_cb_t)(struct osmo_stream_srv *conn); +typedef int (*osmo_stream_srv_closed_cb_t)(struct osmo_stream_srv *conn); +typedef int (*osmo_stream_srv_read_cb2_t)(struct osmo_stream_srv *conn, struct msgb *msg); +typedef int (*osmo_stream_srv_segmentation_cb_t)(struct msgb *msg); + +struct osmo_stream_srv *osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, + osmo_stream_srv_read_cb_t read_cb, + osmo_stream_srv_closed_cb_t closed_cb, + void *data); struct osmo_stream_srv *osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data); void osmo_stream_srv_set_name(struct osmo_stream_srv *conn, const char *name); const char *osmo_stream_srv_get_name(const struct osmo_stream_srv *conn); -void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, int (*read_cb)(struct osmo_stream_srv *conn, struct msgb *msg)); -void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, int (*closed_cb)(struct osmo_stream_srv *conn)); +void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, osmo_stream_srv_read_cb2_t read_cb); +void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, osmo_stream_srv_closed_cb_t close_cb); void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn); struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *conn); const char *osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn); @@ -115,8 +125,7 @@ void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn); void osmo_stream_srv_set_data(struct osmo_stream_srv *conn, void *data); -void osmo_stream_srv_set_segmentation_cb(struct osmo_stream_srv *conn, - int (*segmentation_cb)(struct msgb *msg)); +void osmo_stream_srv_set_segmentation_cb(struct osmo_stream_srv *conn, osmo_stream_srv_segmentation_cb_t segmentation_cb); void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg); int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg); @@ -160,6 +169,12 @@ /*! \brief Osmocom Stream Client: Single client connection */ struct osmo_stream_cli; +typedef int (*osmo_stream_cli_connect_cb_t)(struct osmo_stream_cli *cli); +typedef int (*osmo_stream_cli_disconnect_cb_t)(struct osmo_stream_cli *cli); +typedef int (*osmo_stream_cli_read_cb_t)(struct osmo_stream_cli *cli); +typedef int (*osmo_stream_cli_read_cb2_t)(struct osmo_stream_cli *cli, struct msgb *msg); +typedef int (*osmo_stream_cli_segmentation_cb_t)(struct msgb *msg); + void osmo_stream_cli_set_name(struct osmo_stream_cli *cli, const char *name); const char *osmo_stream_cli_get_name(const struct osmo_stream_cli *cli); void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay); @@ -179,11 +194,11 @@ struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli); int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli); struct osmo_io_fd *osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli); -void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_cb)(struct osmo_stream_cli *cli)); -void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int (*disconnect_cb)(struct osmo_stream_cli *cli)); -void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli)); -void osmo_stream_cli_set_read_cb2(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli, struct msgb *msg)); -void osmo_stream_cli_set_segmentation_cb(struct osmo_stream_cli *cli, int (*segmentation_cb)(struct msgb *msg)); +void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, osmo_stream_cli_connect_cb_t connect_cb); +void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, osmo_stream_cli_disconnect_cb_t disconnect_cb); +void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, osmo_stream_cli_read_cb_t read_cb); +void osmo_stream_cli_set_read_cb2(struct osmo_stream_cli *cli, osmo_stream_cli_read_cb2_t read_cb); +void osmo_stream_cli_set_segmentation_cb(struct osmo_stream_cli *cli, osmo_stream_cli_segmentation_cb_t segmentation_cb); void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli); bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli); diff --git a/src/stream_cli.c b/src/stream_cli.c index 0427032..62ea03e 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -103,11 +103,11 @@ int sk_domain; int sk_type; uint16_t proto; - int (*connect_cb)(struct osmo_stream_cli *cli); - int (*disconnect_cb)(struct osmo_stream_cli *cli); - int (*read_cb)(struct osmo_stream_cli *cli); - int (*iofd_read_cb)(struct osmo_stream_cli *cli, struct msgb *msg); - int (*segmentation_cb)(struct msgb *msg); + osmo_stream_cli_connect_cb_t connect_cb; + osmo_stream_cli_disconnect_cb_t disconnect_cb; + osmo_stream_cli_read_cb_t read_cb; + osmo_stream_cli_read_cb2_t iofd_read_cb; + osmo_stream_cli_segmentation_cb_t segmentation_cb; void *data; int flags; int reconnect_timeout; @@ -661,7 +661,7 @@ /* Configure client side segmentation for the iofd */ static void configure_cli_segmentation_cb(struct osmo_stream_cli *cli, - int (*segmentation_cb)(struct msgb *msg)) + osmo_stream_cli_segmentation_cb_t segmentation_cb) { /* Copy default settings */ struct osmo_io_ops client_ops; @@ -676,7 +676,7 @@ * \param[in] segmentation_cb Target segmentation callback */ void osmo_stream_cli_set_segmentation_cb(struct osmo_stream_cli *cli, - int (*segmentation_cb)(struct msgb *msg)) + osmo_stream_cli_segmentation_cb_t segmentation_cb) { cli->segmentation_cb = segmentation_cb; if (cli->iofd) /* Otherwise, this will be done in osmo_stream_cli_open() */ @@ -784,7 +784,7 @@ * \param[in] connect_cb Call-back function to be called upon connect */ void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, - int (*connect_cb)(struct osmo_stream_cli *cli)) + osmo_stream_cli_connect_cb_t connect_cb) { cli->connect_cb = connect_cb; } @@ -793,7 +793,7 @@ * \param[in] cli Stream Client to modify * \param[in] disconnect_cb Call-back function to be called upon disconnect */ void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, - int (*disconnect_cb)(struct osmo_stream_cli *cli)) + osmo_stream_cli_disconnect_cb_t disconnect_cb) { cli->disconnect_cb = disconnect_cb; } @@ -804,7 +804,7 @@ * \param[in] read_cb Call-back function to be called when we want to read */ void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, - int (*read_cb)(struct osmo_stream_cli *cli)) + osmo_stream_cli_read_cb_t read_cb) { OSMO_ASSERT(cli->mode != OSMO_STREAM_MODE_OSMO_IO); cli->mode = OSMO_STREAM_MODE_OSMO_FD; @@ -817,7 +817,7 @@ * \param[in] read_cb Call-back function to be called when data was read from the socket */ void osmo_stream_cli_set_read_cb2(struct osmo_stream_cli *cli, - int (*read_cb)(struct osmo_stream_cli *cli, struct msgb *msg)) + osmo_stream_cli_read_cb2_t read_cb) { OSMO_ASSERT(cli->mode != OSMO_STREAM_MODE_OSMO_FD); cli->mode = OSMO_STREAM_MODE_OSMO_IO; diff --git a/src/stream_srv.c b/src/stream_srv.c index a02c1c2..74193a4 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -82,7 +82,7 @@ int sk_domain; int sk_type; uint16_t proto; - int (*accept_cb)(struct osmo_stream_srv_link *srv, int fd); + osmo_stream_srv_link_accept_cb_t accept_cb; void *data; int flags; struct osmo_sock_init2_multiaddr_pars ma_pars; @@ -597,9 +597,9 @@ struct osmo_io_fd *iofd; }; struct llist_head tx_queue; - int (*closed_cb)(struct osmo_stream_srv *peer); - int (*read_cb)(struct osmo_stream_srv *peer); - int (*iofd_read_cb)(struct osmo_stream_srv *peer, struct msgb *msg); + osmo_stream_srv_closed_cb_t closed_cb; + osmo_stream_srv_read_cb_t read_cb; + osmo_stream_srv_read_cb2_t iofd_read_cb; void *data; int flags; }; @@ -811,10 +811,10 @@ * \param[in] data User data to save in the new Stream Server struct * \returns Stream Server in case of success; NULL on error */ struct osmo_stream_srv * -osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, - int fd, - int (*read_cb)(struct osmo_stream_srv *conn), - int (*closed_cb)(struct osmo_stream_srv *conn), void *data) +osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, + osmo_stream_srv_read_cb_t read_cb, + osmo_stream_srv_closed_cb_t closed_cb, + void *data) { struct osmo_stream_srv *conn; @@ -923,7 +923,8 @@ * * \param[in] conn Stream Server to modify * \param[in] read_cb Call-back function to be called when data was read */ -void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, int (*read_cb)(struct osmo_stream_srv *conn, struct msgb *msg)) +void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, + osmo_stream_srv_read_cb2_t read_cb) { OSMO_ASSERT(conn && conn->mode == OSMO_STREAM_MODE_OSMO_IO); conn->iofd_read_cb = read_cb; @@ -935,7 +936,8 @@ * internal state related to this specific client/connection. * \param[in] conn Stream Server to modify * \param[in] closed_cb Call-back function to be called when the connection was closed */ -void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, int (*closed_cb)(struct osmo_stream_srv *conn)) +void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, + osmo_stream_srv_closed_cb_t closed_cb) { OSMO_ASSERT(conn); conn->closed_cb = closed_cb; @@ -974,7 +976,7 @@ * \param[in,out] conn Target Stream Server to modify * \param[in] segmentation_cb Segmentation callback to be set */ void osmo_stream_srv_set_segmentation_cb(struct osmo_stream_srv *conn, - int (*segmentation_cb)(struct msgb *msg)) + osmo_stream_srv_segmentation_cb_t segmentation_cb) { /* Note that the following implies that iofd != NULL, since * osmo_stream_srv_create2() creates the iofd member, too */ -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36581?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0c4a9713fa4c755e457b8c2cbde6a7724d36e28 Gerrit-Change-Number: 36581 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: hnbap: Avoid calling duplicate getpeername() for each registered HNB
by pespin 17 Apr '24

17 Apr '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36567?usp=email ) Change subject: hnbap: Avoid calling duplicate getpeername() for each registered HNB ...................................................................... hnbap: Avoid calling duplicate getpeername() for each registered HNB Change-Id: I980de31d1296c3b956146a461609bec76ed3d430 --- M src/osmo-hnbgw/hnbgw_hnbap.c 1 file changed, 22 insertions(+), 10 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c index 4fa59b9..a632311 100644 --- a/src/osmo-hnbgw/hnbgw_hnbap.c +++ b/src/osmo-hnbgw/hnbgw_hnbap.c @@ -478,6 +478,8 @@ const char *cell_id_str; struct timespec tp; HNBAP_Cause_t cause; + struct osmo_sockaddr cur_osa = {}; + socklen_t len = sizeof(cur_osa); rc = hnbap_decode_hnbregisterrequesties(&ies, in); if (rc < 0) { @@ -499,6 +501,15 @@ ctx->id.mnc = plmn.mnc; cell_id_str = umts_cell_id_name(&ctx->id); + if (getpeername(ofd->fd, &cur_osa.u.sa, &len) < 0) { + LOGHNB(ctx, DHNBAP, LOGL_ERROR, "HNB-REGISTER-REQ %s: rejecting due to getpeername() error: %s\n", + cell_id_str, strerror(errno)); + hnbap_free_hnbregisterrequesties(&ies); + cause.present = HNBAP_Cause_PR_radioNetwork; + cause.choice.radioNetwork = HNBAP_CauseRadioNetwork_hNB_parameter_mismatch; + return hnbgw_tx_hnb_register_rej(ctx, &cause); + } + hnbp = hnb_persistent_find_by_id(&ctx->id); if (!hnbp && g_hnbgw->config.accept_all_hnb) hnbp = hnb_persistent_alloc(&ctx->id); @@ -510,6 +521,7 @@ cause.choice.radioNetwork = HNBAP_CauseRadioNetwork_unauthorised_HNB; return hnbgw_tx_hnb_register_rej(ctx, &cause); } + ctx->persistent = hnbp; hnbp->ctx = ctx; @@ -523,22 +535,13 @@ * fault (bug), and we release the old context to keep going... */ struct osmo_fd *other_fd = osmo_stream_srv_get_ofd(hnb->conn); struct osmo_sockaddr other_osa = {}; - struct osmo_sockaddr cur_osa = {}; socklen_t len = sizeof(other_osa); if (getpeername(other_fd->fd, &other_osa.u.sa, &len) < 0) { LOGHNB(ctx, DHNBAP, LOGL_ERROR, "BUG! Found old registered HNB with invalid socket, releasing it\n"); hnb_context_release(hnb); continue; } - len = sizeof(cur_osa); - if (getpeername(ofd->fd, &cur_osa.u.sa, &len) < 0) { - LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Error getpeername(): %s\n", strerror(errno)); - if (osmo_sockaddr_cmp(&cur_osa, &other_osa) == 0) { - LOGHNB(ctx, DHNBAP, LOGL_ERROR, "BUG! Found old registered HNB with same remote address, releasing it\n"); - hnb_context_release(hnb); - continue; - } - } else if (osmo_sockaddr_cmp(&cur_osa, &other_osa) == 0) { + if (osmo_sockaddr_cmp(&cur_osa, &other_osa) == 0) { LOGHNB(ctx, DHNBAP, LOGL_ERROR, "BUG! Found old registered HNB with same remote address, releasing it\n"); hnb_context_release(hnb); continue; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36567?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I980de31d1296c3b956146a461609bec76ed3d430 Gerrit-Change-Number: 36567 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-hnbgw[master]: hnbap: Avoid calling duplicate getpeername() for each registered HNB
by fixeria 17 Apr '24

17 Apr '24
Attention is currently required from: osmith, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36567?usp=email ) Change subject: hnbap: Avoid calling duplicate getpeername() for each registered HNB ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36567?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I980de31d1296c3b956146a461609bec76ed3d430 Gerrit-Change-Number: 36567 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 17 Apr 2024 07:13:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-hnbgw[master]: hnbap: Avoid calling duplicate getpeername() for each registered HNB
by laforge 16 Apr '24

16 Apr '24
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36567?usp=email ) Change subject: hnbap: Avoid calling duplicate getpeername() for each registered HNB ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36567?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I980de31d1296c3b956146a461609bec76ed3d430 Gerrit-Change-Number: 36567 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 16 Apr 2024 21:18:59 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmo-netif[master]: examples/ipa-stream-client: Fix memleaks in read_cb()
by laforge 16 Apr '24

16 Apr '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36573?usp=email ) Change subject: examples/ipa-stream-client: Fix memleaks in read_cb() ...................................................................... examples/ipa-stream-client: Fix memleaks in read_cb() Change-Id: I86fc159d928fc7ebce2f771670c5a198c52f5fc0 --- M examples/ipa-stream-client.c 1 file changed, 14 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index cb07ef6..720fe66 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -104,16 +104,17 @@ static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) { + int num; + struct msg_sent *cur, *tmp, *found = NULL; + LOGP(DIPATEST, LOGL_DEBUG, "received message from stream (payload len=%d)\n", msgb_length(msg)); if (osmo_ipa_process_msg(msg) < 0) { LOGP(DIPATEST, LOGL_ERROR, "bad IPA message\n"); + msgb_free(msg); return 0; } - int num; - struct msg_sent *cur, *tmp, *found = NULL; - num = osmo_load32be(msg->data); LOGP(DLINP, LOGL_DEBUG, "received msg number %d\n", num); @@ -137,6 +138,7 @@ LOGP(DLINP, LOGL_ERROR, "message %d not found!\n", num); } + msgb_free(msg); return 0; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36573?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I86fc159d928fc7ebce2f771670c5a198c52f5fc0 Gerrit-Change-Number: 36573 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • ...
  • 113
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.