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 osmo-ttcn3-hacks[master]: hnbgw: TC_hnb_register_duplicate: Fix 2nd HNB_REG_REQ containing diff...
by fixeria 16 Apr '24

16 Apr '24
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36572?usp=email ) Change subject: hnbgw: TC_hnb_register_duplicate: Fix 2nd HNB_REG_REQ containing different LAC ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36572?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I7f5d8d8403211488966fc30bf4d82e894664df51 Gerrit-Change-Number: 36572 Gerrit-PatchSet: 2 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-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 16 Apr 2024 18:56:06 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: hnbgw: osmo-hnbgw.cfg: Update file to make it similar to the one in d...
by fixeria 16 Apr '24

16 Apr '24
Attention is currently required from: laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36571?usp=email ) Change subject: hnbgw: osmo-hnbgw.cfg: Update file to make it similar to the one in docker-playground ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36571?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I02338c4bc43e04d47c92c484532fcc48edf0222d Gerrit-Change-Number: 36571 Gerrit-PatchSet: 2 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-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 16 Apr 2024 18:55:40 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmo-sccp[master]: xua_asp_fsm: Fix 'Event AS_ASSIGNED not permitted'
by pespin 16 Apr '24

16 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/36577?usp=email ) Change subject: xua_asp_fsm: Fix 'Event AS_ASSIGNED not permitted' ...................................................................... xua_asp_fsm: Fix 'Event AS_ASSIGNED not permitted' The event case handling (ignore it) was added in a commit some time ago, but it forgot to add it to the allstate_event_mask in the xua_fsm (it was added only in the ipa_fsm, which is the one using it). This bug should in theory be harmless since the only code dispatching the signal is not checking the return code of osmo_fsm_inst_dispatch(). Related: SYS#5914 Fixes: 57444690212b1576eaf0a7156448ba2d27c59050 Change-Id: Iaead46bbc40b923763bc3dbe4d24d8952822de4a --- M src/xua_asp_fsm.c 1 file changed, 20 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/77/36577/1 diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index fadcde9..97391bb 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -769,7 +769,8 @@ .allstate_event_mask = S(XUA_ASP_E_SCTP_COMM_DOWN_IND) | S(XUA_ASP_E_SCTP_RESTART_IND) | S(XUA_ASP_E_ASPSM_BEAT) | - S(XUA_ASP_E_ASPSM_BEAT_ACK), + S(XUA_ASP_E_ASPSM_BEAT_ACK) | + S(XUA_ASP_E_AS_ASSIGNED), .allstate_action = xua_asp_allstate, .cleanup = xua_asp_fsm_cleanup, }; -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/36577?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: Iaead46bbc40b923763bc3dbe4d24d8952822de4a Gerrit-Change-Number: 36577 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bsc[master]: cbsp_link.c: Update stream_cli read_cb2 functions to accommodate for ...
by pespin 16 Apr '24

16 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/36576?usp=email ) Change subject: cbsp_link.c: Update stream_cli read_cb2 functions to accommodate for new API param ...................................................................... cbsp_link.c: Update stream_cli read_cb2 functions to accommodate for new API param libosmo-netif (not yet released) stream_cli osmo_io read_cb API was updated to provide read result status. Hence, now API users can account for lower layer errors and act properly, like it used to do with the previous ofd backend. This commit partially reverts some error code paths removed in 85687bf176e4b9663f2396a27c28b49221c72fa3 when converting code to use osmo_io stream_cli backend. Change-Id: I4cce5cb6ca98bc28a67dd6e927e9cdfd2312851a Depends: libosmo-netif.git Change-Id I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M src/osmo-bsc/cbsp_link.c 1 file changed, 37 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/76/36576/1 diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c index 98f25d3..20206e2 100644 --- a/src/osmo-bsc/cbsp_link.c +++ b/src/osmo-bsc/cbsp_link.c @@ -148,11 +148,28 @@ return 0; } -static int cbsp_client_read_cb(struct osmo_stream_cli *cli, struct msgb *msg) +static int cbsp_client_read_cb(struct osmo_stream_cli *cli, int res, struct msgb *msg) { struct bsc_cbc_link *cbc = osmo_stream_cli_get_data(cli); struct osmo_cbsp_decoded *decoded; + if (res <= 0) { + if (res == -EAGAIN || res == -EINTR) { + msgb_free(msg); + return 0; + } + /* + if (rc == -EPIPE || rc == -ECONNRESET) { + // lost connection + } else if (rc == 0) { + // connection closed + } */ + osmo_stream_cli_reconnect(cli); + msgb_free(msg); + return -EBADF; + } + + OSMO_ASSERT(msg); decoded = osmo_cbsp_decode(cli, msg); if (decoded) { -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/36576?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I4cce5cb6ca98bc28a67dd6e927e9cdfd2312851a Gerrit-Change-Number: 36576 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmo-netif[master]: stream_cli: Add res param to read_cb2
by pespin 16 Apr '24

16 Apr '24
Attention is currently required from: fixeria, jolly, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_cli: Add res param to read_cb2 ...................................................................... Patch Set 1: Code-Review-2 (1 comment) Patchset: PS1: I still need to run some tests against this patch and the ones using them (libosmo-sccp, osmo-bsc), marking as WIP until then. Help testing welcome. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?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: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 16 Apr 2024 17:45:24 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmo-sccp[master]: ss7_asp: Update stream_cli read_cb2 functions to accommodate for new ...
by pespin 16 Apr '24

16 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/libosmo-sccp/+/36575?usp=email to look at the new patch set (#3). Change subject: ss7_asp: Update stream_cli read_cb2 functions to accommodate for new API param ...................................................................... ss7_asp: Update stream_cli read_cb2 functions to accommodate for new API param libosmo-netif (not yet released) stream_cli osmo_io read_cb API was updated to provide read result status. Hence, now API users (ss7_asp) can account for lower layer errors and act properly, like it used to do with the previous ofd backend. This commit partially reverts some error code paths removed in 9257cd896e255403822bee6f87f5487a92fd3c11 when converting code to use osmo_io stream_cli backend. Change-Id: I579f4101a9e2874e310ff78e4571f38cfe8dfab0 Depends: libosmo-netif.git Change-Id I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M src/osmo_ss7_asp.c 1 file changed, 47 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/75/36575/3 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/36575?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: I579f4101a9e2874e310ff78e4571f38cfe8dfab0 Gerrit-Change-Number: 36575 Gerrit-PatchSet: 3 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
[M] Change in libosmo-sccp[master]: ss7_asp: Update stream_cli read_cb2 functions to accommodate for new ...
by pespin 16 Apr '24

16 Apr '24
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/libosmo-sccp/+/36575?usp=email ) Change subject: ss7_asp: Update stream_cli read_cb2 functions to accommodate for new API param ...................................................................... ss7_asp: Update stream_cli read_cb2 functions to accommodate for new API param libosmo-netif (not yet released) stream_cli osmo_io read_cb API was updated to provide read result status. Hence, now API users (ss/ asp) can now account for lower layer errors and act properly, like it used to do with the previous ofd backend. This commit partially reverts some error code paths removed in 9257cd896e255403822bee6f87f5487a92fd3c11 when converting code to use osmo_io stream_cli backend. Change-Id: I579f4101a9e2874e310ff78e4571f38cfe8dfab0 Depends: libosmo-netif.git Change-Id I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M src/osmo_ss7_asp.c 1 file changed, 47 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/75/36575/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/36575?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: I579f4101a9e2874e310ff78e4571f38cfe8dfab0 Gerrit-Change-Number: 36575 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in libosmo-sccp[master]: ss7_asp: Update stream_cli read_cb2 functions to accomodate for new A...
by pespin 16 Apr '24

16 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/36575?usp=email ) Change subject: ss7_asp: Update stream_cli read_cb2 functions to accomodate for new API param ...................................................................... ss7_asp: Update stream_cli read_cb2 functions to accomodate for new API param libosmo-netif (not yet released) stream_cli osmo_io read_cb API was updated to provide read result status. Hence, now API users (ss/ asp) can now account for lower layer errors and act properly, like it used to do with the previous ofd backend. This commit partially reverts some error code paths removed in 9257cd896e255403822bee6f87f5487a92fd3c11 when converting code to use osmo_io stream_cli backend. Change-Id: I579f4101a9e2874e310ff78e4571f38cfe8dfab0 Depends: libosmo-netif.git Change-Id I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M src/osmo_ss7_asp.c 1 file changed, 47 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/75/36575/1 diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c index 90c72a9..6221d7b 100644 --- a/src/osmo_ss7_asp.c +++ b/src/osmo_ss7_asp.c @@ -602,9 +602,9 @@ talloc_free(asp); } -static int xua_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg); -static int ipa_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg); -static int m3ua_tcp_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg); +static int xua_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg); +static int ipa_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg); +static int m3ua_tcp_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg); static int xua_cli_connect_cb(struct osmo_stream_cli *cli); static int xua_cli_close_and_reconnect(struct osmo_stream_cli *cli); @@ -953,11 +953,21 @@ } /* read call-back for IPA/SCCPlite socket */ -static int ipa_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int ipa_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { int fd = osmo_stream_cli_get_fd(conn); struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(conn); + if (res <= 0) { + if (res == -EAGAIN) { + msgb_free(msg); + return 0; + } + xua_cli_close_and_reconnect(conn); + msgb_free(msg); + return res; + } + msg->dst = asp; rate_ctr_inc2(asp->ctrg, SS7_ASP_CTR_PKT_RX_TOTAL); /* we can use the 'fd' return value of osmo_stream_srv_get_fd() here unverified as all we do @@ -966,7 +976,7 @@ } /* read call-back for M3UA-over-TCP socket */ -static int m3ua_tcp_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int m3ua_tcp_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { const struct xua_common_hdr *hdr; @@ -980,10 +990,10 @@ else msgb_sctp_stream(msg) = 0; - return xua_cli_read_cb(conn, msg); + return xua_cli_read_cb(conn, res, msg); } -static int xua_cli_read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int xua_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(conn); unsigned int ppid; @@ -1008,6 +1018,17 @@ default: break; } + if (rc == 0) + xua_cli_close_and_reconnect(conn); + rc = 0; + goto out; + } + if (rc < 0) { + xua_cli_close_and_reconnect(conn); + goto out; + } else if (rc == 0) { + xua_cli_close_and_reconnect(conn); + goto out; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/36575?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: I579f4101a9e2874e310ff78e4571f38cfe8dfab0 Gerrit-Change-Number: 36575 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmo-netif[master]: stream_cli: Add res param to read_cb2
by pespin 16 Apr '24

16 Apr '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_cli: Add res param to read_cb2 ...................................................................... stream_cli: Add res param to read_cb2 Notify user about read errors, similar to what is supported in the earlier ofd cb backend of osmo_stream_cli: https://osmocom.org/issues/6405#note-15 Related: OS#6405 Fixes: 5fec34a9f20c3b8769373d1b28ae2062e5e2bdd6 Fixes: 0245cf5e07855abea72693272c55b50b5a93aff4 Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M examples/ipa-stream-client.c M examples/stream-client.c M include/osmocom/netif/stream.h M src/stream_cli.c M tests/stream/stream_test.c 5 files changed, 74 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/74/36574/1 diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index 720fe66..b58370e 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -102,13 +102,19 @@ return 0; } -static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int read_cb(struct osmo_stream_cli *conn, int res, 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 (res <= 0) { + LOGP(DIPATEST, LOGL_ERROR, "Event with no data! %d\n", res); + msgb_free(msg); + return 0; + } + if (osmo_ipa_process_msg(msg) < 0) { LOGP(DIPATEST, LOGL_ERROR, "bad IPA message\n"); msgb_free(msg); diff --git a/examples/stream-client.c b/examples/stream-client.c index cae0153..6d20263 100644 --- a/examples/stream-client.c +++ b/examples/stream-client.c @@ -54,10 +54,17 @@ return 0; } -static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { LOGP(DSTREAMTEST, LOGL_NOTICE, "receiving message from stream... "); + if (res < 0) { + LOGPC(DSTREAMTEST, LOGL_ERROR, "cannot receive message (res = %d)\n", res); + msgb_free(msg); + return 0; + } + + LOGPC(DSTREAMTEST, LOGL_NOTICE, "got %d bytes: %s\n", msg->len, msgb_hexdump(msg)); msgb_free(msg); diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index 61bc1ad..b680b61 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -160,6 +160,13 @@ /*! \brief Osmocom Stream Client: Single client connection */ struct osmo_stream_cli; +/*! Completion call-back function when something was read from from the stream client socket. + * \param[in] cli Stream Client that got receive event. + * \param[in] res return value of the read()/recvmsg()/... call, or -errno in case of error. + * \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! */ +typedef int (*osmo_stream_cli_read_cb2_t)(struct osmo_stream_cli *cli, int res, 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); @@ -182,7 +189,7 @@ 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_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, int (*segmentation_cb)(struct msgb *msg)); 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 11c88ae..0e47bb8 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -106,7 +106,7 @@ 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); + osmo_stream_cli_read_cb2_t iofd_read_cb; int (*write_cb)(struct osmo_stream_cli *cli); int (*segmentation_cb)(struct msgb *msg); void *data; @@ -449,14 +449,22 @@ stream_cli_handle_connecting(cli, res); break; case STREAM_CLI_STATE_CONNECTED: - if (res <= 0) { - LOGSCLI(cli, LOGL_NOTICE, "received result %d in response to read\n", res); + switch (res) { + case -EPIPE: + case -ECONNRESET: + LOGSCLI(cli, LOGL_ERROR, "lost connection with srv (%d)\n", res); osmo_stream_cli_reconnect(cli); - msgb_free(msg); + break; + case 0: + LOGSCLI(cli, LOGL_NOTICE, "connection closed with srv\n"); + osmo_stream_cli_reconnect(cli); + break; + default: break; } + /* Notify user of new data or error: */ if (cli->iofd_read_cb) - cli->iofd_read_cb(cli, msg); + cli->iofd_read_cb(cli, res, msg); else msgb_free(msg); break; @@ -504,15 +512,22 @@ stream_cli_handle_connecting(cli, res); break; case STREAM_CLI_STATE_CONNECTED: - if (res <= 0) { - LOGSCLI(cli, LOGL_NOTICE, "received result %d in response to recvmsg\n", res); + switch (res) { + case -EPIPE: + case -ECONNRESET: + LOGSCLI(cli, LOGL_ERROR, "lost connection with srv (%d)\n", res); osmo_stream_cli_reconnect(cli); - msgb_free(msg); + break; + case 0: + LOGSCLI(cli, LOGL_NOTICE, "connection closed with srv\n"); + osmo_stream_cli_reconnect(cli); + break; + default: break; } - /* Forward message to read callback, also if the connection failed. */ + /* Notify user of new data or error: */ if (cli->iofd_read_cb) - cli->iofd_read_cb(cli, msg); + cli->iofd_read_cb(cli, res, msg); else msgb_free(msg); break; @@ -818,7 +833,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/tests/stream/stream_test.c b/tests/stream/stream_test.c index e50752b..2abf8d5 100644 --- a/tests/stream/stream_test.c +++ b/tests/stream/stream_test.c @@ -502,12 +502,19 @@ static struct osmo_timer_list fragmented_send_tl_cli; -static int test_segm_ipa_stream_srv_cli_read_cb(struct osmo_stream_cli *osc, struct msgb *msg) +static int test_segm_ipa_stream_srv_cli_read_cb(struct osmo_stream_cli *osc, int res, struct msgb *msg) { unsigned char *data; struct ipa_head *h = (struct ipa_head *) msg->l1h; uint8_t ipac_msg_type = *msg->data; struct msgb *reply; + + if (res < 0) { + fprintf(stderr, "cannot receive message (res = %d)\n", res); + msgb_free(msg); + return -ENOMSG; + } + LOGCLI(osc, "Received message from stream (payload len = %" PRIu16 ")\n", msgb_length(msg)); if (ipac_msg_type < 0 || 5 < ipac_msg_type) { fprintf(stderr, "Received unexpected IPAC message type %"PRIu8"\n", ipac_msg_type); @@ -772,7 +779,7 @@ static bool test_segm_ipa_stream_cli_all_msgs_processed = false; -static int test_segm_ipa_stream_cli_cli_read_cb(struct osmo_stream_cli *osc, struct msgb *msg) +static int test_segm_ipa_stream_cli_cli_read_cb(struct osmo_stream_cli *osc, int res, struct msgb *msg) { static unsigned msgnum_cli = 0; unsigned char *data; -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?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: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmo-netif[master]: examples/ipa-stream-client: Fix memleaks in read_cb()
by pespin 16 Apr '24

16 Apr '24
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/73/36573/1 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-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • ...
  • 113
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.