Projects
osmocom:master
osmo-pcap
Log In
Username
Password
File not found: simtrace2_0.8.1.37.139d.202211110002.dsc
×
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 27
View file
osmo-pcap.spec
Changed
@@ -14,13 +14,13 @@ Name: osmo-pcap Requires: osmocom-master -Version: 0.5.0.29.2d2e +Version: 0.5.0.40.6208 Release: 0 Summary: Osmocom's PCAP client and server License: AGPL-3.0-or-later AND GPL-2.0-or-later Group: Productivity/Telephony/Servers URL: https://osmocom.org/projects/osmo-pcap -Source: osmo-pcap_0.5.0.29.2d2e.tar.xz +Source: osmo-pcap_0.5.0.40.6208.tar.xz Source1: rpmlintrc BuildRequires: autoconf BuildRequires: automake >= 1.6
View file
commit_2d2e37a4091f87deed291cc28b6c1c77aedf9a20.txt
Deleted
View file
commit_620832db372ea8ca2e68551242a364e9912ba9a0.txt
Added
View file
osmo-pcap_0.5.0.29.2d2e.dsc -> osmo-pcap_0.5.0.40.6208.dsc
Changed
@@ -2,7 +2,7 @@ Source: osmo-pcap Binary: osmo-pcap-client, osmo-pcap-server, osmo-pcap-client-dbg, osmo-pcap-server-dbg Architecture: any -Version: 0.5.0.29.2d2e +Version: 0.5.0.40.6208 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://osmocom.org/projects/osmo-pcap Standards-Version: 3.9.1 @@ -15,8 +15,8 @@ osmo-pcap-server deb net extra arch=any osmo-pcap-server-dbg deb net extra arch=any Checksums-Sha1: - 816355e8202ce8d55d528273cacaa2ebe53b0058 56976 osmo-pcap_0.5.0.29.2d2e.tar.xz + 13b2be8fac1acc683a10be22ee0d890a22932613 57168 osmo-pcap_0.5.0.40.6208.tar.xz Checksums-Sha256: - 240995fccac0d9a80cc2b88adb88094ec29729c18cb1930efefd4b0f24626ede 56976 osmo-pcap_0.5.0.29.2d2e.tar.xz + c40b5d59d1152bcb8b88094340fa74ddaa218bca7e54c450a0da787b681c608a 57168 osmo-pcap_0.5.0.40.6208.tar.xz Files: - 256577c0bbf7e62c05e8f6dab13dbe35 56976 osmo-pcap_0.5.0.29.2d2e.tar.xz + 4a493ad011f94beaa0338ed7d0fc74dc 57168 osmo-pcap_0.5.0.40.6208.tar.xz
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/.tarball-version -> osmo-pcap_0.5.0.40.6208.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -0.5.0.29-2d2e +0.5.0.40-6208
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/debian/changelog -> osmo-pcap_0.5.0.40.6208.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -osmo-pcap (0.5.0.29.2d2e) unstable; urgency=medium +osmo-pcap (0.5.0.40.6208) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Fri, 10 Jan 2025 17:36:59 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Mon, 13 Jan 2025 16:16:48 +0000 osmo-pcap (0.5.0) unstable; urgency=medium
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/include/osmo-pcap/Makefile.am -> osmo-pcap_0.5.0.40.6208.tar.xz/include/osmo-pcap/Makefile.am
Changed
@@ -1 +1,7 @@ -noinst_HEADERS = common.h osmo_pcap_client.h osmo_pcap_server.h wireformat.h osmo_tls.h +noinst_HEADERS = \ + common.h \ + osmo_pcap_client.h \ + osmo_pcap_server.h \ + osmo_tls.h \ + wireformat.h \ + $(NULL)
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/include/osmo-pcap/osmo_pcap_client.h -> osmo-pcap_0.5.0.40.6208.tar.xz/include/osmo-pcap/osmo_pcap_client.h
Changed
@@ -21,8 +21,6 @@ */ #pragma once -#include "osmo_tls.h" - #include <inttypes.h> #include <pcap.h> @@ -32,6 +30,8 @@ #include <osmocom/core/rate_ctr.h> #include <osmocom/core/write_queue.h> +#include <osmo-pcap/osmo_tls.h> + #define WQUEUE_MAXLEN_DEFAULT 1000 enum pcap_client_ctr {
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/include/osmo-pcap/osmo_pcap_server.h -> osmo-pcap_0.5.0.40.6208.tar.xz/include/osmo-pcap/osmo_pcap_server.h
Changed
@@ -21,21 +21,20 @@ */ #pragma once -#include "wireformat.h" -#include "osmo_tls.h" - -#include <osmocom/core/select.h> -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/write_queue.h> - +#include <stdbool.h> +#include <time.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pcap.h> -#include <stdbool.h> -#include <time.h> +#include <osmocom/core/select.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/write_queue.h> + +#include <osmo-pcap/wireformat.h> +#include <osmo-pcap/osmo_tls.h> struct rate_ctr_group; struct rate_ctr_group_desc; @@ -79,7 +78,7 @@ /* name */ char *name; char *remote_host; - int no_store; + bool store; struct in_addr remote_addr; /* Remote connection */ @@ -97,8 +96,9 @@ /* read buffering */ int state; int pend; - int reopen; + bool reopen_delayed; struct osmo_pcap_data *data; + size_t data_max_len; /* size of allocated buffer in data->data. */ /* statistics */ struct rate_ctr_group *ctrg; @@ -160,9 +160,9 @@ 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(struct osmo_pcap_server *ser, +struct osmo_pcap_conn *osmo_pcap_server_find_or_create(struct osmo_pcap_server *ser, const char *name); -void osmo_pcap_server_delete(struct osmo_pcap_conn *conn); +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_server_close_conn(struct osmo_pcap_conn *conn);
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/include/osmo-pcap/osmo_tls.h -> osmo-pcap_0.5.0.40.6208.tar.xz/include/osmo-pcap/osmo_tls.h
Changed
@@ -20,12 +20,12 @@ */ #pragma once -#include <gnutls/gnutls.h> -#include <gnutls/abstract.h> - #include <stdbool.h> #include <stdint.h> +#include <gnutls/gnutls.h> +#include <gnutls/abstract.h> + struct osmo_fd; struct osmo_wqueue; struct osmo_pcap_client_conn;
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/include/osmo-pcap/wireformat.h -> osmo-pcap_0.5.0.40.6208.tar.xz/include/osmo-pcap/wireformat.h
Changed
@@ -21,7 +21,7 @@ */ #pragma once -#include <inttypes.h> +#include <stdint.h> #include <pcap.h> enum OsmoPcapDataType {
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/src/Makefile.am -> osmo-pcap_0.5.0.40.6208.tar.xz/src/Makefile.am
Changed
@@ -17,9 +17,9 @@ osmo_client_main.c \ osmo_common.c \ osmo_client_core.c \ - osmo_client_vty.c \ osmo_client_network.c \ osmo_client_stats.c \ + osmo_client_vty.c \ osmo_tls.c \ $(NULL)
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/src/osmo_server_network.c -> osmo-pcap_0.5.0.40.6208.tar.xz/src/osmo_server_network.c
Changed
@@ -41,6 +41,7 @@ #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) @@ -89,8 +90,8 @@ pcap_zmq_send(conn->server->zmq_publ, data, strlen(data), 0); } -static void client_data(struct osmo_pcap_conn *conn, - struct osmo_pcap_data *data) +static void zmq_send_client_data(struct osmo_pcap_conn *conn, + struct osmo_pcap_data *data) { char *event_name; @@ -101,7 +102,7 @@ * 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. + * 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); @@ -135,7 +136,7 @@ if (!server->completed_path) return; - /* Assumption: curr_filename is anonicalized absolute pathname. */ + /* 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. */ @@ -254,7 +255,7 @@ osmo_pcap_server_close_trace(conn); /* omit any storing/creation of the file */ - if (conn->no_store) { + if (!conn->store) { update_last_write(conn, now); talloc_free(conn->curr_filename); conn->curr_filename = NULL; @@ -296,6 +297,7 @@ update_last_write(conn, now); } +/* returns >0 on success, <= 0 on failure (closes conn) */ static int rx_link_hdr(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) { struct pcap_file_header *hdr; @@ -309,10 +311,12 @@ return -1; } - if (!conn->no_store && conn->local_fd < 0) { + if (conn->store && conn->local_fd < 0) { + /* First received link hdr in conn */ conn->file_hdr = *hdr; restart_pcap(conn); } else if (memcmp(&conn->file_hdr, hdr, sizeof(*hdr)) != 0) { + /* Client changed the link hdr in conn */ conn->file_hdr = *hdr; restart_pcap(conn); } @@ -457,17 +461,15 @@ return true; } -/* - * Check if we are past the limit or on a day change - */ +/* 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; - client_data(conn, data); + zmq_send_client_data(conn, data); - if (conn->no_store) { + if (!conn->store) { update_last_write(conn, now); return 1; } @@ -477,6 +479,7 @@ 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); @@ -490,24 +493,18 @@ } -void osmo_pcap_server_delete(struct osmo_pcap_conn *conn) +void osmo_pcap_conn_free(struct osmo_pcap_conn *conn) { close_connection(conn); llist_del(&conn->entry); talloc_free(conn); } -struct osmo_pcap_conn *osmo_pcap_server_find(struct osmo_pcap_server *server, - const char *name) +static struct osmo_pcap_conn *osmo_pcap_conn_alloc(struct osmo_pcap_server *server, + const char *name) { - struct rate_ctr_group_desc *desc; struct osmo_pcap_conn *conn; - size_t buf_size; - - llist_for_each_entry(conn, &server->conn, entry) { - if (strcmp(conn->name, name) == 0) - return conn; - } + struct rate_ctr_group_desc *desc; conn = talloc_zero(server, struct osmo_pcap_conn); if (!conn) { @@ -516,10 +513,9 @@ return NULL; } - buf_size = sizeof(struct osmo_pcap_data); - buf_size += OSMO_MAX(sizeof(struct pcap_file_header), - sizeof(struct osmo_pcap_pkthdr) + server->max_snaplen); - conn->data = talloc_zero_size(conn, buf_size); + conn->data_max_len = OSMO_MAX(sizeof(struct pcap_file_header), + sizeof(struct osmo_pcap_pkthdr) + server->max_snaplen); + 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) { @@ -563,6 +559,19 @@ 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; @@ -608,6 +617,8 @@ return true; } +/* Read segment header, struct osmo_pcap_data (without payload) + * returns >0 on success, <= 0 on failure (closes conn) */ static int read_cb_initial(struct osmo_pcap_conn *conn) { int rc; @@ -624,19 +635,22 @@ LOGP(DSERVER, LOGL_ERROR, "Someone got the pending read wrong: %d\n", conn->pend); return -1; - } else if (conn->pend == 0) { - conn->data->len = ntohs(conn->data->len); + } + if (conn->pend > 0) + return 1; /* Wait for more data before continuing */ - if (!pcap_data_valid(conn)) - return -1; + conn->data->len = ntohs(conn->data->len); - conn->state = STATE_DATA; - conn->pend = conn->data->len; - } + if (!pcap_data_valid(conn)) + return -1; + conn->state = STATE_DATA; + conn->pend = conn->data->len; return 1; } +/* Read segment payload, of size conn->data->len. + * returns >0 on success, <= 0 on failure (closes conn) */ static int read_cb_data(struct osmo_pcap_conn *conn) { int rc; @@ -653,39 +667,45 @@ LOGP(DSERVER, LOGL_ERROR, "Someone got the pending read wrong: %d\n", conn->pend); return -1; - } else if (conn->pend == 0) { - conn->state = STATE_INITIAL; - conn->pend = sizeof(*conn->data); - - /* count the full packet we got */ - rate_ctr_inc2(conn->ctrg, PEER_CTR_PKTS); - rate_ctr_inc2(conn->server->ctrg, SERVER_CTR_PKTS); - - /* count the bytes of it */ - rate_ctr_add2(conn->ctrg, PEER_CTR_BYTES, conn->data->len); - rate_ctr_add2(conn->server->ctrg, SERVER_CTR_BYTES, conn->data->len); - - switch (conn->data->type) { - case PKT_LINK_HDR: - return rx_link_hdr(conn, conn->data); - break; - case PKT_LINK_DATA: - return rx_link_data(conn, conn->data); - break; - } } + if (conn->pend > 0) + return 1; /* Wait for more data before continuing */ - return 1; + conn->state = STATE_INITIAL; + conn->pend = sizeof(*conn->data); + + /* count the full packet we got */ + rate_ctr_inc2(conn->ctrg, PEER_CTR_PKTS); + rate_ctr_inc2(conn->server->ctrg, SERVER_CTR_PKTS); + + /* count the bytes of it */ + rate_ctr_add2(conn->ctrg, PEER_CTR_BYTES, conn->data->len); + rate_ctr_add2(conn->server->ctrg, SERVER_CTR_BYTES, conn->data->len); + + switch (conn->data->type) { + case PKT_LINK_HDR: + rc = rx_link_hdr(conn, conn->data); + break; + case PKT_LINK_DATA: + rc = rx_link_data(conn, conn->data); + break; + default: + OSMO_ASSERT(0); + } + + if (conn->reopen_delayed) { + LOGP(DSERVER, LOGL_INFO, "Reopening log for %s now.\n", conn->name); + restart_pcap(conn); + conn->reopen_delayed = false; + } + + return rc; } +/* returns >0 on success, <= 0 on failure (closes conn) */ static int dispatch_read(struct osmo_pcap_conn *conn) { if (conn->state == STATE_INITIAL) { - if (conn->reopen) { - LOGP(DSERVER, LOGL_INFO, "Reopening log for %s now.\n", conn->name); - restart_pcap(conn); - conn->reopen = 0; - } return read_cb_initial(conn); } else if (conn->state == STATE_DATA) { return read_cb_data(conn); @@ -758,6 +778,7 @@ rate_ctr_inc2(client->ctrg, PEER_CTR_CONNECT); + /* Prepare for first read of segment header: */ client->state = STATE_INITIAL; client->pend = sizeof(*client->data); @@ -861,7 +882,7 @@ restart_pcap(conn); } else { LOGP(DSERVER, LOGL_INFO, "Delaying %s until current packet is complete.\n", conn->name); - conn->reopen = 1; + conn->reopen_delayed = true; } } }
View file
osmo-pcap_0.5.0.29.2d2e.tar.xz/src/osmo_server_vty.c -> osmo-pcap_0.5.0.40.6208.tar.xz/src/osmo_server_vty.c
Changed
@@ -128,7 +128,7 @@ llist_for_each_entry(conn, &pcap_server->conn, entry) { vty_out(vty, " client %s %s%s%s%s", conn->name, conn->remote_host, - conn->no_store ? " no-store" : " store", + conn->store ? " store" : " no-store", conn->tls_use ? " tls" : "", VTY_NEWLINE); } @@ -351,10 +351,10 @@ static int manage_client(struct osmo_pcap_server *pcap_server, struct vty *vty, const char *name, const char *remote_host, - bool no_store, bool use_tls) + bool store, bool use_tls) { struct osmo_pcap_conn *conn; - conn = osmo_pcap_server_find(pcap_server, name); + conn = osmo_pcap_server_find_or_create(pcap_server, name); if (!conn) { vty_out(vty, "Failed to create a pcap server.\n"); return CMD_WARNING; @@ -364,12 +364,10 @@ conn->remote_host = talloc_strdup(pcap_server, remote_host); inet_aton(remote_host, &conn->remote_addr); - /* Checking no-store and maybe closing a pcap file */ - if (no_store) { + /* Checking store and maybe closing a pcap file */ + if (!store) osmo_pcap_server_close_trace(conn); - conn->no_store = 1; - } else - conn->no_store = 0; + conn->store = store; if (use_tls) { /* force moving to TLS */ @@ -383,25 +381,20 @@ return CMD_SUCCESS; } - DEFUN(cfg_server_client, cfg_server_client_cmd, - "client NAME A.B.C.D no-store tls", - CLIENT_STR "Remote name used in filenames\n" - "IP of the remote\n" "Do not store traffic\n" - "Use Transport Level Security\n") -{ - return manage_client(pcap_server, vty, argv0, argv1, argc >= 3, argc >= 4); -} - -DEFUN(cfg_server_client_store_tls, - cfg_server_client_store_tls_cmd, - "client NAME A.B.C.D store tls", - CLIENT_STR "Remote name used in filenames\n" - "IP of the remote\n" "Do not store traffic\n" + "client NAME A.B.C.D (store|no-store) tls", + CLIENT_STR + "Remote name used in filenames\n" + "IP of the remote\n" + "Store traffic\n" "Do not store traffic\n" "Use Transport Level Security\n") { - return manage_client(pcap_server, vty, argv0, argv1, false, argc >= 3); + bool store = true; + if (argc >= 3 && strcmp(argv2, "no-store") == 0) + store = false; + bool tls = argc >= 4; + return manage_client(pcap_server, vty, argv0, argv1, store, tls); } DEFUN(cfg_server_no_client, @@ -410,13 +403,13 @@ NO_STR CLIENT_STR "The name\n") { struct osmo_pcap_conn *conn; - conn = osmo_pcap_server_find(pcap_server, argv0); + conn = osmo_pcap_server_find_or_create(pcap_server, argv0); if (!conn) { vty_out(vty, "Failed to create a pcap server.\n"); return CMD_WARNING; } - osmo_pcap_server_delete(conn); + osmo_pcap_conn_free(conn); return CMD_SUCCESS; } @@ -734,6 +727,5 @@ install_element(SERVER_NODE, &cfg_tls_dh_pkcs3_cmd); install_element(SERVER_NODE, &cfg_server_client_cmd); - install_element(SERVER_NODE, &cfg_server_client_store_tls_cmd); install_element(SERVER_NODE, &cfg_server_no_client_cmd); }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.