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

January 2025

  • 1 participants
  • 1491 discussions
[XS] Change in osmo-ci[master]: remove build2-deb{10,11}build related config
by neels 14 Jan '25

14 Jan '25
Attention is currently required from: laforge. neels has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/osmo-ci/+/39297?usp=email ) Change subject: remove build2-deb{10,11}build related config ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/39297?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I102e0cad667d8f2cf43c3535169cf3e32e04fca1 Gerrit-Change-Number: 39297 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Tue, 14 Jan 2025 12:47:27 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-pcap[master]: server: Rename osmo_pcap_server_close_trace -> osmo_pcap_conn_close_t...
by pespin 14 Jan '25

14 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39300?usp=email ) Change subject: server: Rename osmo_pcap_server_close_trace -> osmo_pcap_conn_close_trace ...................................................................... server: Rename osmo_pcap_server_close_trace -> osmo_pcap_conn_close_trace Change-Id: I261c6a54bd31b8f511cb103840323e7343bfdc61 --- M include/osmo-pcap/osmo_pcap_server.h M src/osmo_server_network.c M src/osmo_server_vty.c 3 files changed, 5 insertions(+), 5 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index f44781a..bdb0b81 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -168,5 +168,5 @@ const char *name); void osmo_pcap_conn_free(struct osmo_pcap_conn *conn); void vty_server_init(void); -void osmo_pcap_server_close_trace(struct osmo_pcap_conn *conn); +void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn); void osmo_pcap_server_close_conn(struct osmo_pcap_conn *conn); diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c index 3179c20..adad095 100644 --- a/src/osmo_server_network.c +++ b/src/osmo_server_network.c @@ -194,7 +194,7 @@ talloc_free(curr_filename_cpy_dname); } -void osmo_pcap_server_close_trace(struct osmo_pcap_conn *conn) +void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn) { if (conn->local_fd >= 0) { close(conn->local_fd); @@ -221,7 +221,7 @@ osmo_tls_release(&conn->tls_session); } - osmo_pcap_server_close_trace(conn); + osmo_pcap_conn_close_trace(conn); client_event(conn, "disconnect", NULL); } @@ -252,7 +252,7 @@ int rc; char *real_base_path; - osmo_pcap_server_close_trace(conn); + osmo_pcap_conn_close_trace(conn); /* omit any storing/creation of the file */ if (!conn->store) { diff --git a/src/osmo_server_vty.c b/src/osmo_server_vty.c index 9ba5f74..c019657 100644 --- a/src/osmo_server_vty.c +++ b/src/osmo_server_vty.c @@ -366,7 +366,7 @@ /* Checking store and maybe closing a pcap file */ if (!store) - osmo_pcap_server_close_trace(conn); + osmo_pcap_conn_close_trace(conn); conn->store = store; if (use_tls) { -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39300?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: I261c6a54bd31b8f511cb103840323e7343bfdc61 Gerrit-Change-Number: 39300 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-pcap[master]: Rename osmo_pcap_server_close_conn -> osmo_pcap_conn_close
by pespin 14 Jan '25

14 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39301?usp=email ) Change subject: Rename osmo_pcap_server_close_conn -> osmo_pcap_conn_close ...................................................................... Rename osmo_pcap_server_close_conn -> osmo_pcap_conn_close While at it, remove unnecessary helper function close_connection(). Change-Id: I116f0c4d61d391faa30760be3afdf189ff921d0c --- M include/osmo-pcap/osmo_pcap_server.h M src/osmo_server_network.c M src/osmo_server_vty.c 3 files changed, 9 insertions(+), 14 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index bdb0b81..d91ffb3 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -169,4 +169,4 @@ void osmo_pcap_conn_free(struct osmo_pcap_conn *conn); void vty_server_init(void); void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn); -void osmo_pcap_server_close_conn(struct osmo_pcap_conn *conn); +void osmo_pcap_conn_close(struct osmo_pcap_conn *conn); diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c index adad095..74f4321 100644 --- a/src/osmo_server_network.c +++ b/src/osmo_server_network.c @@ -212,7 +212,7 @@ } } -static void close_connection(struct osmo_pcap_conn *conn) +void osmo_pcap_conn_close(struct osmo_pcap_conn *conn) { if (conn->rem_wq.bfd.fd >= 0) { osmo_fd_unregister(&conn->rem_wq.bfd); @@ -225,11 +225,6 @@ client_event(conn, "disconnect", NULL); } -void osmo_pcap_server_close_conn(struct osmo_pcap_conn *conn) -{ - return close_connection(conn); -} - /* Update conn->last_write if needed. This field is used to keep the last time * period where we wrote to the pcap file. Once a new write period (based on * rotation VTY config) is detected, the pcap file we write to is rotated. */ @@ -668,7 +663,7 @@ void osmo_pcap_conn_free(struct osmo_pcap_conn *conn) { - close_connection(conn); + osmo_pcap_conn_close(conn); llist_del(&conn->entry); talloc_free(conn); } @@ -903,7 +898,7 @@ conn = fd->data; rc = dispatch_read(conn); if (rc <= 0) - close_connection(conn); + osmo_pcap_conn_close(conn); return 0; } @@ -911,7 +906,7 @@ { struct osmo_pcap_conn *conn; conn = container_of(session, struct osmo_pcap_conn, tls_session); - close_connection(conn); + osmo_pcap_conn_close(conn); } static int tls_read_cb(struct osmo_tls_session *session) @@ -946,7 +941,7 @@ static void new_connection(struct osmo_pcap_server *server, struct osmo_pcap_conn *client, int new_fd) { - close_connection(client); + osmo_pcap_conn_close(client); TALLOC_FREE(client->file_hdr); client->file_hdr_len = 0; @@ -968,11 +963,11 @@ LOGP(DSERVER, LOGL_NOTICE, "Require TLS but not enabled on conn=%s\n", client->name); - close_connection(client); + osmo_pcap_conn_close(client); return; } else if (client->tls_use) { if (!osmo_tls_init_server_session(client, server)) { - close_connection(client); + osmo_pcap_conn_close(client); return; } client->tls_session.error = tls_error_cb; diff --git a/src/osmo_server_vty.c b/src/osmo_server_vty.c index c019657..eab5cb4 100644 --- a/src/osmo_server_vty.c +++ b/src/osmo_server_vty.c @@ -372,7 +372,7 @@ if (use_tls) { /* force moving to TLS */ if (!conn->tls_use) - osmo_pcap_server_close_conn(conn); + osmo_pcap_conn_close(conn); conn->tls_use = true; } else { conn->tls_use = false; -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39301?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: I116f0c4d61d391faa30760be3afdf189ff921d0c Gerrit-Change-Number: 39301 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XL] Change in osmo-pcap[master]: server: Split network code into its own file
by pespin 14 Jan '25

14 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39302?usp=email ) Change subject: server: Split network code into its own file ...................................................................... server: Split network code into its own file Separate code related to network socket handling into its own separate file, as already done in osmo-pcap-client. This allows easily finding out which code is operating on the socket and which code is operating on the pcap file being locally stored. This will make modifying subsystems easier too. Change-Id: I41d6e0398605becbea109a7bb5aac8981d65ab1b --- M include/osmo-pcap/osmo_pcap_server.h M src/Makefile.am A src/osmo_server_core.c M src/osmo_server_network.c M tests/rotate_localtime/Makefile.am 5 files changed, 606 insertions(+), 545 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index d91ffb3..9a44fce 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -168,5 +168,9 @@ const char *name); void osmo_pcap_conn_free(struct osmo_pcap_conn *conn); void vty_server_init(void); -void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn); void osmo_pcap_conn_close(struct osmo_pcap_conn *conn); +int osmo_pcap_conn_process_data(struct osmo_pcap_conn *conn, const uint8_t *data, size_t len); +void osmo_pcap_conn_restart_trace(struct osmo_pcap_conn *conn); +void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn); +void osmo_pcap_conn_event(struct osmo_pcap_conn *conn, + const char *event, const char *data); diff --git a/src/Makefile.am b/src/Makefile.am index 0fb16a2..c3576d1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,9 +36,10 @@ osmo_server_main.c \ osmo_common.c \ osmo_pcap_file.c \ - osmo_server_vty.c \ + osmo_server_core.c \ osmo_server_network.c \ osmo_server_stats.c \ + osmo_server_vty.c \ osmo_tls.c \ $(NULL) diff --git a/src/osmo_server_core.c b/src/osmo_server_core.c new file mode 100644 index 0000000..819a255 --- /dev/null +++ b/src/osmo_server_core.c @@ -0,0 +1,592 @@ +/* + * osmo-pcap-server code + * + * (C) 2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * (C) 2011-2016 by Holger Hans Peter Freyther <holger(a)moiji-mobile.com> + * (C) 2011 by On-Waves + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmo-pcap/osmo_pcap_server.h> +#include <osmo-pcap/common.h> +#include <osmo-pcap/wireformat.h> + +#include <osmocom/core/socket.h> +#include <osmocom/core/talloc.h> +#include <osmocom/core/rate_ctr.h> + +#include <arpa/inet.h> +#include <sys/socket.h> +#include <sys/types.h> + +#include <zmq.h> + +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <unistd.h> +#include <limits.h> +#include <stdlib.h> +#include <inttypes.h> +#include <libgen.h> + +static void pcap_zmq_send(void *publ, const void *data, size_t len, int flags) +{ + int rc; + zmq_msg_t msg; + + rc = zmq_msg_init_size(&msg, len); + if (rc != 0) { + /* sigh.. we said SNDMORE but can't... */ + LOGP(DSERVER, LOGL_ERROR, "Failed to init rc=%d errno=%d/%s\n", + rc, errno, strerror(errno)); + return; + } + memcpy(zmq_msg_data(&msg), data, len); + rc = zmq_msg_send(&msg, publ, flags); + if (rc == -1) { + /* is the zmq_msg now owned? leak??? */ + LOGP(DSERVER, LOGL_ERROR, "Failed to send data rc=%d errno=%d/%s\n", + rc, errno, strerror(errno)); + return; + } +} + +void osmo_pcap_conn_event(struct osmo_pcap_conn *conn, + const char *event, const char *data) +{ + char *event_name; + + if (!conn->server->zmq_publ) + return; + + /* + * This multi-part support is insane... so if we lose the first + * or the last part of the multipart message stuff is going out + * of sync. *great* As we can't do anything about it right now + * just close the eyese and send it. + */ + event_name = talloc_asprintf(conn, "event.v1.%s.%s", + event, conn->name); + pcap_zmq_send(conn->server->zmq_publ, + event_name, strlen(event_name), + data ? ZMQ_SNDMORE : 0); + talloc_free(event_name); + if (data) + pcap_zmq_send(conn->server->zmq_publ, data, strlen(data), 0); +} + +static void zmq_send_client_data(struct osmo_pcap_conn *conn, + const uint8_t *data, size_t len) +{ + char *event_name; + + if (!conn->server->zmq_publ) + return; + + /* + * This multi-part support is insane... so if we lose the first + * or the last part of the multipart message stuff is going out + * of sync. *great* As we can't do anything about it right now + * just close the eyes and send it. + */ + event_name = talloc_asprintf(conn, "data.v1.%s", conn->name); + pcap_zmq_send(conn->server->zmq_publ, event_name, strlen(event_name), ZMQ_SNDMORE); + talloc_free(event_name); + + pcap_zmq_send(conn->server->zmq_publ, + conn->file_hdr, conn->file_hdr_len, + ZMQ_SNDMORE); + pcap_zmq_send(conn->server->zmq_publ, + data, len, + 0); +} + +static inline size_t calc_data_max_len(const struct osmo_pcap_server *server) +{ + size_t data_max_len; + + /* Some safe value regarding variable size options in a given pcapng block... */ + const size_t pcapng_max_len_opt = 4096; + const size_t pcapng_max_iface_len = 256; + + /* Maximum of the 2 types of .pcap blocks: */ + data_max_len = OSMO_MAX(sizeof(struct pcap_file_header), + sizeof(struct osmo_pcap_pkthdr) + server->max_snaplen); + + /* pcapng SHB: */ + const size_t pcapng_shb_max_len = sizeof(struct pcapng_block_header) + + sizeof(struct pcapng_section_header_block) + + pcapng_max_len_opt + + sizeof(uint32_t); + /* pcapng IDB: */ + const size_t pcapng_idb_max_len = sizeof(struct pcapng_block_header) + + sizeof(struct pcapng_iface_descr_block) + + pcapng_max_len_opt + + sizeof(uint32_t); + /* hdr_link for pcapng (SHB + N*IDB) */ + const size_t pcapg_hdr_link_max_len = pcapng_shb_max_len + // SHB + (pcapng_max_iface_len * pcapng_idb_max_len); // N * IDB + data_max_len = OSMO_MAX(data_max_len, pcapg_hdr_link_max_len); + + /* pcapng EPB: */ + const size_t pcapng_epb_max_len = sizeof(struct pcapng_block_header) + + sizeof(struct pcapng_enhanced_packet_block) + + pcapng_max_len_opt + + sizeof(uint32_t); + data_max_len = OSMO_MAX(data_max_len, pcapng_epb_max_len + server->max_snaplen); + return data_max_len; +} + +static struct osmo_pcap_conn *osmo_pcap_conn_alloc(struct osmo_pcap_server *server, + const char *name) +{ + struct osmo_pcap_conn *conn; + struct rate_ctr_group_desc *desc; + + conn = talloc_zero(server, struct osmo_pcap_conn); + if (!conn) { + LOGP(DSERVER, LOGL_ERROR, + "Failed to allocate the connection peer=%s.\n", name); + return NULL; + } + + conn->data_max_len = calc_data_max_len(server); + conn->data = talloc_zero_size(conn, sizeof(struct osmo_pcap_data) + conn->data_max_len); + /* a bit nasty. we do not work with ids but names */ + desc = talloc_zero(conn, struct rate_ctr_group_desc); + if (!desc) { + LOGP(DSERVER, LOGL_ERROR, + "Failed to allocate rate ctr desc peer=%s\n", name); + talloc_free(conn); + return NULL; + } + memcpy(desc, &pcap_peer_group_desc, sizeof(pcap_peer_group_desc)); + desc->group_name_prefix = talloc_asprintf(desc, "pcap:peer:%s", name); + if (!desc->group_name_prefix) { + LOGP(DSERVER, LOGL_ERROR, + "Failed to allocate group name prefix peer=%s\n", name); + talloc_free(conn); + return NULL; + } + desc->group_description = talloc_asprintf(desc, "PCAP peer statistics %s", name); + if (!desc->group_description) { + LOGP(DSERVER, LOGL_ERROR, + "Failed to allocate group description peer=%s\n", name); + talloc_free(conn); + return NULL; + } + + conn->ctrg = rate_ctr_group_alloc(desc, desc, 0); + if (!conn->ctrg) { + LOGP(DSERVER, LOGL_ERROR, + "Failed to allocate rate ctr peer=%s\n", name); + talloc_free(conn); + return NULL; + } + + + conn->name = talloc_strdup(conn, name); + /* we never write */ + osmo_wqueue_init(&conn->rem_wq, 0); + conn->rem_wq.bfd.fd = -1; + conn->local_fd = -1; + conn->server = server; + llist_add_tail(&conn->entry, &server->conn); + return conn; +} + +struct osmo_pcap_conn *osmo_pcap_server_find_or_create( + struct osmo_pcap_server *server, + const char *name) +{ + struct osmo_pcap_conn *conn; + + llist_for_each_entry(conn, &server->conn, entry) { + if (strcmp(conn->name, name) == 0) + return conn; + } + return osmo_pcap_conn_alloc(server, name); +} + +void osmo_pcap_conn_free(struct osmo_pcap_conn *conn) +{ + osmo_pcap_conn_close(conn); + llist_del(&conn->entry); + talloc_free(conn); +} + +/* Move pcap file from base_path to completed_path, and updates + * conn->curr_filename to point to new location. */ +void move_completed_trace_if_needed(struct osmo_pcap_conn *conn) +{ + struct osmo_pcap_server *server = conn->server; + char *curr_filename_cpy_bname = NULL; + char *curr_filename_cpy_dname = NULL; + char *bname = NULL; + char *curr_dirname = NULL; + char *new_dirname = NULL; + char *new_filename = NULL; + size_t new_filename_len; + int rc; + + if (!conn->curr_filename) + return; + + if (!server->completed_path) + return; + + /* Assumption: curr_filename is canonical absolute pathname. */ + + /* basename and dirname may modify input param, and return a string + * which shall not be freed, potentially pointing to the input param. */ + curr_filename_cpy_dname = talloc_strdup(conn, conn->curr_filename); + curr_filename_cpy_bname = talloc_strdup(conn, conn->curr_filename); + if (!curr_filename_cpy_dname || !curr_filename_cpy_bname) + goto ret_free1; + + curr_dirname = dirname(curr_filename_cpy_dname); + bname = basename(curr_filename_cpy_bname); + if (!curr_dirname || !bname) { + LOGP(DSERVER, LOGL_ERROR, "Failed to resolve dirname and basename for '%s'\n", + conn->curr_filename); + goto ret_free1; + } + + new_dirname = realpath(server->completed_path, NULL); + if (!new_dirname) { + LOGP(DSERVER, LOGL_ERROR, "Failed to resolve path '%s': %s\n", + server->completed_path, strerror(errno)); + goto ret_free1; + } + + new_filename_len = strlen(new_dirname) + 1 /* '/' */ + strlen(bname) + 1 /* '\0' */; + new_filename = talloc_size(conn, new_filename_len); + if (!new_filename) + goto ret_free1; + rc = snprintf(new_filename, new_filename_len, "%s/%s", new_dirname, bname); + if (rc != new_filename_len - 1) + goto ret_free2; + + LOGP(DSERVER, LOGL_INFO, "Moving completed pcap file '%s' -> '%s'\n", conn->curr_filename, new_filename); + rc = rename(conn->curr_filename, new_filename); + if (rc == -1) { + int err = errno; + LOGP(DSERVER, LOGL_ERROR, "Failed moving completed pcap file '%s' -> '%s': %s\n", + conn->curr_filename, new_filename, strerror(err)); + if (err == EXDEV) + LOGP(DSERVER, LOGL_ERROR, "Fix your config! %s and %s shall not be in different filesystems!\n", + curr_dirname, new_dirname); + goto ret_free2; + } + + /* Now replace conn->curr_filename with new path: */ + talloc_free(conn->curr_filename); + conn->curr_filename = new_filename; + /* new_filename has been assigned, so we don't want to free it, hence move to ret_free1: */ + goto ret_free1; + +ret_free2: + talloc_free(new_filename); +ret_free1: + free(new_dirname); + talloc_free(curr_filename_cpy_bname); + talloc_free(curr_filename_cpy_dname); +} + +void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn) +{ + if (conn->local_fd >= 0) { + close(conn->local_fd); + conn->local_fd = -1; + } + + move_completed_trace_if_needed(conn); + + if (conn->curr_filename) { + osmo_pcap_conn_event(conn, "closingtracefile", conn->curr_filename); + rate_ctr_inc2(conn->ctrg, PEER_CTR_PROTATE); + rate_ctr_inc2(conn->server->ctrg, SERVER_CTR_PROTATE); + talloc_free(conn->curr_filename); + conn->curr_filename = NULL; + } +} + +void osmo_pcap_conn_close(struct osmo_pcap_conn *conn) +{ + if (conn->rem_wq.bfd.fd >= 0) { + osmo_fd_unregister(&conn->rem_wq.bfd); + close(conn->rem_wq.bfd.fd); + conn->rem_wq.bfd.fd = -1; + osmo_tls_release(&conn->tls_session); + } + + osmo_pcap_conn_close_trace(conn); + osmo_pcap_conn_event(conn, "disconnect", NULL); +} + +/* Update conn->last_write if needed. This field is used to keep the last time + * period where we wrote to the pcap file. Once a new write period (based on + * rotation VTY config) is detected, the pcap file we write to is rotated. */ +static void update_last_write(struct osmo_pcap_conn *conn, time_t now) +{ + time_t last = mktime(&conn->last_write); + + /* Skip time udpates if wall clock went backwards (ie. due to drift + * correction or DST). As a result, time rotation checks will skip + * opening a new pcap file with an older timestamp, and instead keep + * using the current one. */ + if (now > last) + localtime_r(&now, &conn->last_write); +} + +void osmo_pcap_conn_restart_trace(struct osmo_pcap_conn *conn) +{ + time_t now = time(NULL); + struct tm tm; + int rc; + char *real_base_path; + + osmo_pcap_conn_close_trace(conn); + + /* omit any storing/creation of the file */ + if (!conn->store) { + update_last_write(conn, now); + talloc_free(conn->curr_filename); + conn->curr_filename = NULL; + return; + } + + localtime_r(&now, &tm); + real_base_path = realpath(conn->server->base_path, NULL); + if (!real_base_path) { + LOGP(DSERVER, LOGL_ERROR, "Failed to resolve real path '%s': %s\n", + conn->server->base_path, strerror(errno)); + return; + } + conn->curr_filename = talloc_asprintf(conn, "%s/trace-%s-%d%.2d%.2d_%.2d%.2d%.2d.%s", + real_base_path, conn->name, + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, + conn->file_fmt == OSMO_PCAP_FMT_PCAP ? "pcap" : "pcapng"); + free(real_base_path); + if (!conn->curr_filename) { + LOGP(DSERVER, LOGL_ERROR, "Failed to assemble filename for %s.\n", conn->name); + return; + } + + conn->local_fd = creat(conn->curr_filename, conn->server->permission_mask); + if (conn->local_fd < 0) { + LOGP(DSERVER, LOGL_ERROR, "Failed to create file '%s': %s\n", + conn->curr_filename, strerror(errno)); + return; + } + + rc = write(conn->local_fd, conn->file_hdr, conn->file_hdr_len); + if (rc != conn->file_hdr_len) { + LOGP(DSERVER, LOGL_ERROR, "Failed to write the header: %d\n", errno); + close(conn->local_fd); + conn->local_fd = -1; + return; + } + + update_last_write(conn, now); +} + +void osmo_pcap_server_reopen(struct osmo_pcap_server *server) +{ + struct osmo_pcap_conn *conn; + LOGP(DSERVER, LOGL_INFO, "Reopening all logfiles.\n"); + llist_for_each_entry(conn, &server->conn, entry) { + /* Write the complete packet out first */ + if (conn->state == STATE_INITIAL) { + osmo_pcap_conn_restart_trace(conn); + } else { + LOGP(DSERVER, LOGL_INFO, "Delaying %s until current packet is complete.\n", conn->name); + conn->reopen_delayed = true; + } + } +} + +/* Returns true if pcap was re-opened */ +static bool check_restart_pcap_max_size(struct osmo_pcap_conn *conn, size_t data_len) +{ + off_t cur; + + if (!pcap_server->max_size_enabled) + return false; + cur = lseek(conn->local_fd, 0, SEEK_CUR); + if (cur + data_len <= conn->server->max_size) + return false; + LOGP(DSERVER, LOGL_NOTICE, "Rolling over file for %s (max-size)\n", conn->name); + osmo_pcap_conn_restart_trace(conn); + return true; +} + +/* Checks if we are in a new record period since last time we wrote to a pcap, to know (return true) + * whether a new pcap file needs to be opened. It calculates period based on intv and mod. + * NOTE: Kept non-static to be able to validate it with unit tests. */ +bool check_localtime(const struct tm *last_write, const struct tm *tm, enum time_interval intv, unsigned int mod) +{ + unsigned long long last_start, current_start; + + switch (intv) { + case TIME_INTERVAL_SEC: + if (last_write->tm_sec == tm->tm_sec && + last_write->tm_min == tm->tm_min && + last_write->tm_hour == tm->tm_hour && + last_write->tm_mday == tm->tm_mday && + last_write->tm_mon == tm->tm_mon && + last_write->tm_year == tm->tm_year) + return false; + /* If minute/hour/day/month/year changed (passed through second 0), always rotate: */ + if (last_write->tm_min < tm->tm_min || + last_write->tm_hour < tm->tm_hour || + last_write->tm_mday < tm->tm_mday || + last_write->tm_mon < tm->tm_mon || + last_write->tm_year < tm->tm_year) + return true; + /* Same minute/hour/day/month/year, second changed. Check if we are still in same period: */ + last_start = last_write->tm_sec - (last_write->tm_sec % mod); + current_start = tm->tm_sec - (tm->tm_sec % mod); + if (current_start <= last_start) + return false; + return true; + case TIME_INTERVAL_MIN: + if (last_write->tm_min == tm->tm_min && + last_write->tm_hour == tm->tm_hour && + last_write->tm_mday == tm->tm_mday && + last_write->tm_mon == tm->tm_mon && + last_write->tm_year == tm->tm_year) + return false; + /* If hour/day/month/year changed (passed through minute 0), always rotate: */ + if (last_write->tm_hour < tm->tm_hour || + last_write->tm_mday < tm->tm_mday || + last_write->tm_mon < tm->tm_mon || + last_write->tm_year < tm->tm_year) + return true; + /* Same hour/day/month/year, minute changed. Check if we are still in same period: */ + last_start = last_write->tm_min - (last_write->tm_min % mod); + current_start = tm->tm_min - (tm->tm_min % mod); + if (current_start <= last_start) + return false; + return true; + case TIME_INTERVAL_HOUR: + if (last_write->tm_hour == tm->tm_hour && + last_write->tm_mday == tm->tm_mday && + last_write->tm_mon == tm->tm_mon && + last_write->tm_year == tm->tm_year) + return false; + /* If day/month/year changed (passed through hour 0), always rotate: */ + if (last_write->tm_mday < tm->tm_mday || + last_write->tm_mon < tm->tm_mon || + last_write->tm_year < tm->tm_year) + return true; + /* Same day/month/year, hour changed. Check if we are still in same period: */ + last_start = last_write->tm_hour - (last_write->tm_hour % mod); + current_start = tm->tm_hour - (tm->tm_hour % mod); + if (current_start <= last_start) + return false; + return true; + case TIME_INTERVAL_DAY: + if (last_write->tm_mday == tm->tm_mday && + last_write->tm_mon == tm->tm_mon && + last_write->tm_year == tm->tm_year) + return false; + /* If month/year changed (passed through day 1), always rotate: */ + if (last_write->tm_mon < tm->tm_mon || + last_write->tm_year < tm->tm_year) + return true; + /* Same month/year, day changed. Check if we are still in same period: */ + /* Note: tm_mday is [1, 31], hence the -1 below: */ + last_start = (last_write->tm_mday - 1) - ((last_write->tm_mday - 1) % mod); + current_start = (tm->tm_mday - 1) - ((tm->tm_mday - 1) % mod); + if (current_start <= last_start) + return false; + return true; + case TIME_INTERVAL_MONTH: + if (last_write->tm_mon == tm->tm_mon && + last_write->tm_year == tm->tm_year) + return false; + /* If year changed (passed through month 1), always rotate: */ + if (last_write->tm_year < tm->tm_year) + return true; + /* Same year, month changed. Check if we are still in same period: */ + last_start = last_write->tm_mon - (last_write->tm_mon % mod); + current_start = tm->tm_mon - (tm->tm_mon % mod); + if (current_start <= last_start) + return false; + return true; + case TIME_INTERVAL_YEAR: + /* Year changed. Check if we are still in same period: */ + last_start = last_write->tm_year - (last_write->tm_year % mod); + current_start = tm->tm_year - (tm->tm_year % mod); + if (current_start <= last_start) + return false; + return true; + default: + OSMO_ASSERT(false); + } +} + +static bool check_restart_pcap_localtime(struct osmo_pcap_conn *conn, time_t now) +{ + struct tm tm; + if (!pcap_server->rotate_localtime.enabled) + return false; + + localtime_r(&now, &tm); + if (!check_localtime(&conn->last_write, &tm, + pcap_server->rotate_localtime.intv, + pcap_server->rotate_localtime.modulus)) + return false; + LOGP(DSERVER, LOGL_NOTICE, "Rolling over file for %s (localtime)\n", conn->name); + osmo_pcap_conn_restart_trace(conn); + return true; +} + +/* New recorded packet is received. + * Returns 0 on success, negative on error. */ +int osmo_pcap_conn_process_data(struct osmo_pcap_conn *conn, const uint8_t *data, size_t len) +{ + time_t now = time(NULL); + int rc; + + zmq_send_client_data(conn, data, len); + + if (!conn->store) { + update_last_write(conn, now); + return 0; + } + + if (conn->local_fd < -1) { + LOGP(DSERVER, LOGL_ERROR, "No file is open. close connection.\n"); + return -1; + } + + /* Check if we are past the limit or on a day change. */ + if (!check_restart_pcap_max_size(conn, len)) + check_restart_pcap_localtime(conn, now); + + update_last_write(conn, now); + rc = write(conn->local_fd, data, len); + if (rc != len) { + LOGP(DSERVER, LOGL_ERROR, "Failed to write for %s\n", conn->name); + return -1; + } + return 0; +} diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c index 74f4321..c1cc47e 100644 --- a/src/osmo_server_network.c +++ b/src/osmo_server_network.c @@ -44,255 +44,6 @@ #include <inttypes.h> #include <libgen.h> -static void pcap_zmq_send(void *publ, const void *data, size_t len, int flags) -{ - int rc; - zmq_msg_t msg; - - rc = zmq_msg_init_size(&msg, len); - if (rc != 0) { - /* sigh.. we said SNDMORE but can't... */ - LOGP(DSERVER, LOGL_ERROR, "Failed to init rc=%d errno=%d/%s\n", - rc, errno, strerror(errno)); - return; - } - memcpy(zmq_msg_data(&msg), data, len); - rc = zmq_msg_send(&msg, publ, flags); - if (rc == -1) { - /* is the zmq_msg now owned? leak??? */ - LOGP(DSERVER, LOGL_ERROR, "Failed to send data rc=%d errno=%d/%s\n", - rc, errno, strerror(errno)); - return; - } -} - -static void client_event(struct osmo_pcap_conn *conn, - const char *event, const char *data) -{ - char *event_name; - - if (!conn->server->zmq_publ) - return; - - /* - * This multi-part support is insane... so if we lose the first - * or the last part of the multipart message stuff is going out - * of sync. *great* As we can't do anything about it right now - * just close the eyese and send it. - */ - event_name = talloc_asprintf(conn, "event.v1.%s.%s", - event, conn->name); - pcap_zmq_send(conn->server->zmq_publ, - event_name, strlen(event_name), - data ? ZMQ_SNDMORE : 0); - talloc_free(event_name); - if (data) - pcap_zmq_send(conn->server->zmq_publ, data, strlen(data), 0); -} - -static void zmq_send_client_data(struct osmo_pcap_conn *conn, - struct osmo_pcap_data *data) -{ - char *event_name; - - if (!conn->server->zmq_publ) - return; - - /* - * This multi-part support is insane... so if we lose the first - * or the last part of the multipart message stuff is going out - * of sync. *great* As we can't do anything about it right now - * just close the eyes and send it. - */ - event_name = talloc_asprintf(conn, "data.v1.%s", conn->name); - pcap_zmq_send(conn->server->zmq_publ, event_name, strlen(event_name), ZMQ_SNDMORE); - talloc_free(event_name); - - pcap_zmq_send(conn->server->zmq_publ, - conn->file_hdr, conn->file_hdr_len, - ZMQ_SNDMORE); - pcap_zmq_send(conn->server->zmq_publ, - &data->data[0], data->len, - 0); -} - -/* Move pcap file from base_path to completed_path, and updates - * conn->curr_filename to point to new location. */ -void move_completed_trace_if_needed(struct osmo_pcap_conn *conn) -{ - struct osmo_pcap_server *server = conn->server; - char *curr_filename_cpy_bname = NULL; - char *curr_filename_cpy_dname = NULL; - char *bname = NULL; - char *curr_dirname = NULL; - char *new_dirname = NULL; - char *new_filename = NULL; - size_t new_filename_len; - int rc; - - if (!conn->curr_filename) - return; - - if (!server->completed_path) - return; - - /* Assumption: curr_filename is canonical absolute pathname. */ - - /* basename and dirname may modify input param, and return a string - * which shall not be freed, potentially pointing to the input param. */ - curr_filename_cpy_dname = talloc_strdup(conn, conn->curr_filename); - curr_filename_cpy_bname = talloc_strdup(conn, conn->curr_filename); - if (!curr_filename_cpy_dname || !curr_filename_cpy_bname) - goto ret_free1; - - curr_dirname = dirname(curr_filename_cpy_dname); - bname = basename(curr_filename_cpy_bname); - if (!curr_dirname || !bname) { - LOGP(DSERVER, LOGL_ERROR, "Failed to resolve dirname and basename for '%s'\n", - conn->curr_filename); - goto ret_free1; - } - - new_dirname = realpath(server->completed_path, NULL); - if (!new_dirname) { - LOGP(DSERVER, LOGL_ERROR, "Failed to resolve path '%s': %s\n", - server->completed_path, strerror(errno)); - goto ret_free1; - } - - new_filename_len = strlen(new_dirname) + 1 /* '/' */ + strlen(bname) + 1 /* '\0' */; - new_filename = talloc_size(conn, new_filename_len); - if (!new_filename) - goto ret_free1; - rc = snprintf(new_filename, new_filename_len, "%s/%s", new_dirname, bname); - if (rc != new_filename_len - 1) - goto ret_free2; - - LOGP(DSERVER, LOGL_INFO, "Moving completed pcap file '%s' -> '%s'\n", conn->curr_filename, new_filename); - rc = rename(conn->curr_filename, new_filename); - if (rc == -1) { - int err = errno; - LOGP(DSERVER, LOGL_ERROR, "Failed moving completed pcap file '%s' -> '%s': %s\n", - conn->curr_filename, new_filename, strerror(err)); - if (err == EXDEV) - LOGP(DSERVER, LOGL_ERROR, "Fix your config! %s and %s shall not be in different filesystems!\n", - curr_dirname, new_dirname); - goto ret_free2; - } - - /* Now replace conn->curr_filename with new path: */ - talloc_free(conn->curr_filename); - conn->curr_filename = new_filename; - /* new_filename has been assigned, so we don't want to free it, hence move to ret_free1: */ - goto ret_free1; - -ret_free2: - talloc_free(new_filename); -ret_free1: - free(new_dirname); - talloc_free(curr_filename_cpy_bname); - talloc_free(curr_filename_cpy_dname); -} - -void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn) -{ - if (conn->local_fd >= 0) { - close(conn->local_fd); - conn->local_fd = -1; - } - - move_completed_trace_if_needed(conn); - - if (conn->curr_filename) { - client_event(conn, "closingtracefile", conn->curr_filename); - rate_ctr_inc2(conn->ctrg, PEER_CTR_PROTATE); - rate_ctr_inc2(conn->server->ctrg, SERVER_CTR_PROTATE); - talloc_free(conn->curr_filename); - conn->curr_filename = NULL; - } -} - -void osmo_pcap_conn_close(struct osmo_pcap_conn *conn) -{ - if (conn->rem_wq.bfd.fd >= 0) { - osmo_fd_unregister(&conn->rem_wq.bfd); - close(conn->rem_wq.bfd.fd); - conn->rem_wq.bfd.fd = -1; - osmo_tls_release(&conn->tls_session); - } - - osmo_pcap_conn_close_trace(conn); - client_event(conn, "disconnect", NULL); -} - -/* Update conn->last_write if needed. This field is used to keep the last time - * period where we wrote to the pcap file. Once a new write period (based on - * rotation VTY config) is detected, the pcap file we write to is rotated. */ -static void update_last_write(struct osmo_pcap_conn *conn, time_t now) -{ - time_t last = mktime(&conn->last_write); - - /* Skip time udpates if wall clock went backwards (ie. due to drift - * correction or DST). As a result, time rotation checks will skip - * opening a new pcap file with an older timestamp, and instead keep - * using the current one. */ - if (now > last) - localtime_r(&now, &conn->last_write); -} - -static void restart_pcap(struct osmo_pcap_conn *conn) -{ - time_t now = time(NULL); - struct tm tm; - int rc; - char *real_base_path; - - osmo_pcap_conn_close_trace(conn); - - /* omit any storing/creation of the file */ - if (!conn->store) { - update_last_write(conn, now); - talloc_free(conn->curr_filename); - conn->curr_filename = NULL; - return; - } - - localtime_r(&now, &tm); - real_base_path = realpath(conn->server->base_path, NULL); - if (!real_base_path) { - LOGP(DSERVER, LOGL_ERROR, "Failed to resolve real path '%s': %s\n", - conn->server->base_path, strerror(errno)); - return; - } - conn->curr_filename = talloc_asprintf(conn, "%s/trace-%s-%d%.2d%.2d_%.2d%.2d%.2d.%s", - real_base_path, conn->name, - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec, - conn->file_fmt == OSMO_PCAP_FMT_PCAP ? "pcap" : "pcapng"); - free(real_base_path); - if (!conn->curr_filename) { - LOGP(DSERVER, LOGL_ERROR, "Failed to assemble filename for %s.\n", conn->name); - return; - } - - conn->local_fd = creat(conn->curr_filename, conn->server->permission_mask); - if (conn->local_fd < 0) { - LOGP(DSERVER, LOGL_ERROR, "Failed to create file '%s': %s\n", - conn->curr_filename, strerror(errno)); - return; - } - - rc = write(conn->local_fd, conn->file_hdr, conn->file_hdr_len); - if (rc != conn->file_hdr_len) { - LOGP(DSERVER, LOGL_ERROR, "Failed to write the header: %d\n", errno); - close(conn->local_fd); - conn->local_fd = -1; - return; - } - - update_last_write(conn, now); -} - static int validate_link_hdr_pcap(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) { struct pcap_file_header *hdr; @@ -395,7 +146,7 @@ conn->file_hdr = talloc_size(conn, data->len); memcpy(conn->file_hdr, data->data, data->len); conn->file_hdr_len = data->len; - restart_pcap(conn); + osmo_pcap_conn_restart_trace(conn); } else if (conn->file_hdr_len != data->len || memcmp(&conn->file_hdr, data->data, data->len) != 0) { /* Client changed the link hdr in conn */ @@ -403,149 +154,12 @@ conn->file_hdr = talloc_size(conn, data->len); memcpy(conn->file_hdr, data->data, data->len); conn->file_hdr_len = data->len; - restart_pcap(conn); + osmo_pcap_conn_restart_trace(conn); } return 1; } -/* Returns true if pcap was re-opened */ -static bool check_restart_pcap_max_size(struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) -{ - off_t cur; - - if (!pcap_server->max_size_enabled) - return false; - cur = lseek(conn->local_fd, 0, SEEK_CUR); - if (cur + data->len <= conn->server->max_size) - return false; - LOGP(DSERVER, LOGL_NOTICE, "Rolling over file for %s (max-size)\n", conn->name); - restart_pcap(conn); - return true; -} - -/* Checks if we are in a new record period since last time we wrote to a pcap, to know (return true) - * whether a new pcap file needs to be opened. It calculates period based on intv and mod. - * NOTE: Kept non-static to be able to validate it with unit tests. */ -bool check_localtime(const struct tm *last_write, const struct tm *tm, enum time_interval intv, unsigned int mod) -{ - unsigned long long last_start, current_start; - - switch (intv) { - case TIME_INTERVAL_SEC: - if (last_write->tm_sec == tm->tm_sec && - last_write->tm_min == tm->tm_min && - last_write->tm_hour == tm->tm_hour && - last_write->tm_mday == tm->tm_mday && - last_write->tm_mon == tm->tm_mon && - last_write->tm_year == tm->tm_year) - return false; - /* If minute/hour/day/month/year changed (passed through second 0), always rotate: */ - if (last_write->tm_min < tm->tm_min || - last_write->tm_hour < tm->tm_hour || - last_write->tm_mday < tm->tm_mday || - last_write->tm_mon < tm->tm_mon || - last_write->tm_year < tm->tm_year) - return true; - /* Same minute/hour/day/month/year, second changed. Check if we are still in same period: */ - last_start = last_write->tm_sec - (last_write->tm_sec % mod); - current_start = tm->tm_sec - (tm->tm_sec % mod); - if (current_start <= last_start) - return false; - return true; - case TIME_INTERVAL_MIN: - if (last_write->tm_min == tm->tm_min && - last_write->tm_hour == tm->tm_hour && - last_write->tm_mday == tm->tm_mday && - last_write->tm_mon == tm->tm_mon && - last_write->tm_year == tm->tm_year) - return false; - /* If hour/day/month/year changed (passed through minute 0), always rotate: */ - if (last_write->tm_hour < tm->tm_hour || - last_write->tm_mday < tm->tm_mday || - last_write->tm_mon < tm->tm_mon || - last_write->tm_year < tm->tm_year) - return true; - /* Same hour/day/month/year, minute changed. Check if we are still in same period: */ - last_start = last_write->tm_min - (last_write->tm_min % mod); - current_start = tm->tm_min - (tm->tm_min % mod); - if (current_start <= last_start) - return false; - return true; - case TIME_INTERVAL_HOUR: - if (last_write->tm_hour == tm->tm_hour && - last_write->tm_mday == tm->tm_mday && - last_write->tm_mon == tm->tm_mon && - last_write->tm_year == tm->tm_year) - return false; - /* If day/month/year changed (passed through hour 0), always rotate: */ - if (last_write->tm_mday < tm->tm_mday || - last_write->tm_mon < tm->tm_mon || - last_write->tm_year < tm->tm_year) - return true; - /* Same day/month/year, hour changed. Check if we are still in same period: */ - last_start = last_write->tm_hour - (last_write->tm_hour % mod); - current_start = tm->tm_hour - (tm->tm_hour % mod); - if (current_start <= last_start) - return false; - return true; - case TIME_INTERVAL_DAY: - if (last_write->tm_mday == tm->tm_mday && - last_write->tm_mon == tm->tm_mon && - last_write->tm_year == tm->tm_year) - return false; - /* If month/year changed (passed through day 1), always rotate: */ - if (last_write->tm_mon < tm->tm_mon || - last_write->tm_year < tm->tm_year) - return true; - /* Same month/year, day changed. Check if we are still in same period: */ - /* Note: tm_mday is [1, 31], hence the -1 below: */ - last_start = (last_write->tm_mday - 1) - ((last_write->tm_mday - 1) % mod); - current_start = (tm->tm_mday - 1) - ((tm->tm_mday - 1) % mod); - if (current_start <= last_start) - return false; - return true; - case TIME_INTERVAL_MONTH: - if (last_write->tm_mon == tm->tm_mon && - last_write->tm_year == tm->tm_year) - return false; - /* If year changed (passed through month 1), always rotate: */ - if (last_write->tm_year < tm->tm_year) - return true; - /* Same year, month changed. Check if we are still in same period: */ - last_start = last_write->tm_mon - (last_write->tm_mon % mod); - current_start = tm->tm_mon - (tm->tm_mon % mod); - if (current_start <= last_start) - return false; - return true; - case TIME_INTERVAL_YEAR: - /* Year changed. Check if we are still in same period: */ - last_start = last_write->tm_year - (last_write->tm_year % mod); - current_start = tm->tm_year - (tm->tm_year % mod); - if (current_start <= last_start) - return false; - return true; - default: - OSMO_ASSERT(false); - } -} - -static bool check_restart_pcap_localtime(struct osmo_pcap_conn *conn, time_t now) -{ - struct tm tm; - if (!pcap_server->rotate_localtime.enabled) - return false; - - localtime_r(&now, &tm); - if (!check_localtime(&conn->last_write, &tm, - pcap_server->rotate_localtime.intv, - pcap_server->rotate_localtime.modulus)) - return false; - LOGP(DSERVER, LOGL_NOTICE, "Rolling over file for %s (localtime)\n", conn->name); - restart_pcap(conn); - return true; -} - static int validate_link_data_pcap(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) { unsigned int min_len, max_len; @@ -629,152 +243,16 @@ /* returns >0 on success, <= 0 on failure (closes conn) */ static int rx_link_data(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) { - time_t now = time(NULL); int rc; if ((rc = validate_link_data(conn, data)) < 0) return rc; - zmq_send_client_data(conn, data); - - if (!conn->store) { - update_last_write(conn, now); - return 1; - } - - if (conn->local_fd < -1) { - LOGP(DSERVER, LOGL_ERROR, "No file is open. close connection.\n"); - return -1; - } - - /* Check if we are past the limit or on a day change. */ - if (!check_restart_pcap_max_size(conn, data)) - check_restart_pcap_localtime(conn, now); - - update_last_write(conn, now); - rc = write(conn->local_fd, &data->data[0], data->len); - if (rc != data->len) { - LOGP(DSERVER, LOGL_ERROR, "Failed to write for %s\n", conn->name); - return -1; - } + if ((rc = osmo_pcap_conn_process_data(conn, &data->data[0], data->len))) + return rc; return 1; } - -void osmo_pcap_conn_free(struct osmo_pcap_conn *conn) -{ - osmo_pcap_conn_close(conn); - llist_del(&conn->entry); - talloc_free(conn); -} - -static inline size_t calc_data_max_len(const struct osmo_pcap_server *server) -{ - size_t data_max_len; - - /* Some safe value regarding variable size options in a given pcapng block... */ - const size_t pcapng_max_len_opt = 4096; - const size_t pcapng_max_iface_len = 256; - - /* Maximum of the 2 types of .pcap blocks: */ - data_max_len = OSMO_MAX(sizeof(struct pcap_file_header), - sizeof(struct osmo_pcap_pkthdr) + server->max_snaplen); - - /* pcapng SHB: */ - const size_t pcapng_shb_max_len = sizeof(struct pcapng_block_header) + - sizeof(struct pcapng_section_header_block) + - pcapng_max_len_opt + - sizeof(uint32_t); - /* pcapng IDB: */ - const size_t pcapng_idb_max_len = sizeof(struct pcapng_block_header) + - sizeof(struct pcapng_iface_descr_block) + - pcapng_max_len_opt + - sizeof(uint32_t); - /* hdr_link for pcapng (SHB + N*IDB) */ - const size_t pcapg_hdr_link_max_len = pcapng_shb_max_len + // SHB - (pcapng_max_iface_len * pcapng_idb_max_len); // N * IDB - data_max_len = OSMO_MAX(data_max_len, pcapg_hdr_link_max_len); - - /* pcapng EPB: */ - const size_t pcapng_epb_max_len = sizeof(struct pcapng_block_header) + - sizeof(struct pcapng_enhanced_packet_block) + - pcapng_max_len_opt + - sizeof(uint32_t); - data_max_len = OSMO_MAX(data_max_len, pcapng_epb_max_len + server->max_snaplen); - return data_max_len; -} - -static struct osmo_pcap_conn *osmo_pcap_conn_alloc(struct osmo_pcap_server *server, - const char *name) -{ - struct osmo_pcap_conn *conn; - struct rate_ctr_group_desc *desc; - - conn = talloc_zero(server, struct osmo_pcap_conn); - if (!conn) { - LOGP(DSERVER, LOGL_ERROR, - "Failed to allocate the connection peer=%s.\n", name); - return NULL; - } - - conn->data_max_len = calc_data_max_len(server); - conn->data = talloc_zero_size(conn, sizeof(struct osmo_pcap_data) + conn->data_max_len); - /* a bit nasty. we do not work with ids but names */ - desc = talloc_zero(conn, struct rate_ctr_group_desc); - if (!desc) { - LOGP(DSERVER, LOGL_ERROR, - "Failed to allocate rate ctr desc peer=%s\n", name); - talloc_free(conn); - return NULL; - } - memcpy(desc, &pcap_peer_group_desc, sizeof(pcap_peer_group_desc)); - desc->group_name_prefix = talloc_asprintf(desc, "pcap:peer:%s", name); - if (!desc->group_name_prefix) { - LOGP(DSERVER, LOGL_ERROR, - "Failed to allocate group name prefix peer=%s\n", name); - talloc_free(conn); - return NULL; - } - desc->group_description = talloc_asprintf(desc, "PCAP peer statistics %s", name); - if (!desc->group_description) { - LOGP(DSERVER, LOGL_ERROR, - "Failed to allocate group description peer=%s\n", name); - talloc_free(conn); - return NULL; - } - - conn->ctrg = rate_ctr_group_alloc(desc, desc, 0); - if (!conn->ctrg) { - LOGP(DSERVER, LOGL_ERROR, - "Failed to allocate rate ctr peer=%s\n", name); - talloc_free(conn); - return NULL; - } - - - conn->name = talloc_strdup(conn, name); - /* we never write */ - osmo_wqueue_init(&conn->rem_wq, 0); - conn->rem_wq.bfd.fd = -1; - conn->local_fd = -1; - conn->server = server; - llist_add_tail(&conn->entry, &server->conn); - return conn; -} - -struct osmo_pcap_conn *osmo_pcap_server_find_or_create( - struct osmo_pcap_server *server, - const char *name) -{ - struct osmo_pcap_conn *conn; - - llist_for_each_entry(conn, &server->conn, entry) { - if (strcmp(conn->name, name) == 0) - return conn; - } - return osmo_pcap_conn_alloc(server, name); -} - static int do_read_tls(struct osmo_pcap_conn *conn, void *buf, size_t want_size) { size_t size = want_size; @@ -871,7 +349,7 @@ if (conn->reopen_delayed) { LOGP(DSERVER, LOGL_INFO, "Reopening log for %s now.\n", conn->name); - restart_pcap(conn); + osmo_pcap_conn_restart_trace(conn); conn->reopen_delayed = false; } @@ -1005,7 +483,7 @@ if (conn->remote_addr.s_addr == addr.sin_addr.s_addr) { LOGP(DSERVER, LOGL_NOTICE, "New connection from %s\n", conn->name); - client_event(conn, "connect", NULL); + osmo_pcap_conn_event(conn, "connect", NULL); new_connection(server, conn, new_fd); return 0; } @@ -1048,18 +526,3 @@ return 0; } - -void osmo_pcap_server_reopen(struct osmo_pcap_server *server) -{ - struct osmo_pcap_conn *conn; - LOGP(DSERVER, LOGL_INFO, "Reopening all logfiles.\n"); - llist_for_each_entry(conn, &server->conn, entry) { - /* Write the complete packet out first */ - if (conn->state == STATE_INITIAL) { - restart_pcap(conn); - } else { - LOGP(DSERVER, LOGL_INFO, "Delaying %s until current packet is complete.\n", conn->name); - conn->reopen_delayed = true; - } - } -} diff --git a/tests/rotate_localtime/Makefile.am b/tests/rotate_localtime/Makefile.am index 265e4fe..f6ced6e 100644 --- a/tests/rotate_localtime/Makefile.am +++ b/tests/rotate_localtime/Makefile.am @@ -29,6 +29,7 @@ rotate_localtime_test_LDADD = \ $(top_builddir)/src/osmo_pcap_file.o \ + $(top_builddir)/src/osmo_server_core.o \ $(top_builddir)/src/osmo_server_network.o \ $(top_builddir)/src/osmo_server_stats.o \ $(top_builddir)/src/osmo_tls.o \ -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39302?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: I41d6e0398605becbea109a7bb5aac8981d65ab1b Gerrit-Change-Number: 39302 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-pcap[master]: cosmetic: osmo_tls: Fix indentation whitespace
by pespin 14 Jan '25

14 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39304?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: cosmetic: osmo_tls: Fix indentation whitespace ...................................................................... cosmetic: osmo_tls: Fix indentation whitespace Change-Id: I27e6d6ce64178384acbd0b8ee88d6f7ef6b2a61b --- M src/osmo_tls.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/osmo_tls.c b/src/osmo_tls.c index f1f08ca..8524ee3 100644 --- a/src/osmo_tls.c +++ b/src/osmo_tls.c @@ -170,7 +170,7 @@ int rc; rc = gnutls_global_init(); CHECK_RC(rc, "init failed"); - gnutls_global_set_log_function(tls_log_func); + gnutls_global_set_log_function(tls_log_func); } void osmo_tls_server_init(struct osmo_pcap_server *server) @@ -483,7 +483,7 @@ sess->anon_alloc = true; /* x509 certificate handling */ - rc = gnutls_certificate_allocate_credentials(&sess->cert_cred); + rc = gnutls_certificate_allocate_credentials(&sess->cert_cred); if (rc != GNUTLS_E_SUCCESS) { LOGP(DTLS, LOGL_ERROR, "Failed to allocate x509 cred rc=%d\n", rc); osmo_tls_release(sess); -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39304?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: I27e6d6ce64178384acbd0b8ee88d6f7ef6b2a61b Gerrit-Change-Number: 39304 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-pcap[master]: server: Avoid lseek syscall on every packet write to pcap file
by pespin 14 Jan '25

14 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39303?usp=email ) Change subject: server: Avoid lseek syscall on every packet write to pcap file ...................................................................... server: Avoid lseek syscall on every packet write to pcap file Instead of requesting the current size to the OS, keep track of the amount of bytes stored in conn->wr_offset, and check agains that value when we want to write new data to the file. This should remove quite a lot of oeverhead when lots of traffic is being handled. Change-Id: I437eaca982d65d0f06e7d24863875f85267f0e44 --- M include/osmo-pcap/osmo_pcap_server.h M src/osmo_server_core.c 2 files changed, 22 insertions(+), 16 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index 9a44fce..5d21c64 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -87,6 +87,8 @@ int local_fd; /* canonicalized absolute pathname of pcap file we write to */ char *curr_filename; + /* Current write offset of the file we write to (local_fd) */ + off_t wr_offset; /* pcap stuff */ enum osmo_pcap_fmt file_fmt; diff --git a/src/osmo_server_core.c b/src/osmo_server_core.c index 819a255..cf526a1 100644 --- a/src/osmo_server_core.c +++ b/src/osmo_server_core.c @@ -308,12 +308,17 @@ talloc_free(curr_filename_cpy_dname); } +static void close_local_fd(struct osmo_pcap_conn *conn) +{ + close(conn->local_fd); + conn->local_fd = -1; + conn->wr_offset = 0; +} + void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn) { - if (conn->local_fd >= 0) { - close(conn->local_fd); - conn->local_fd = -1; - } + if (conn->local_fd >= 0) + close_local_fd(conn); move_completed_trace_if_needed(conn); @@ -342,7 +347,7 @@ /* Update conn->last_write if needed. This field is used to keep the last time * period where we wrote to the pcap file. Once a new write period (based on * rotation VTY config) is detected, the pcap file we write to is rotated. */ -static void update_last_write(struct osmo_pcap_conn *conn, time_t now) +static void update_last_write(struct osmo_pcap_conn *conn, time_t now, size_t len) { time_t last = mktime(&conn->last_write); @@ -352,6 +357,8 @@ * using the current one. */ if (now > last) localtime_r(&now, &conn->last_write); + + conn->wr_offset += len; } void osmo_pcap_conn_restart_trace(struct osmo_pcap_conn *conn) @@ -365,7 +372,7 @@ /* omit any storing/creation of the file */ if (!conn->store) { - update_last_write(conn, now); + update_last_write(conn, now, 0); talloc_free(conn->curr_filename); conn->curr_filename = NULL; return; @@ -395,16 +402,15 @@ conn->curr_filename, strerror(errno)); return; } + conn->wr_offset = 0; rc = write(conn->local_fd, conn->file_hdr, conn->file_hdr_len); if (rc != conn->file_hdr_len) { LOGP(DSERVER, LOGL_ERROR, "Failed to write the header: %d\n", errno); - close(conn->local_fd); - conn->local_fd = -1; + close_local_fd(conn); return; } - - update_last_write(conn, now); + update_last_write(conn, now, rc); } void osmo_pcap_server_reopen(struct osmo_pcap_server *server) @@ -425,13 +431,11 @@ /* Returns true if pcap was re-opened */ static bool check_restart_pcap_max_size(struct osmo_pcap_conn *conn, size_t data_len) { - off_t cur; - if (!pcap_server->max_size_enabled) return false; - cur = lseek(conn->local_fd, 0, SEEK_CUR); - if (cur + data_len <= conn->server->max_size) + if (conn->wr_offset + data_len <= conn->server->max_size) return false; + LOGP(DSERVER, LOGL_NOTICE, "Rolling over file for %s (max-size)\n", conn->name); osmo_pcap_conn_restart_trace(conn); return true; @@ -569,7 +573,7 @@ zmq_send_client_data(conn, data, len); if (!conn->store) { - update_last_write(conn, now); + update_last_write(conn, now, 0); return 0; } @@ -582,11 +586,11 @@ if (!check_restart_pcap_max_size(conn, len)) check_restart_pcap_localtime(conn, now); - update_last_write(conn, now); rc = write(conn->local_fd, data, len); if (rc != len) { LOGP(DSERVER, LOGL_ERROR, "Failed to write for %s\n", conn->name); return -1; } + update_last_write(conn, now, rc); return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39303?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: I437eaca982d65d0f06e7d24863875f85267f0e44 Gerrit-Change-Number: 39303 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-pcap[master]: server: Move osmo_pcap_server_alloc() to osmo_server_core.c
by pespin 14 Jan '25

14 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39305?usp=email ) Change subject: server: Move osmo_pcap_server_alloc() to osmo_server_core.c ...................................................................... server: Move osmo_pcap_server_alloc() to osmo_server_core.c Change-Id: I5456e66820cec5bd5acf3cb732b47c42dae7a21e --- M include/osmo-pcap/osmo_pcap_server.h M src/osmo_server_core.c M src/osmo_server_main.c 3 files changed, 32 insertions(+), 30 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index 5d21c64..8bd1dee 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -116,6 +116,15 @@ struct osmo_tls_session tls_session; }; +void osmo_pcap_conn_free(struct osmo_pcap_conn *conn); +void vty_server_init(void); +void osmo_pcap_conn_close(struct osmo_pcap_conn *conn); +int osmo_pcap_conn_process_data(struct osmo_pcap_conn *conn, const uint8_t *data, size_t len); +void osmo_pcap_conn_restart_trace(struct osmo_pcap_conn *conn); +void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn); +void osmo_pcap_conn_event(struct osmo_pcap_conn *conn, + const char *event, const char *data); + struct osmo_pcap_server { struct llist_head conn; @@ -163,16 +172,9 @@ extern struct osmo_pcap_server *pcap_server; extern const struct rate_ctr_group_desc pcap_peer_group_desc; extern const struct rate_ctr_group_desc pcap_server_group_desc; +struct osmo_pcap_server *osmo_pcap_server_alloc(void *ctx); void osmo_pcap_server_reopen(struct osmo_pcap_server *server); int osmo_pcap_server_listen(struct osmo_pcap_server *server); struct osmo_pcap_conn *osmo_pcap_server_find_or_create(struct osmo_pcap_server *ser, const char *name); -void osmo_pcap_conn_free(struct osmo_pcap_conn *conn); -void vty_server_init(void); -void osmo_pcap_conn_close(struct osmo_pcap_conn *conn); -int osmo_pcap_conn_process_data(struct osmo_pcap_conn *conn, const uint8_t *data, size_t len); -void osmo_pcap_conn_restart_trace(struct osmo_pcap_conn *conn); -void osmo_pcap_conn_close_trace(struct osmo_pcap_conn *conn); -void osmo_pcap_conn_event(struct osmo_pcap_conn *conn, - const char *event, const char *data); diff --git a/src/osmo_server_core.c b/src/osmo_server_core.c index cf526a1..5b9c2d4 100644 --- a/src/osmo_server_core.c +++ b/src/osmo_server_core.c @@ -594,3 +594,25 @@ update_last_write(conn, now, rc); return 0; } + +struct osmo_pcap_server *osmo_pcap_server_alloc(void *ctx) +{ + struct osmo_pcap_server *psrv = talloc_zero(ctx, struct osmo_pcap_server); + OSMO_ASSERT(psrv); + + psrv->ctrg = rate_ctr_group_alloc(psrv, &pcap_server_group_desc, 0); + OSMO_ASSERT(psrv->ctrg); + + INIT_LLIST_HEAD(&psrv->conn); + psrv->base_path = talloc_strdup(psrv, "./"); + OSMO_ASSERT(psrv->base_path); + psrv->permission_mask = 0440; + psrv->max_size = 1073741824; /* 1024^3, 1GB **/ + psrv->max_size_enabled = true; + psrv->max_snaplen = DEFAULT_SNAPLEN; + /* By default rotate daily: */ + psrv->rotate_localtime.enabled = true; + psrv->rotate_localtime.intv = TIME_INTERVAL_DAY; + psrv->rotate_localtime.modulus = 1; + return psrv; +} diff --git a/src/osmo_server_main.c b/src/osmo_server_main.c index 74d2727..49ee449 100644 --- a/src/osmo_server_main.c +++ b/src/osmo_server_main.c @@ -204,28 +204,6 @@ msgb_talloc_ctx_init(tall_srv_ctx, 0); } -static struct osmo_pcap_server *osmo_pcap_server_alloc(void *ctx) -{ - struct osmo_pcap_server *psrv = talloc_zero(ctx, struct osmo_pcap_server); - OSMO_ASSERT(psrv); - - psrv->ctrg = rate_ctr_group_alloc(psrv, &pcap_server_group_desc, 0); - OSMO_ASSERT(psrv->ctrg); - - INIT_LLIST_HEAD(&psrv->conn); - psrv->base_path = talloc_strdup(psrv, "./"); - OSMO_ASSERT(psrv->base_path); - psrv->permission_mask = 0440; - psrv->max_size = 1073741824; /* 1024^3, 1GB **/ - psrv->max_size_enabled = true; - psrv->max_snaplen = DEFAULT_SNAPLEN; - /* By default rotate daily: */ - psrv->rotate_localtime.enabled = true; - psrv->rotate_localtime.intv = TIME_INTERVAL_DAY; - psrv->rotate_localtime.modulus = 1; - return psrv; -} - int main(int argc, char **argv) { int rc; -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39305?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: I5456e66820cec5bd5acf3cb732b47c42dae7a21e Gerrit-Change-Number: 39305 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-pcap[master]: server: Move osmo_pcap_server_alloc() to osmo_server_core.c
by pespin 14 Jan '25

14 Jan '25
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39305?usp=email ) Change subject: server: Move osmo_pcap_server_alloc() to osmo_server_core.c ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39305?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: I5456e66820cec5bd5acf3cb732b47c42dae7a21e Gerrit-Change-Number: 39305 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 14 Jan 2025 12:31:45 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-pcap[master]: server: Avoid lseek syscall on every packet write to pcap file
by pespin 14 Jan '25

14 Jan '25
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39303?usp=email ) Change subject: server: Avoid lseek syscall on every packet write to pcap file ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39303?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: I437eaca982d65d0f06e7d24863875f85267f0e44 Gerrit-Change-Number: 39303 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 14 Jan 2025 12:31:42 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XL] Change in osmo-pcap[master]: server: Split network code into its own file
by pespin 14 Jan '25

14 Jan '25
Attention is currently required from: laforge. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39302?usp=email ) Change subject: server: Split network code into its own file ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39302?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: I41d6e0398605becbea109a7bb5aac8981d65ab1b Gerrit-Change-Number: 39302 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Tue, 14 Jan 2025 12:31:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • ...
  • 150
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.