fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42848?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: server: fix NULL deref of file_hdr_msg when store is disabled
......................................................................
server: fix NULL deref of file_hdr_msg when store is disabled
When a connection has storing disabled (no store), conn->file_hdr_msg
is never populated. The previous link-header handling skipped the
first branch (gated on conn->store) and fell through to the comparison
branch, which dereferenced the still-NULL conn->file_hdr_msg, crashing
the server on the first PKT_LINK_HDR from such a client.
Gate the whole header tracking on conn->store and simply free the
message when not storing, since osmo_pcap_conn_restart_trace() already
no-ops in that case.
Change-Id: I419e1b66d07307c3e49294984887c153cd8494c3
AI-Assisted: yes (Claude)
---
M src/osmo_server_network.c
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index 81ad74e..37a5b03 100644
--- a/src/osmo_server_network.c
+++ b/src/osmo_server_network.c
@@ -166,7 +166,10 @@
if ((rc = validate_link_hdr(conn, data)) < 0)
return rc;
- if (conn->store && !conn->wrf) {
+ if (!conn->store) {
+ /* Not storing to a file: no link header to track or compare. */
+ msgb_free(msg);
+ } else if (!conn->wrf) {
/* First received link hdr in conn */
update_conn_file_hdr_msg(conn, msg);
} else if (msgb_l2len(conn->file_hdr_msg) != msgb_l2len(msg) ||
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42848?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: I419e1b66d07307c3e49294984887c153cd8494c3
Gerrit-Change-Number: 42848
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42847?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: server: vty: validate rotate-localtime modulus against the new interval
......................................................................
server: vty: validate rotate-localtime modulus against the new interval
apply_rotate_localtime() computed the maximum allowed modulus from
pcap_server->rotate_localtime.intv, the currently-stored (old) interval,
rather than the intv argument being applied. On first configuration the
stored interval is the default 0, so the switch hit the default case and
rejected an otherwise valid command; when changing intervals the modulus
was bounds-checked against the wrong interval. Switch on intv instead.
Change-Id: I0b367d4e255db3208b41e12adec682026b99cc18
AI-Assisted: yes (Claude)
---
M src/osmo_server_vty.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo_server_vty.c b/src/osmo_server_vty.c
index f96df7f..afdfcd8 100644
--- a/src/osmo_server_vty.c
+++ b/src/osmo_server_vty.c
@@ -289,7 +289,7 @@
static int apply_rotate_localtime(struct vty *vty, enum time_interval intv, unsigned int modulus)
{
unsigned int max_mod = 0;
- switch (pcap_server->rotate_localtime.intv) {
+ switch (intv) {
case TIME_INTERVAL_SEC:
max_mod = 60;
break;
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42847?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: I0b367d4e255db3208b41e12adec682026b99cc18
Gerrit-Change-Number: 42847
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42846?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: tls: do not treat GNUTLS_E_AGAIN/INTERRUPTED as fatal on read
......................................................................
tls: do not treat GNUTLS_E_AGAIN/INTERRUPTED as fatal on read
osmo_tls_client_bfd_cb() treated any non-positive return from
gnutls_record_recv() as a fatal error and tore down the session. On a
non-blocking socket gnutls_record_recv() can return GNUTLS_E_AGAIN or
GNUTLS_E_INTERRUPTED (both negative but non-fatal), which would drop
an otherwise healthy TLS session. Handle them as retryable, mirroring
the existing logic in tls_write().
Change-Id: If2f842b202dd08c07dffe3770c51cf0ce886beee
AI-Assisted: yes (Claude)
---
M src/osmo_tls.c
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo_tls.c b/src/osmo_tls.c
index 8524ee3..f06f50e 100644
--- a/src/osmo_tls.c
+++ b/src/osmo_tls.c
@@ -264,7 +264,11 @@
if (what & OSMO_FD_READ) {
int rc = tls_read(sess);
- if (rc <= 0) {
+ /* A non-blocking read may legitimately return GNUTLS_E_AGAIN or
+ * GNUTLS_E_INTERRUPTED; these are not errors, just retry later. */
+ if (rc == GNUTLS_E_INTERRUPTED || rc == GNUTLS_E_AGAIN) {
+ /* nothing to do, wait for the next read event */
+ } else if (rc <= 0) {
sess->error(sess);
return rc;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42846?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: If2f842b202dd08c07dffe3770c51cf0ce886beee
Gerrit-Change-Number: 42846
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42844?usp=email )
Change subject: server: fix msgb leak on duplicate link header
......................................................................
server: fix msgb leak on duplicate link header
rx_link_hdr() takes ownership of msg on success (rx_link() only frees
it on failure). Both branches that call update_conn_file_hdr_msg()
free msg, but when an identical link header was already stored neither
branch ran and msg was leaked.
This happens on every duplicate PKT_LINK_HDR, e.g. a client that
periodically resends its header. Free msg explicitly in that case.
Change-Id: I79344fe942342f2a736878142b3cf036fc982eef
AI-Assisted: yes (Claude)
---
M src/osmo_server_network.c
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index 6c0e609..81ad74e 100644
--- a/src/osmo_server_network.c
+++ b/src/osmo_server_network.c
@@ -173,6 +173,9 @@
memcmp(msgb_l2(conn->file_hdr_msg), msgb_l2(msg), msgb_l2len(msg)) != 0) {
/* Client changed the link hdr in conn */
update_conn_file_hdr_msg(conn, msg);
+ } else {
+ /* Identical link hdr already stored, nothing to do but free msg */
+ msgb_free(msg);
}
return 1;
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42844?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: I79344fe942342f2a736878142b3cf036fc982eef
Gerrit-Change-Number: 42844
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42841?usp=email )
Change subject: server: do not abort process on short conn message
......................................................................
server: do not abort process on short conn message
conn_read_cb() used OSMO_ASSERT() to check that the received
message holds at least a full osmo_pcap_data header. Although
conn_segmentation_cb2() should only ever hand up complete frames,
asserting on a length derived from network input means a framing
anomaly would abort the entire server (taking down all other clients'
captures). Close the offending connection gracefully instead,
consistent with the other error paths in this function.
Change-Id: Ia102ff918ef8152d212e10a860f5dc70efec880b
AI-Assisted: yes (Claude)
---
M src/osmo_server_network.c
1 file changed, 8 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index da14480..6c0e609 100644
--- a/src/osmo_server_network.c
+++ b/src/osmo_server_network.c
@@ -449,7 +449,14 @@
return 0;
}
- OSMO_ASSERT(msgb_length(msg) >= sizeof(*data));
+ if (OSMO_UNLIKELY(msgb_length(msg) < sizeof(*data))) {
+ /* Should not happen: conn_segmentation_cb2() only hands us complete
+ * frames. Close the conn gracefully instead of aborting the server. */
+ LOGP(DSERVER, LOGL_ERROR, "Read short message from conn: %u < %zu\n",
+ msgb_length(msg), sizeof(*data));
+ osmo_pcap_conn_close(conn);
+ return 0;
+ }
msg->l1h = msgb_data(msg);
data = (struct osmo_pcap_data *)msg->l1h;
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42841?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: Ia102ff918ef8152d212e10a860f5dc70efec880b
Gerrit-Change-Number: 42841
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42843?usp=email )
Change subject: server: fix zmq message leak on send failure
......................................................................
server: fix zmq message leak on send failure
zmq_msg_send() only transfers ownership of the message to ZeroMQ on
success. On failure the caller retains ownership, so the previously
init'd zmq_msg_t was leaked on every failed publish. Close it
explicitly on the error path.
Change-Id: I501b1bf55bede4e69fa5d9b3f38d87341482ff49
AI-Assisted: yes (Claude)
---
M src/osmo_server_core.c
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo_server_core.c b/src/osmo_server_core.c
index a13c64c..cc2c24e 100644
--- a/src/osmo_server_core.c
+++ b/src/osmo_server_core.c
@@ -59,9 +59,11 @@
memcpy(zmq_msg_data(&msg), data, len);
rc = zmq_msg_send(&msg, publ, flags);
if (rc == -1) {
- /* is the zmq_msg now owned? leak??? */
+ /* zmq_msg_send() only transfers ownership of the message on
+ * success; on failure we still own it and must close it. */
LOGP(DSERVER, LOGL_ERROR, "Failed to send data rc=%d errno=%d/%s\n",
rc, errno, strerror(errno));
+ zmq_msg_close(&msg);
return;
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42843?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: I501b1bf55bede4e69fa5d9b3f38d87341482ff49
Gerrit-Change-Number: 42843
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>