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 2025

  • 1 participants
  • 1186 discussions
[S] Change in osmo-hnbgw[master]: Drop unused struct ue_context
by pespin 08 Apr '25

08 Apr '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39982?usp=email ) Change subject: Drop unused struct ue_context ...................................................................... Drop unused struct ue_context Commit submitted 2 years ago dropping list of HNBAP UE Context actually forgot to drop the struct declaration too. Fixes: 15e552f2321979ecedb438792d507c55669e4b14 Change-Id: I0c887ab6e9674d7f123668ab38dee8cc6e66469d --- M include/osmocom/hnbgw/hnbgw.h 1 file changed, 0 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/82/39982/1 diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index fc110c0..1623045 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -416,17 +416,6 @@ struct osmo_timer_list disconnected_timeout; }; -struct ue_context { - /*! Entry in the HNB-global list of UE */ - struct llist_head list; - /*! Unique Context ID for this UE */ - uint32_t context_id; - char imsi[16+1]; - uint32_t tmsi; - /*! UE is serviced via this HNB */ - struct hnb_context *hnb; -}; - struct hnbgw { struct { const char *iuh_local_ip; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39982?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I0c887ab6e9674d7f123668ab38dee8cc6e66469d Gerrit-Change-Number: 39982 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-iuh[master]: ranap_common_ran: rename ctx -> priv
by pespin 08 Apr '25

08 Apr '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/39981?usp=email ) Change subject: ranap_common_ran: rename ctx -> priv ...................................................................... ranap_common_ran: rename ctx -> priv This is basically commit 05bb6ad563c178de70645e815557fe225cd078b9 applied to ranap_common_ran instead of ranap_common_cn. Rename the "ctx" argument of ranap_ran_rx_co to "priv" as it is private user data passed to the callback. Change-Id: I23f7f16cd7c487931226035e2616c85b75d79d08 --- M include/osmocom/ranap/ranap_common_ran.h M src/ranap_common_ran.c 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/81/39981/1 diff --git a/include/osmocom/ranap/ranap_common_ran.h b/include/osmocom/ranap/ranap_common_ran.h index 7118c7e..d632c46 100644 --- a/include/osmocom/ranap/ranap_common_ran.h +++ b/include/osmocom/ranap/ranap_common_ran.h @@ -14,4 +14,4 @@ OSMO_DEPRECATED("Use ranap_ran_rx_co_decode2() instead, the first arg is not used"); /* receive a connection-oriented RANAP message */ -int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); +int ranap_ran_rx_co(ranap_handle_cb cb, void *priv, uint8_t *data, size_t len); diff --git a/src/ranap_common_ran.c b/src/ranap_common_ran.c index fe11610..4028611 100644 --- a/src/ranap_common_ran.c +++ b/src/ranap_common_ran.c @@ -321,7 +321,7 @@ /* receive a connection-oriented RANAP message and call * cn_ranap_handle_co() with the resulting ranap_message struct */ -int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +int ranap_ran_rx_co(ranap_handle_cb cb, void *priv, uint8_t *data, size_t len) { ranap_message message; int rc; @@ -329,7 +329,7 @@ rc = ranap_ran_rx_co_decode2(&message, data, len); if (rc == 0) - (*cb) (ctx, &message); + (*cb) (priv, &message); else LOGP(DRANAP, LOGL_ERROR, "Not calling ran_ranap_handle_co() due to rc=%d\n", rc); -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/39981?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I23f7f16cd7c487931226035e2616c85b75d79d08 Gerrit-Change-Number: 39981 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-iuh[master]: ranap_common_ran: remove unused ctx args
by pespin 08 Apr '25

08 Apr '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/39980?usp=email ) Change subject: ranap_common_ran: remove unused ctx args ...................................................................... ranap_common_ran: remove unused ctx args This commit is basically 8b6dad3331eab339a7ffea7c22ed1830fe9ced60 applied to ranap_common_ran instead of ranap_common_cn. ranap_ran_rx_co has a void *ctx argument, that gets passed to: * a callback function and * to various decode functions in the same file. As it is named "ctx", it looks like a talloc context. But the decode functions don't use ctx at all and so in reality it is private userdata for the callback. It is used as such by test/hnb-test-rua and in osmo-msc. Change-Id: I57b320c2fdd72d11b87507d0cd9c2e7b479e7fe4 --- M TODO-RELEASE M include/osmocom/ranap/ranap_common_ran.h M src/ranap_common_ran.c 3 files changed, 16 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/80/39980/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..34f3506 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,5 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-ranap add API ranap_ran_rx_co_decode2() +libosmo-ranap deprecate API ranap_ran_rx_co_decode() diff --git a/include/osmocom/ranap/ranap_common_ran.h b/include/osmocom/ranap/ranap_common_ran.h index 5eef272..7118c7e 100644 --- a/include/osmocom/ranap/ranap_common_ran.h +++ b/include/osmocom/ranap/ranap_common_ran.h @@ -9,7 +9,9 @@ void ranap_ran_rx_co_free(ranap_message *message); /* decode a connection-oriented RANAP message */ -int ranap_ran_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); +int ranap_ran_rx_co_decode2(ranap_message *message, uint8_t *data, size_t len); +int ranap_ran_rx_co_decode(void *unused, ranap_message *message, uint8_t *data, size_t len) + OSMO_DEPRECATED("Use ranap_ran_rx_co_decode2() instead, the first arg is not used"); /* receive a connection-oriented RANAP message */ int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); diff --git a/src/ranap_common_ran.c b/src/ranap_common_ran.c index 828587e..fe11610 100644 --- a/src/ranap_common_ran.c +++ b/src/ranap_common_ran.c @@ -33,7 +33,7 @@ #define DRANAP _ranap_DRANAP -static int ran_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg, ranap_message *message) +static int ran_ranap_rx_initiating_msg_co(RANAP_InitiatingMessage_t *imsg, ranap_message *message) { int rc = 0; @@ -232,13 +232,13 @@ } } -static int _ran_ranap_rx_co(void *ctx, RANAP_RANAP_PDU_t *pdu, ranap_message *message) +static int _ran_ranap_rx_co(RANAP_RANAP_PDU_t *pdu, ranap_message *message) { int rc = 0; switch (pdu->present) { case RANAP_RANAP_PDU_PR_initiatingMessage: - rc = ran_ranap_rx_initiating_msg_co(ctx, &pdu->choice.initiatingMessage, message); + rc = ran_ranap_rx_initiating_msg_co(&pdu->choice.initiatingMessage, message); break; case RANAP_RANAP_PDU_PR_successfulOutcome: rc = ran_ranap_rx_successful_msg_co(&pdu->choice.successfulOutcome, message); @@ -289,7 +289,7 @@ } /* decode a connection-oriented RANAP message */ -int ranap_ran_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) +int ranap_ran_rx_co_decode2(ranap_message *message, uint8_t *data, size_t len) { RANAP_RANAP_PDU_t *pdu = NULL; asn_dec_rval_t dec_ret; @@ -306,7 +306,7 @@ message->direction = pdu->present; - rc = _ran_ranap_rx_co(ctx, pdu, message); + rc = _ran_ranap_rx_co(pdu, message); error_free: ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); @@ -314,6 +314,11 @@ return rc; } +int ranap_ran_rx_co_decode(void *unused, ranap_message *message, uint8_t *data, size_t len) +{ + return ranap_ran_rx_co_decode2(message, data, len); +} + /* receive a connection-oriented RANAP message and call * cn_ranap_handle_co() with the resulting ranap_message struct */ int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) @@ -321,7 +326,7 @@ ranap_message message; int rc; - rc = ranap_ran_rx_co_decode(ctx, &message, data, len); + rc = ranap_ran_rx_co_decode2(&message, data, len); if (rc == 0) (*cb) (ctx, &message); -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/39980?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I57b320c2fdd72d11b87507d0cd9c2e7b479e7fe4 Gerrit-Change-Number: 39980 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-hnbgw[master]: hnbap: Make hnbgw_tx_ue_register_acc_tmsi() signature similar to hnbg...
by pespin 08 Apr '25

08 Apr '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39979?usp=email ) Change subject: hnbap: Make hnbgw_tx_ue_register_acc_tmsi() signature similar to hnbgw_tx_ue_register_acc() ...................................................................... hnbap: Make hnbgw_tx_ue_register_acc_tmsi() signature similar to hnbgw_tx_ue_register_acc() Make those functions look more similar by calling them with get_next_ue_ctx_id() as param in hnbgw_rx_ue_register_req(). Change-Id: I9ce01babda7cb7e415cb7514c26f10a1773166fa --- M src/osmo-hnbgw/hnbgw_hnbap.c 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/79/39979/1 diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c index 99a27f5..5874457 100644 --- a/src/osmo-hnbgw/hnbgw_hnbap.c +++ b/src/osmo-hnbgw/hnbgw_hnbap.c @@ -341,7 +341,7 @@ return hnbgw_hnbap_tx(hnb, msg); } -static int hnbgw_tx_ue_register_acc_tmsi(struct hnb_context *hnb, HNBAP_UE_Identity_t *ue_id) +static int hnbgw_tx_ue_register_acc_tmsi(struct hnb_context *hnb, HNBAP_UE_Identity_t *ue_id, uint32_t context_id) { HNBAP_UERegisterAccept_t accept_out; HNBAP_UERegisterAcceptIEs_t accept; @@ -393,7 +393,7 @@ tmsi = ntohl(tmsi); LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "HNBAP register with TMSI %x\n", tmsi); - asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, get_next_ue_ctx_id()); + asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, context_id); memset(&accept_out, 0, sizeof(accept_out)); rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept); @@ -616,7 +616,7 @@ case HNBAP_UE_Identity_PR_tMSILAI: case HNBAP_UE_Identity_PR_pTMSIRAI: if (g_hnbgw->config.hnbap_allow_tmsi) { - rc = hnbgw_tx_ue_register_acc_tmsi(ctx, &ies.uE_Identity); + rc = hnbgw_tx_ue_register_acc_tmsi(ctx, &ies.uE_Identity, get_next_ue_ctx_id()); } else { cause.present = HNBAP_Cause_PR_radioNetwork; cause.choice.radioNetwork = HNBAP_CauseRadioNetwork_invalid_UE_identity; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39979?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I9ce01babda7cb7e415cb7514c26f10a1773166fa Gerrit-Change-Number: 39979 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-pcap[master]: client: Avoid sending link frame over non-connected conn
by pespin 08 Apr '25

08 Apr '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39945?usp=email ) Change subject: client: Avoid sending link frame over non-connected conn ...................................................................... client: Avoid sending link frame over non-connected conn Otherwise error messages appear upon start when starting the capture and the conns haven't yet been established (they are started immediately afterwards in main.c). The errors are actually harmless since network code takes care of sending a link frame upon connection TCP/TLS handshake completes. Change-Id: I091523e1d9f644e97b114b4cc524307a83dd564f --- M include/osmo-pcap/osmo_pcap_client.h M src/osmo_client_core.c M src/osmo_client_network.c 3 files changed, 18 insertions(+), 1 deletion(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-pcap/osmo_pcap_client.h b/include/osmo-pcap/osmo_pcap_client.h index fdd59f9..fc65132 100644 --- a/include/osmo-pcap/osmo_pcap_client.h +++ b/include/osmo-pcap/osmo_pcap_client.h @@ -149,6 +149,7 @@ void osmo_client_conn_connect(struct osmo_pcap_client_conn *conn); void osmo_client_conn_disconnect(struct osmo_pcap_client_conn *conn); void osmo_client_conn_reconnect(struct osmo_pcap_client_conn *conn); +bool osmo_client_conn_is_connected(const struct osmo_pcap_client_conn *conn); struct osmo_pcap_handle *osmo_pcap_handle_alloc(struct osmo_pcap_client *client, const char *devname); diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c index dd16878..7df14ca 100644 --- a/src/osmo_client_core.c +++ b/src/osmo_client_core.c @@ -277,8 +277,10 @@ return rc; } + /* Restart already initialized pcap files to adapt for new capture parameters: */ llist_for_each_entry(conn, &client->conns, entry) - osmo_client_conn_send_link(conn); + if (osmo_client_conn_is_connected(conn)) + osmo_client_conn_send_link(conn); return 0; } diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c index c4a9623..4b91429 100644 --- a/src/osmo_client_network.c +++ b/src/osmo_client_network.c @@ -605,3 +605,17 @@ } } } + +bool osmo_client_conn_is_connected(const struct osmo_pcap_client_conn *conn) +{ + if (conn->tls_on) { + /* No socket yet. */ + if (conn->wqueue.bfd.fd < 0) + return false; /* No socket yet. */ + if (conn->wqueue.bfd.cb == conn_cb_tls) + return false; /* Still doing TLS handshake */ + return true; + } + + return conn->cli && osmo_stream_cli_is_connected(conn->cli); +} -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39945?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I091523e1d9f644e97b114b4cc524307a83dd564f Gerrit-Change-Number: 39945 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> 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>
1 0
0 0
[XS] Change in osmo-pcap[master]: client: constify args in can_forward_packet()
by pespin 08 Apr '25

08 Apr '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39947?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: client: constify args in can_forward_packet() ...................................................................... client: constify args in can_forward_packet() Change-Id: I3568b962fea7d0e34b68f75cea7b59b1df158238 --- M src/osmo_client_core.c 1 file changed, 3 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c index 7df14ca..62b2c3c 100644 --- a/src/osmo_client_core.c +++ b/src/osmo_client_core.c @@ -101,9 +101,9 @@ } static int can_forward_packet( - struct osmo_pcap_client *client, - struct osmo_pcap_handle *ph, - struct pcap_pkthdr *hdr, + const struct osmo_pcap_client *client, + const struct osmo_pcap_handle *ph, + const struct pcap_pkthdr *hdr, const u_char *data) { int ll_type; -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39947?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I3568b962fea7d0e34b68f75cea7b59b1df158238 Gerrit-Change-Number: 39947 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-pcap[master]: client: use osmo_stream_cli to transmit data to pcap-server
by pespin 08 Apr '25

08 Apr '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39944?usp=email ) Change subject: client: use osmo_stream_cli to transmit data to pcap-server ...................................................................... client: use osmo_stream_cli to transmit data to pcap-server Similarly to previous work done in osmo-pcap-server, the switch to osmo_stream doesn't cover the TLS-enabled scenario, since moving TLS related code to osmo_stream requires significant amount of work and can be done in a subsequent step. Related: SYS#7290 Change-Id: I72e8a6ceb4fb1eb70372e13bb139ead0e2bc0860 --- M include/osmo-pcap/osmo_pcap_client.h M src/Makefile.am M src/osmo_client_network.c M src/osmo_client_vty.c 4 files changed, 145 insertions(+), 37 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmo-pcap/osmo_pcap_client.h b/include/osmo-pcap/osmo_pcap_client.h index 1b66488..fdd59f9 100644 --- a/include/osmo-pcap/osmo_pcap_client.h +++ b/include/osmo-pcap/osmo_pcap_client.h @@ -70,7 +70,7 @@ char *srv_ip; int srv_port; char *source_ip; - struct osmo_wqueue wqueue; + struct osmo_stream_cli *cli; struct osmo_timer_list timer; enum osmo_pcap_protocol protocol; @@ -87,6 +87,7 @@ unsigned tls_log_level; struct osmo_tls_session tls_session; + struct osmo_wqueue wqueue; /* back pointer */ struct osmo_pcap_client *client; diff --git a/src/Makefile.am b/src/Makefile.am index 504952f..b45bf84 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,6 +26,7 @@ $(NULL) osmo_pcap_client_LDADD = \ + $(LIBOSMONETIF_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOCORE_LIBS) \ diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c index abdb7d3..c4a9623 100644 --- a/src/osmo_client_network.c +++ b/src/osmo_client_network.c @@ -32,6 +32,8 @@ #include <osmocom/core/select.h> #include <osmocom/core/socket.h> +#include <osmocom/netif/stream.h> + #include <arpa/inet.h> #include <netinet/in.h> #include <netdb.h> @@ -61,13 +63,26 @@ static void write_data(struct osmo_pcap_client_conn *conn, struct msgb *msg) { - if (osmo_wqueue_enqueue_quiet(&conn->wqueue, msg) != 0) { - LOGCONN(conn, LOGL_ERROR, "Failed to enqueue msg (capacity: %u/%u)\n", - conn->wqueue.current_length, conn->wqueue.max_length); + if (conn->tls_on) { + if (osmo_wqueue_enqueue_quiet(&conn->wqueue, msg) != 0) { + LOGCONN(conn, LOGL_ERROR, "Failed to enqueue msg (capacity: %u/%u)\n", + conn->wqueue.current_length, conn->wqueue.max_length); + rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_QERR); + msgb_free(msg); + } + return; + } + + if (!conn->cli) { + LOGCONN(conn, LOGL_NOTICE, "Failed to enqueue msg (no stream)\n"); rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_QERR); msgb_free(msg); return; } + osmo_stream_cli_send(conn->cli, msg); + /* FIXME: osmo_stream_cli_send() doesn't have a rc, hence we can't ever increment on error: + * rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_QERR); + */ } static int read_cb(struct osmo_fd *fd) @@ -119,7 +134,7 @@ lost_connection(conn); } -int conn_cb(struct osmo_fd *fd, unsigned int what) +int conn_cb_tls(struct osmo_fd *fd, unsigned int what) { /* finally the socket is connected... continue */ if (what & OSMO_FD_WRITE) { @@ -128,22 +143,15 @@ * The write queue needs to work differently for GNUtls. Before we can * send data we will need to complete handshake. */ - if (conn->tls_on) { - if (!osmo_tls_init_client_session(conn)) { - lost_connection(conn); - return -1; - } - conn->tls_session.handshake_done = handshake_done_cb; - conn->tls_session.error = tls_error_cb; - - /* fd->data now points somewhere else, stop */ - return 0; - } else { - conn->wqueue.bfd.cb = osmo_wqueue_bfd_cb; - conn->wqueue.bfd.data = conn; - osmo_wqueue_clear(&conn->wqueue); - osmo_client_conn_send_link(conn); + if (!osmo_tls_init_client_session(conn)) { + lost_connection(conn); + return -1; } + conn->tls_session.handshake_done = handshake_done_cb; + conn->tls_session.error = tls_error_cb; + + /* fd->data now points somewhere else, stop */ + return 0; } if (what & OSMO_FD_READ) @@ -446,15 +454,13 @@ write_data(conn, msg); } -void osmo_client_conn_connect(struct osmo_pcap_client_conn *conn) +static void osmo_client_conn_connect_tls(struct osmo_pcap_client_conn *conn) { int rc; uint16_t srv_port; int sock_type, sock_proto; unsigned int when; - osmo_client_conn_disconnect(conn); - conn->wqueue.read_cb = read_cb; conn->wqueue.write_cb = write_cb; osmo_wqueue_clear(&conn->wqueue); @@ -484,12 +490,97 @@ lost_connection(conn); return; } - osmo_fd_setup(&conn->wqueue.bfd, rc, when, conn_cb, conn, 0); + osmo_fd_setup(&conn->wqueue.bfd, rc, when, conn_cb_tls, conn, 0); osmo_fd_register(&conn->wqueue.bfd); rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_CONNECT); } +static int stream_cli_connect_cb(struct osmo_stream_cli *cli) +{ + struct osmo_pcap_client_conn *conn = osmo_stream_cli_get_data(cli); + osmo_client_conn_send_link(conn); + return 0; +} + +static int stream_cli_disconnect_cb(struct osmo_stream_cli *cli) +{ + struct osmo_pcap_client_conn *conn = osmo_stream_cli_get_data(cli); + lost_connection(conn); + return 0; +} + +static int stream_cli_read_cb(struct osmo_stream_cli *cli, int res, struct msgb *msg) +{ + struct osmo_pcap_client_conn *conn = osmo_stream_cli_get_data(cli); + + msgb_free(msg); + if (res <= 0) { + LOGCONN(conn, LOGL_ERROR, "Lost connection on read\n"); + lost_connection(conn); + } + return 0; +} + +void osmo_client_conn_connect(struct osmo_pcap_client_conn *conn) +{ + uint16_t srv_port; + int sock_type, sock_proto; + struct osmo_stream_cli *cli; + + osmo_client_conn_disconnect(conn); + + /* We still don't support the tls layer through osmo_stream... */ + if (conn->tls_on) { + osmo_client_conn_connect_tls(conn); + return; + } + + switch (conn->protocol) { + case PROTOCOL_OSMOPCAP: + srv_port = conn->srv_port; + sock_type = SOCK_STREAM; + sock_proto = IPPROTO_TCP; + break; + case PROTOCOL_IPIP: + srv_port = 0; + sock_type = SOCK_RAW; + sock_proto = IPPROTO_IPIP; + break; + default: + OSMO_ASSERT(0); + break; + } + + OSMO_ASSERT(!conn->cli); + conn->cli = cli = osmo_stream_cli_create(conn); + osmo_stream_cli_set_name(cli, conn->name); + osmo_stream_cli_set_data(cli, conn); + osmo_stream_cli_set_type(cli, sock_type); + osmo_stream_cli_set_proto(cli, sock_proto); + osmo_stream_cli_set_local_addr(cli, conn->source_ip); + osmo_stream_cli_set_local_port(cli, 0); + osmo_stream_cli_set_addr(cli, conn->srv_ip); + osmo_stream_cli_set_port(cli, srv_port); + osmo_stream_cli_set_nodelay(cli, true); + osmo_stream_cli_set_tx_queue_max_length(cli, conn->wqueue.max_length); + + /* Reconnect is handled by upper layers: */ + osmo_stream_cli_set_reconnect_timeout(cli, -1); + osmo_stream_cli_set_connect_cb(cli, stream_cli_connect_cb); + osmo_stream_cli_set_disconnect_cb(cli, stream_cli_disconnect_cb); + osmo_stream_cli_set_read_cb2(cli, stream_cli_read_cb); + + if (osmo_stream_cli_open(cli)) { + LOGCONN(conn, LOGL_ERROR, "Failed opening connection: %s\n", strerror(errno)); + conn->cli = NULL; + osmo_stream_cli_destroy(cli); + return; + } + + rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_CONNECT); +} + void osmo_client_conn_reconnect(struct osmo_pcap_client_conn *conn) { lost_connection(conn); @@ -497,12 +588,20 @@ void osmo_client_conn_disconnect(struct osmo_pcap_client_conn *conn) { - if (conn->wqueue.bfd.fd >= 0) { - osmo_tls_release(&conn->tls_session); - osmo_fd_unregister(&conn->wqueue.bfd); - close(conn->wqueue.bfd.fd); - conn->wqueue.bfd.fd = -1; - } - osmo_timer_del(&conn->timer); + + if (conn->tls_on) { + if (conn->wqueue.bfd.fd >= 0) { + osmo_tls_release(&conn->tls_session); + osmo_fd_unregister(&conn->wqueue.bfd); + close(conn->wqueue.bfd.fd); + conn->wqueue.bfd.fd = -1; + } + } else { + if (conn->cli) { + struct osmo_stream_cli *cli = conn->cli; + conn->cli = NULL; + osmo_stream_cli_destroy(cli); + } + } } diff --git a/src/osmo_client_vty.c b/src/osmo_client_vty.c index 1824324..127e52f 100644 --- a/src/osmo_client_vty.c +++ b/src/osmo_client_vty.c @@ -25,6 +25,7 @@ #include <osmo-pcap/common.h> #include <osmocom/core/talloc.h> +#include <osmocom/netif/stream.h> #include <stdlib.h> @@ -262,12 +263,12 @@ { struct osmo_pcap_client_conn *conn = get_conn(vty); - if (!conn->tls_on) { - if (conn->wqueue.bfd.fd >= 0) - osmo_client_conn_reconnect(conn); - } + if (conn->tls_on) + return CMD_SUCCESS; + osmo_client_conn_disconnect(conn); conn->tls_on = true; + osmo_client_conn_connect(conn); return CMD_SUCCESS; } @@ -278,10 +279,12 @@ { struct osmo_pcap_client_conn *conn = get_conn(vty); - if (conn->tls_on) - osmo_client_conn_reconnect(conn); + if (!conn->tls_on) + return CMD_SUCCESS; + osmo_client_conn_disconnect(conn); conn->tls_on = false; + osmo_client_conn_connect(conn); return CMD_SUCCESS; } @@ -568,6 +571,10 @@ struct osmo_pcap_client_conn *conn = get_conn(vty); conn->wqueue.max_length = atoi(argv[0]); + /* Apply on conn immediately if already created: */ + if (conn->cli) + osmo_stream_cli_set_tx_queue_max_length(conn->cli, conn->wqueue.max_length); + return CMD_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39944?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I72e8a6ceb4fb1eb70372e13bb139ead0e2bc0860 Gerrit-Change-Number: 39944 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> 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>
1 0
0 0
[S] Change in osmo-pcap[master]: client: Avoid sending link frame over non-connected conn
by pespin 08 Apr '25

08 Apr '25
Attention is currently required from: fixeria, osmith. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39945?usp=email ) Change subject: client: Avoid sending link frame over non-connected conn ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39945?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I091523e1d9f644e97b114b4cc524307a83dd564f Gerrit-Change-Number: 39945 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> 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-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 08 Apr 2025 15:10:15 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-pcap[master]: client: use osmo_stream_cli to transmit data to pcap-server
by pespin 08 Apr '25

08 Apr '25
Attention is currently required from: osmith. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39944?usp=email ) Change subject: client: use osmo_stream_cli to transmit data to pcap-server ...................................................................... Patch Set 5: Code-Review+2 (1 comment) Patchset: PS5: Readding +2 after fixing comment typo as requested. -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39944?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I72e8a6ceb4fb1eb70372e13bb139ead0e2bc0860 Gerrit-Change-Number: 39944 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> 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-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Tue, 08 Apr 2025 15:09:56 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-hnbgw[master]: Set 'hnbap-allow-tmsi 1' by default
by neels 08 Apr '25

08 Apr '25
Attention is currently required from: lynxis lazus, pespin. neels has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39978?usp=email ) Change subject: Set 'hnbap-allow-tmsi 1' by default ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39978?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I3c4c0decf34959fc2d5683b02224f27d204aa5e9 Gerrit-Change-Number: 39978 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 08 Apr 2025 15:08:02 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • ...
  • 119
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.