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
[S] Change in osmo-pcap[master]: Makefile.am: proper format and reorder source file lists
by laforge 11 Jan '25

11 Jan '25
Attention is currently required from: pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39286?usp=email ) Change subject: Makefile.am: proper format and reorder source file lists ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39286?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: Ie39bd0348f4f329539c1d9dabc8fa87f3e4bbefe Gerrit-Change-Number: 39286 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Sat, 11 Jan 2025 14:54:44 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-pcap[master]: Cleanup and reorder includes in header files
by laforge 11 Jan '25

11 Jan '25
Attention is currently required from: pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39285?usp=email ) Change subject: Cleanup and reorder includes in header files ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39285?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: I0467d3c3a2687a7990c0db7371d0c89f97e8400a Gerrit-Change-Number: 39285 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Sat, 11 Jan 2025 14:54:28 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-bsc[master]: nokia_site: change RSL bootstrap logic
by laforge 11 Jan '25

11 Jan '25
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39277?usp=email ) Change subject: nokia_site: change RSL bootstrap logic ...................................................................... nokia_site: change RSL bootstrap logic Wait for BTS_CONF_COMPL and start RSL bootstrap after. This way the TRX SW load has enough time to complete and the RSL LAPD becomes available. Important for MetroSite, UltraSite BTS types. Change-Id: I7319a64f069d239a582547bc422058ff5848d2e2 Signed-off-by: csaba.sipos <metro4(a)freemail.hu> --- M src/osmo-bsc/bts_nokia_site.c 1 file changed, 15 insertions(+), 21 deletions(-) Approvals: pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/bts_nokia_site.c b/src/osmo-bsc/bts_nokia_site.c index 688a8a4..14d4388 100644 --- a/src/osmo-bsc/bts_nokia_site.c +++ b/src/osmo-bsc/bts_nokia_site.c @@ -1731,27 +1731,6 @@ osmo_timer_setup(&bts->nokia.reset_timer, reset_timer_cb, bts); osmo_timer_schedule(&bts->nokia.reset_timer, 0, 0); } - - /* ACK for CONF DATA message ? */ - if (bts->nokia.configured != 0) { - /* start TRX (RSL link) */ - - struct gsm_e1_subslot *e1_link = - &sign_link->trx->rsl_e1_link; - struct e1inp_line *line; - - bts->nokia.configured = 0; - - /* RSL Link */ - line = e1inp_line_find(e1_link->e1_nr); - if (!line) { - LOG_BTS(bts, DLINP, LOGL_ERROR, "RSL link referring to " - "non-existing E1 line %u\n", e1_link->e1_nr); - return -ENOMEM; - } - /* start TRX */ - start_sabm_in_line(line, 1, SAPI_RSL); /* start only RSL */ - } break; case NOKIA_MSG_STATE_CHANGED: /* send ACK */ @@ -1760,6 +1739,21 @@ case NOKIA_MSG_CONF_COMPLETE: /* send ACK */ abis_nm_ack(bts, ref); + if (bts->nokia.configured != 0) { + /* start TRX (RSL link) */ + struct gsm_e1_subslot *e1_link = &sign_link->trx->rsl_e1_link; + struct e1inp_line *line; + bts->nokia.configured = 0; + /* RSL Link */ + line = e1inp_line_find(e1_link->e1_nr); + if (!line) { + LOG_BTS(bts, DLINP, LOGL_ERROR, "RSL link referring to " + "non-existing E1 line %u\n", e1_link->e1_nr); + return -ENOMEM; + } + /* start TRX */ + start_sabm_in_line(line, 1, SAPI_RSL); /* start only RSL */ + } /* fake 12.21 OM */ nokia_abis_nm_fake_1221_ok(bts); break; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39277?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I7319a64f069d239a582547bc422058ff5848d2e2 Gerrit-Change-Number: 39277 Gerrit-PatchSet: 2 Gerrit-Owner: csaba.sipos <metro4(a)freemail.hu> 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-gsm-manuals[master]: bibliography.adoc: add TW-TS-* references
by falconia 10 Jan '25

10 Jan '25
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/39289?usp=email ) Change subject: bibliography.adoc: add TW-TS-* references ...................................................................... bibliography.adoc: add TW-TS-* references Some Osmocom components include support for interfaces that are defined in Themyscira Wireless specs (TW-TS): * OsmoBTS includes support for TW-TS-001, may also support TW-TS-002 for HRv1 codec in the future; * OsmoBSC includes support for TW-TS-003 BSSMAP extension; * TW-TS-005 hex file format can be used in some unit tests. Therefore, these specs should be linked from Osmocom bibliography. Change-Id: Ia34a61b5f834f2c70f81012dcc816dd6014c784f --- M common/chapters/bibliography.adoc 1 file changed, 13 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/89/39289/1 diff --git a/common/chapters/bibliography.adoc b/common/chapters/bibliography.adoc index 9d635b0..126f3cc 100644 --- a/common/chapters/bibliography.adoc +++ b/common/chapters/bibliography.adoc @@ -227,3 +227,16 @@ License. https://www.gnu.org/licenses/agpl-3.0.en.html - [[[freeswitch_pbx]]] FreeSWITCH SIP PBX https://freeswitch.org + +- [[[tw-ts-001]]] TW-TS-001: Enhanced RTP transport of FR and EFR codec frames + in an IP-based GSM RAN + https://www.freecalypso.org/specs/tw-ts-001-v010100.txt +- [[[tw-ts-002]]] TW-TS-002: Enhanced RTP transport of HRv1 codec frames + in an IP-based GSM RAN + https://www.freecalypso.org/specs/tw-ts-002-v010100.txt +- [[[tw-ts-003]]] TW-TS-003: BSSMAP extension for selection of enhanced RTP + transport formats + https://www.freecalypso.org/specs/tw-ts-003-v010002.txt +- [[[tw-ts-005]]] TW-TS-005: Hexadecimal file format for sequences of RTP + payloads for GSM speech codecs + https://www.freecalypso.org/specs/tw-ts-005-v010003.txt -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/39289?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Change-Id: Ia34a61b5f834f2c70f81012dcc816dd6014c784f Gerrit-Change-Number: 39289 Gerrit-PatchSet: 1 Gerrit-Owner: falconia <falcon(a)freecalypso.org>
1 0
0 0
[L] Change in osmo-pcap[master]: client: Support generation of pcapng file format
by pespin 10 Jan '25

10 Jan '25
Attention is currently required from: daniel, laforge, pespin. Hello Jenkins Builder, daniel, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-pcap/+/39265?usp=email to look at the new patch set (#7). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: client: Support generation of pcapng file format ...................................................................... client: Support generation of pcapng file format Support transmitting traffic recordings in pcapng towards osmo-pca-server based on VTY config. Old libpcap's file format (.pcap) is still left as default to to keep backward compatibility towards older osmo-pcap-server instances still running. Furthermore, .pcap support is more extended than .pcapng since it's way older. When pcapng file format is selected, osmo-pcap-client will use the same osmo-pcap protocol used in pcap mode, but the payloads encoded in messages will be in pcapng file format instead of pcap. This means, for LINK_HDR message type it will encode a file header with a payload consisting of 1 SHB + N IDB blocks (one for each network interface being monitored). Upon each packet recording received from the monitoring interface, it will encode a LINK_DATA message containing a payload with a encoded pcapng block. This works mostly transparetly on the osmo-pcap-server side, since in general it handles those payloads mostly transparently. Only some sanity checks will need to be updated and improve there to account for the new pcapng blocks. This in turn requires identifying pcap vs pcapng format being recieved from the client, and also placing the proper file suffix when creating the file. This will be done in a follow-up patch modyfing the server side. Related: SYS#5822 Change-Id: I3c80518a1e53a1f77e1aca8dfa83f683f9516ad6 --- M doc/manuals/chapters/client.adoc M include/osmo-pcap/osmo_pcap_client.h M include/osmo-pcap/osmo_pcap_file.h M src/osmo_client_core.c M src/osmo_client_network.c M src/osmo_client_vty.c M src/osmo_pcap_file.c 7 files changed, 534 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/65/39265/7 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39265?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I3c80518a1e53a1f77e1aca8dfa83f683f9516ad6 Gerrit-Change-Number: 39265 Gerrit-PatchSet: 7 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-pcap[master]: client: Introduce osmo_pcap_file to prepare support for pcapng
by pespin 10 Jan '25

10 Jan '25
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39288?usp=email ) Change subject: client: Introduce osmo_pcap_file to prepare support for pcapng ...................................................................... client: Introduce osmo_pcap_file to prepare support for pcapng This patch is a preparation patch refactoring code to make it easier to add pcapng format in follow-up patch. Different types of encodings are grouped in helper functions. Change-Id: Ifd389a2a32897e101c62fd280ddca984d485d373 --- M include/osmo-pcap/Makefile.am M include/osmo-pcap/osmo_pcap_client.h A include/osmo-pcap/osmo_pcap_file.h M src/Makefile.am M src/osmo_client_core.c M src/osmo_client_network.c A src/osmo_pcap_file.c 7 files changed, 247 insertions(+), 78 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/88/39288/1 diff --git a/include/osmo-pcap/Makefile.am b/include/osmo-pcap/Makefile.am index e377b6a..58c8a59 100644 --- a/include/osmo-pcap/Makefile.am +++ b/include/osmo-pcap/Makefile.am @@ -1,6 +1,7 @@ noinst_HEADERS = \ common.h \ osmo_pcap_client.h \ + osmo_pcap_file.h \ osmo_pcap_server.h \ osmo_tls.h \ wireformat.h \ diff --git a/include/osmo-pcap/osmo_pcap_client.h b/include/osmo-pcap/osmo_pcap_client.h index 442244e..470edb6 100644 --- a/include/osmo-pcap/osmo_pcap_client.h +++ b/include/osmo-pcap/osmo_pcap_client.h @@ -139,7 +139,9 @@ struct osmo_pcap_client_conn *osmo_client_conn_alloc(struct osmo_pcap_client *client, const char *name); void osmo_client_conn_free(struct osmo_pcap_client_conn *conn); void osmo_client_conn_send_data(struct osmo_pcap_client_conn *conn, - struct pcap_pkthdr *hdr, const uint8_t *data); + const struct osmo_pcap_handle *ph, + const struct pcap_pkthdr *pkthdr, + const uint8_t *data); void osmo_client_conn_send_link(struct osmo_pcap_client_conn *conn); void osmo_client_conn_connect(struct osmo_pcap_client_conn *conn); void osmo_client_conn_disconnect(struct osmo_pcap_client_conn *conn); diff --git a/include/osmo-pcap/osmo_pcap_file.h b/include/osmo-pcap/osmo_pcap_file.h new file mode 100644 index 0000000..dfa54d0 --- /dev/null +++ b/include/osmo-pcap/osmo_pcap_file.h @@ -0,0 +1,38 @@ +/* + * Procedures to operate on pcap/pcapng file format + * + * (C) 2025 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * 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/>. + * + */ + +#pragma once + +#include <unistd.h> +#include <stdint.h> + +/*********************************************************** +* Libpcap File Format (.pcap) +* https://wiki.wireshark.org/Development/LibpcapFileFormat +***********************************************************/ + +#define OSMO_PCAP_FILE_MAGIC 0xa1b2c3d4 + +unsigned int osmo_pcap_file_global_header_size(void); +int osmo_pcap_file_msgb_append_global_header(struct msgb *msg, uint32_t snaplen, uint32_t linktype); + +unsigned int osmo_pcap_file_record_size(const struct pcap_pkthdr *in_hdr); +int osmo_pcap_file_msgb_append_record(struct msgb *msg, const struct pcap_pkthdr *in_hdr, const uint8_t *data); diff --git a/src/Makefile.am b/src/Makefile.am index 00c9ce9..bb70d21 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,6 +20,7 @@ osmo_client_network.c \ osmo_client_stats.c \ osmo_client_vty.c \ + osmo_pcap_file.c \ osmo_tls.c \ $(NULL) diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c index a2ab894..538b68a 100644 --- a/src/osmo_client_core.c +++ b/src/osmo_client_core.c @@ -172,7 +172,7 @@ return 0; llist_for_each_entry(conn, &client->conns, entry) - osmo_client_conn_send_data(conn, &hdr, data); + osmo_client_conn_send_data(conn, ph, &hdr, data); return 0; } diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c index 70fe740..12b707b 100644 --- a/src/osmo_client_network.c +++ b/src/osmo_client_network.c @@ -1,6 +1,7 @@ /* * osmo-pcap-client code * + * (C) 2025 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 @@ -23,7 +24,9 @@ #include <osmo-pcap/osmo_pcap_client.h> #include <osmo-pcap/common.h> #include <osmo-pcap/wireformat.h> +#include <osmo-pcap/osmo_pcap_file.h> +#include <osmocom/core/utils.h> #include <osmocom/core/msgb.h> #include <osmocom/core/rate_ctr.h> #include <osmocom/core/select.h> @@ -160,112 +163,152 @@ } } -void osmo_client_conn_send_data(struct osmo_pcap_client_conn *conn, - struct pcap_pkthdr *in_hdr, const uint8_t *data) +static struct msgb *osmo_client_conn_prepare_msg_data_pcap(struct osmo_pcap_client_conn *conn, + const struct osmo_pcap_handle *ph, + const struct pcap_pkthdr *pkthdr, + const uint8_t *data) { struct osmo_pcap_data *om_hdr; - struct osmo_pcap_pkthdr *hdr; struct msgb *msg; - int offset, ip_len; - struct osmo_pcap_handle *ph; + unsigned int record_size = osmo_pcap_file_record_size(pkthdr); - if (in_hdr->len > in_hdr->caplen) { - LOGCONN(conn, LOGL_ERROR, "Recording truncated packet, len %zu > snaplen %zu\n", - (size_t) in_hdr->len, (size_t) in_hdr->caplen); - rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_2BIG); - } - - msg = msgb_alloc(in_hdr->caplen + sizeof(*om_hdr) + sizeof(*hdr), "data-data"); + msg = msgb_alloc(sizeof(*om_hdr) + record_size, "pcap-data"); if (!msg) { LOGCONN(conn, LOGL_ERROR, "Failed to allocate\n"); rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_NOMEM); - return; + return NULL; + } + + om_hdr = (struct osmo_pcap_data *) msgb_put(msg, sizeof(*om_hdr)); + om_hdr->type = PKT_LINK_DATA; + om_hdr->len = htons(record_size); + osmo_pcap_file_msgb_append_record(msg, pkthdr, data); + + return msg; +} + +static struct msgb *osmo_client_conn_prepare_msg_ipip(struct osmo_pcap_client_conn *conn, + const struct osmo_pcap_handle *ph, + const struct pcap_pkthdr *pkthdr, + const uint8_t *data) +{ + struct msgb *msg; + int offset, ip_len; + + offset = get_iphdr_offset(pcap_datalink(ph->handle)); + if (offset < 0) + return NULL; + + ip_len = pkthdr->caplen - offset; + if (ip_len < 0) + return NULL; + + + msg = msgb_alloc(ip_len, "ipip_msg"); + if (!msg) { + LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate data.\n"); + rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_NOMEM); + return NULL; + } + msg->l2h = msgb_put(msg, ip_len); + memcpy(msg->l2h, data+offset, ip_len); + return msg; +} + +void osmo_client_conn_send_data(struct osmo_pcap_client_conn *conn, + const struct osmo_pcap_handle *ph, + const struct pcap_pkthdr *pkthdr, + const uint8_t *data) +{ + struct osmo_pcap_client *client = conn->client; + struct msgb *msg; + + if (pkthdr->len > pkthdr->caplen) { + LOGCONN(conn, LOGL_ERROR, "Recording truncated packet, len %zu > snaplen %zu\n", + (size_t) pkthdr->len, (size_t) pkthdr->caplen); + rate_ctr_inc2(client->ctrg, CLIENT_CTR_2BIG); } switch (conn->protocol) { case PROTOCOL_OSMOPCAP: - om_hdr = (struct osmo_pcap_data *) msgb_put(msg, sizeof(*om_hdr)); - om_hdr->type = PKT_LINK_DATA; - - msg->l2h = msgb_put(msg, sizeof(*hdr)); - hdr = (struct osmo_pcap_pkthdr *) msg->l2h; - hdr->ts_sec = in_hdr->ts.tv_sec; - hdr->ts_usec = in_hdr->ts.tv_usec; - hdr->caplen = in_hdr->caplen; - hdr->len = in_hdr->len; - - msg->l3h = msgb_put(msg, in_hdr->caplen); - memcpy(msg->l3h, data, in_hdr->caplen); - - om_hdr->len = htons(msgb_l2len(msg)); - rate_ctr_add2(conn->client->ctrg, CLIENT_CTR_BYTES, hdr->caplen); - rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_PKTS); + msg = osmo_client_conn_prepare_msg_data_pcap(conn, ph, pkthdr, data); break; case PROTOCOL_IPIP: - /* TODO: support capturing from multiple interfaces here: */ - ph = llist_first_entry_or_null(&conn->client->handles, struct osmo_pcap_handle, entry); - if (!ph) { - msgb_free(msg); - return; - } - offset = get_iphdr_offset(pcap_datalink(ph->handle)); - if (offset < 0) { - msgb_free(msg); - return; - } - ip_len = in_hdr->caplen - offset; - if (ip_len < 0) { - msgb_free(msg); - return; - } - msg->l2h = msgb_put(msg, ip_len); - memcpy(msg->l2h, data+offset, ip_len); + msg = osmo_client_conn_prepare_msg_ipip(conn, ph, pkthdr, data); break; default: OSMO_ASSERT(0); } + if (!msg) + return; + + rate_ctr_add2(conn->client->ctrg, CLIENT_CTR_BYTES, pkthdr->caplen); + rate_ctr_inc2(conn->client->ctrg, CLIENT_CTR_PKTS); + write_data(conn, msg); } +static struct msgb *osmo_client_conn_prepare_msg_link_pcap(struct osmo_pcap_client_conn *conn) +{ + struct osmo_pcap_client *client = conn->client; + struct osmo_pcap_data *om_hdr; + struct msgb *msg; + struct osmo_pcap_handle *ph; + int rc; + int linktype; + + ph = llist_first_entry_or_null(&client->handles, struct osmo_pcap_handle, entry); + if (!ph || !ph->handle) { + LOGCONN(conn, LOGL_ERROR, "No pcap_handle not sending link info\n"); + return NULL; + } + linktype = pcap_datalink(ph->handle); + + /* Make sure others have same linktype, .pcap doesn't support different + * linktypes since traffic from all ifaces goes mixed together. */ + llist_for_each_entry(ph, &client->handles, entry) { + if (linktype != pcap_datalink(ph->handle)) { + LOGCONN(conn, LOGL_ERROR, + "File format 'pcap' doesn't support recording from multiple ifaces " + "with different link types!\n"); + return NULL; + } + } + + msg = msgb_alloc(sizeof(*om_hdr) + osmo_pcap_file_global_header_size(), "link-data"); + if (!msg) { + LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate data.\n"); + return NULL; + } + + + om_hdr = (struct osmo_pcap_data *)msgb_put(msg, sizeof(*om_hdr)); + om_hdr->type = PKT_LINK_HDR; + + rc = osmo_pcap_file_msgb_append_global_header(msg, client->snaplen, linktype); + if (rc < 0) { + LOGP(DCLIENT, LOGL_ERROR, "Failed to create pcap file global header.\n"); + msgb_free(msg); + return NULL; + } + + /* Update payload length: */ + om_hdr->len = htons(rc); + return msg; +} + void osmo_client_conn_send_link(struct osmo_pcap_client_conn *conn) { - struct osmo_pcap_handle *ph; - struct pcap_file_header *hdr; - struct osmo_pcap_data *om_hdr; struct msgb *msg; /* IPIP encapsulation has no linktype header */ if (conn->protocol == PROTOCOL_IPIP) return; - /* TODO: support capturing from multiple interfaces here: */ - ph = llist_first_entry_or_null(&conn->client->handles, struct osmo_pcap_handle, entry); - if (!ph || !ph->handle) { - LOGCONN(conn, LOGL_ERROR, "No pcap_handle not sending link info\n"); + msg = osmo_client_conn_prepare_msg_link_pcap(conn); + if (!msg) return; - } - - msg = msgb_alloc(sizeof(*om_hdr) + sizeof(*hdr), "link-data"); - if (!msg) { - LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate data.\n"); - return; - } - - - om_hdr = (struct osmo_pcap_data *) msgb_put(msg, sizeof(*om_hdr)); - om_hdr->type = PKT_LINK_HDR; - om_hdr->len = htons(sizeof(*hdr)); - - hdr = (struct pcap_file_header *) msgb_put(msg, sizeof(*hdr)); - hdr->magic = 0xa1b2c3d4; - hdr->version_major = 2; - hdr->version_minor = 4; - hdr->thiszone = 0; - hdr->sigfigs = 0; - hdr->snaplen = conn->client->snaplen; - hdr->linktype = pcap_datalink(ph->handle); - write_data(conn, msg); } diff --git a/src/osmo_pcap_file.c b/src/osmo_pcap_file.c new file mode 100644 index 0000000..0591682 --- /dev/null +++ b/src/osmo_pcap_file.c @@ -0,0 +1,84 @@ +/* + * osmo-pcap-client code + * + * (C) 2025 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 <pcap/pcap.h> + +#include <osmocom/core/msgb.h> + +#include <osmo-pcap/osmo_pcap_file.h> +#include <osmo-pcap/common.h> +#include <osmo-pcap/wireformat.h> + +/*********************************************************** + * Libpcap File Format (.pcap) + * https://wiki.wireshark.org/Development/LibpcapFileFormat + ***********************************************************/ + +/* Get required length to store a Global Header */ +unsigned int osmo_pcap_file_global_header_size(void) +{ + return sizeof(struct pcap_file_header); +} + +/* Appends a Global Header to msg + * returns number of bytes appended on success, negative on error */ +int osmo_pcap_file_msgb_append_global_header(struct msgb *msg, uint32_t snaplen, uint32_t linktype) +{ + struct pcap_file_header *hdr; + + hdr = (struct pcap_file_header *) msgb_put(msg, sizeof(*hdr)); + hdr->magic = OSMO_PCAP_FILE_MAGIC; + hdr->version_major = 2; + hdr->version_minor = 4; + hdr->thiszone = 0; + hdr->sigfigs = 0; + hdr->snaplen = snaplen; + hdr->linktype = linktype; + + return sizeof(*hdr); +} + +/* Get required length to store a given record (packet) */ +unsigned int osmo_pcap_file_record_size(const struct pcap_pkthdr *in_hdr) +{ + return sizeof(struct osmo_pcap_pkthdr) + in_hdr->caplen; +} + +/* Appends a Record (Packet) Header to msg + * returns number of bytes appended on success, negative on error */ +int osmo_pcap_file_msgb_append_record(struct msgb *msg, const struct pcap_pkthdr *in_hdr, const uint8_t *data) +{ + struct osmo_pcap_pkthdr *hdr; + uint8_t *pkt_payload; + + hdr = (struct osmo_pcap_pkthdr *) msgb_put(msg, sizeof(*hdr)); + hdr->ts_sec = in_hdr->ts.tv_sec; + hdr->ts_usec = in_hdr->ts.tv_usec; + hdr->caplen = in_hdr->caplen; + hdr->len = in_hdr->len; + + pkt_payload = msgb_put(msg, in_hdr->caplen); + memcpy(pkt_payload, data, in_hdr->caplen); + + return osmo_pcap_file_record_size(in_hdr); +} -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39288?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: Ifd389a2a32897e101c62fd280ddca984d485d373 Gerrit-Change-Number: 39288 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-mgw[master]: TODO: move mgcp_rtp_end_config
by pespin 10 Jan '25

10 Jan '25
pespin has abandoned this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39218?usp=email ) Change subject: TODO: move mgcp_rtp_end_config ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39218?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: abandon Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I7f2209f50424903cfefad53b4278b712fda51ce5 Gerrit-Change-Number: 39218 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder
1 0
0 0
[XS] Change in osmo-pcap[master]: server: Rename static functions
by pespin 10 Jan '25

10 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39268?usp=email ) Change subject: server: Rename static functions ...................................................................... server: Rename static functions The current naming of those functions is totally misleadling with regards of the message type it processes. Let's clarify them. Change-Id: I72f21b38b696e80e481043825ad23c3b8d36ab16 --- M src/osmo_server_network.c 1 file changed, 4 insertions(+), 4 deletions(-) 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 9750170..a784af2 100644 --- a/src/osmo_server_network.c +++ b/src/osmo_server_network.c @@ -296,7 +296,7 @@ update_last_write(conn, now); } -static int link_data(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) +static int rx_link_hdr(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) { struct pcap_file_header *hdr; @@ -460,7 +460,7 @@ /* * Check if we are past the limit or on a day change */ -static int write_data(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) +static int rx_link_data(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) { time_t now = time(NULL); int rc; @@ -667,10 +667,10 @@ switch (conn->data->type) { case PKT_LINK_HDR: - return link_data(conn, conn->data); + return rx_link_hdr(conn, conn->data); break; case PKT_LINK_DATA: - return write_data(conn, conn->data); + return rx_link_data(conn, conn->data); break; } } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39268?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: I72f21b38b696e80e481043825ad23c3b8d36ab16 Gerrit-Change-Number: 39268 Gerrit-PatchSet: 1 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]: Cleanup and reorder includes in header files
by pespin 10 Jan '25

10 Jan '25
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-pcap/+/39285?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified-1 by Jenkins Builder Change subject: Cleanup and reorder includes in header files ...................................................................... Cleanup and reorder includes in header files Put all includes in same order of dependencies. Include stdint.h instead of inttypes.h since that's the file actually containing the standard int types. Change-Id: I0467d3c3a2687a7990c0db7371d0c89f97e8400a --- M include/osmo-pcap/osmo_pcap_client.h M include/osmo-pcap/osmo_pcap_server.h M include/osmo-pcap/osmo_tls.h M include/osmo-pcap/wireformat.h M src/osmo_server_network.c 5 files changed, 15 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/85/39285/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39285?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: I0467d3c3a2687a7990c0db7371d0c89f97e8400a Gerrit-Change-Number: 39285 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-pcap[master]: client: Support generation of pcapng file format
by pespin 10 Jan '25

10 Jan '25
Attention is currently required from: daniel, laforge. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39265?usp=email ) Change subject: client: Support generation of pcapng file format ...................................................................... Patch Set 5: This change is ready for review. -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39265?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: I3c80518a1e53a1f77e1aca8dfa83f683f9516ad6 Gerrit-Change-Number: 39265 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Fri, 10 Jan 2025 17:06:52 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • ...
  • 150
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.