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
[M] Change in osmo-bsc[master]: nokia_site: introduce hopping control for Nokia *Site
by Jenkins Builder 13 Jan '25

13 Jan '25
Attention is currently required from: csaba.sipos, pespin. Jenkins Builder has posted comments on this change by csaba.sipos. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39290?usp=email ) Change subject: nokia_site: introduce hopping control for Nokia *Site ...................................................................... Patch Set 9: (1 comment) File src/osmo-bsc/bts_vty.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-20932): https://gerrit.osmocom.org/c/osmo-bsc/+/39290/comment/7058543f_3c99f439?usp… : PS9, Line 480: vty_out(vty, "%% BTS is not of Nokia *Site type%s",VTY_NEWLINE); space required after that ',' (ctx:VxV) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39290?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Idb1d269d2ee80d72ede2394125e8acedf0ee8b06 Gerrit-Change-Number: 39290 Gerrit-PatchSet: 9 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> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: csaba.sipos <metro4(a)freemail.hu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Jan 2025 20:52:59 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-bsc[master]: nokia_site: introduce hopping control for Nokia *Site
by csaba.sipos 13 Jan '25

13 Jan '25
Attention is currently required from: csaba.sipos, pespin. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-bsc/+/39290?usp=email to look at the new patch set (#9). The following approvals got outdated and were removed: Code-Review+1 by pespin, Verified+1 by Jenkins Builder Change subject: nokia_site: introduce hopping control for Nokia *Site ...................................................................... nokia_site: introduce hopping control for Nokia *Site nokia_site hopping-mode baseband nokia_site hopping-mode synthesizer Signed-off-by: csaba.sipos <metro4(a)freemail.hu> Change-Id: Idb1d269d2ee80d72ede2394125e8acedf0ee8b06 --- A doc/examples/osmo-bsc/nokia/osmo-bsc.metrosite.RF-hopping.2TRX.cfg M include/osmocom/bsc/bts.h M src/osmo-bsc/bts_nokia_site.c M src/osmo-bsc/bts_vty.c 4 files changed, 212 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/90/39290/9 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39290?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Idb1d269d2ee80d72ede2394125e8acedf0ee8b06 Gerrit-Change-Number: 39290 Gerrit-PatchSet: 9 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> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: csaba.sipos <metro4(a)freemail.hu> Gerrit-Attention: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-pcap[master]: cosmetic: osmo_tls: Fix indentation whitespace
by pespin 13 Jan '25

13 Jan '25
Attention is currently required from: pespin. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-pcap/+/39304?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/04/39304/3 -- 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: newpatchset 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-Attention: 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 13 Jan '25

13 Jan '25
Attention is currently required from: laforge, pespin. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-pcap/+/39302?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review+1 by laforge, Verified+1 by Jenkins Builder 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/02/39302/3 -- 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: newpatchset 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-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-pcap[master]: server: Support storing of pcapng format
by pespin 13 Jan '25

13 Jan '25
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39287?usp=email ) Change subject: server: Support storing of pcapng format ...................................................................... server: Support storing of pcapng format Improve existing logic doing validation on payload data and generalize the file_hdr field to account for the possibily of receiving recordings in pcapng format. This requires, during LINK_HDR when file header is received, discerning whether the recording is being done in pcap vs pcapng, (and in pcapng figuring out the endianness of the file) and then applying validation based on that knowledge. With that knowledge, osmo-pcap-server can now store the pcap(ng) file using the proper suffix for the file. Related: SYS#5822 Change-Id: I275d28ab418a1514fa9c5c7c20f3d831cc6af8bb --- M include/osmo-pcap/osmo_pcap_file.h M include/osmo-pcap/osmo_pcap_server.h M src/Makefile.am M src/osmo_pcap_file.c M src/osmo_server_network.c M tests/rotate_localtime/Makefile.am 6 files changed, 333 insertions(+), 46 deletions(-) Approvals: 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_file.h b/include/osmo-pcap/osmo_pcap_file.h index 705e6d2..8b413d7 100644 --- a/include/osmo-pcap/osmo_pcap_file.h +++ b/include/osmo-pcap/osmo_pcap_file.h @@ -29,6 +29,8 @@ OSMO_PCAP_FMT_PCAPNG, }; +int osmo_pcap_file_discover_fmt(const uint8_t *data, size_t data_len, enum osmo_pcap_fmt *result_fmt); + /*********************************************************** * Libpcap File Format (.pcap) * https://wiki.wireshark.org/Development/LibpcapFileFormat @@ -122,6 +124,11 @@ /* ... Options ... */ } __attribute__((packed)); +int osmo_pcapng_file_is_swapped(const uint8_t *data, size_t data_len); +uint16_t osmo_pcapng_file_read_uint16(const uint8_t *data, bool endian_swapped); +uint32_t osmo_pcapng_file_read_uint32(const uint8_t *data, bool endian_swapped); +uint64_t osmo_pcapng_file_read_uint64(const uint8_t *data, bool endian_swapped); + /* Helper APIs to encode blocks: */ struct osmo_pcapng_file_shb_pars { diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index da39d99..f44781a 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -35,6 +35,7 @@ #include <osmo-pcap/wireformat.h> #include <osmo-pcap/osmo_tls.h> +#include <osmo-pcap/osmo_pcap_file.h> struct rate_ctr_group; struct rate_ctr_group_desc; @@ -88,7 +89,10 @@ char *curr_filename; /* pcap stuff */ - struct pcap_file_header file_hdr; + enum osmo_pcap_fmt file_fmt; + bool pcapng_endian_swapped; + uint8_t *file_hdr; + uint32_t file_hdr_len; /* last time */ struct tm last_write; diff --git a/src/Makefile.am b/src/Makefile.am index bb70d21..0fb16a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,6 +35,7 @@ osmo_pcap_server_SOURCES = \ osmo_server_main.c \ osmo_common.c \ + osmo_pcap_file.c \ osmo_server_vty.c \ osmo_server_network.c \ osmo_server_stats.c \ diff --git a/src/osmo_pcap_file.c b/src/osmo_pcap_file.c index 4b8b114..91bb1f3 100644 --- a/src/osmo_pcap_file.c +++ b/src/osmo_pcap_file.c @@ -29,6 +29,40 @@ #include <osmo-pcap/common.h> #include <osmo-pcap/wireformat.h> +/* Find out whether data contains a start of a .pcap or .pcapng file. + * Returns 0 on success, negative on error. */ +int osmo_pcap_file_discover_fmt(const uint8_t *data, size_t data_len, enum osmo_pcap_fmt *result_fmt) +{ + const struct pcapng_block_header *bh; + const struct pcapng_section_header_block *shb; + + /* Check for .pcap: */ + if (data_len >= sizeof(struct pcap_file_header) && + ((struct pcap_file_header *)data)->magic == OSMO_PCAP_FILE_MAGIC) { + *result_fmt = OSMO_PCAP_FMT_PCAP; + return 0; + } + + /* Check for .pcapng: */ + if (data_len < sizeof(struct pcapng_block_header) + + sizeof(struct pcapng_section_header_block) + + sizeof(uint32_t)) + return -1; + + bh = (const struct pcapng_block_header *)data; + /* BLOCK_TYPE_SHB has the same value regardless of byte order */ + if (bh->block_type != BLOCK_TYPE_SHB) + return -1; + + shb = (const struct pcapng_section_header_block *)&bh->block_body[0]; + if (shb->magic != OSMO_PCAPNG_FILE_MAGIC && + shb->magic != OSMO_PCAPNG_FILE_MAGIC_SWAPPED) + return -2; + + *result_fmt = OSMO_PCAP_FMT_PCAPNG; + return 0; +} + /*********************************************************** * Libpcap File Format (.pcap) * https://wiki.wireshark.org/Development/LibpcapFileFormat @@ -173,6 +207,64 @@ return sizeof(*opth); } +static int osmo_pcapng_file_shb_is_swapped(const struct pcapng_section_header_block *shb) +{ + if (shb->magic == OSMO_PCAPNG_FILE_MAGIC_SWAPPED) + return 1; + if (shb->magic == OSMO_PCAPNG_FILE_MAGIC) + return 0; + return -1; +} + +/* 1: true, 0: false, negative: error */ +int osmo_pcapng_file_is_swapped(const uint8_t *data, size_t data_len) +{ + const struct pcapng_block_header *bh = (const struct pcapng_block_header *)data; + const struct pcapng_section_header_block *shb; + + if (data_len < sizeof(struct pcapng_block_header) + + sizeof(struct pcapng_section_header_block) + + sizeof(uint32_t)) + return -1; + + /* BLOCK_TYPE_SHB has the same value regardless of byte order */ + if (bh->block_type != BLOCK_TYPE_SHB) + return -1; + + shb = (const struct pcapng_section_header_block *)&bh->block_body[0]; + return osmo_pcapng_file_shb_is_swapped(shb); +} + +uint16_t osmo_pcapng_file_read_uint16(const uint8_t *data, bool endian_swapped) +{ + uint16_t val; + + memcpy(&val, data, sizeof(val)); + if (!endian_swapped) + return val; + return (val >> 8) | (val << 8); +} + +uint32_t osmo_pcapng_file_read_uint32(const uint8_t *data, bool endian_swapped) +{ + uint32_t val; + + memcpy(&val, data, sizeof(val)); + if (!endian_swapped) + return val; + return __builtin_bswap32(val); +} + +uint64_t osmo_pcapng_file_read_uint64(const uint8_t *data, bool endian_swapped) +{ + uint64_t val; + + memcpy(&val, data, sizeof(val)); + if (!endian_swapped) + return val; + return __builtin_bswap64(val); +} + /* Get required length to store a given record (packet) */ unsigned int osmo_pcapng_file_shb_size(const struct osmo_pcapng_file_shb_pars *pars) { diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c index c2b0e34..3179c20 100644 --- a/src/osmo_server_network.c +++ b/src/osmo_server_network.c @@ -109,7 +109,7 @@ talloc_free(event_name); pcap_zmq_send(conn->server->zmq_publ, - &conn->file_hdr, sizeof(conn->file_hdr), + conn->file_hdr, conn->file_hdr_len, ZMQ_SNDMORE); pcap_zmq_send(conn->server->zmq_publ, &data->data[0], data->len, @@ -269,10 +269,11 @@ conn->server->base_path, strerror(errno)); return; } - conn->curr_filename = talloc_asprintf(conn, "%s/trace-%s-%d%.2d%.2d_%.2d%.2d%.2d.pcap", + 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); + 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); @@ -286,8 +287,8 @@ return; } - rc = write(conn->local_fd, &conn->file_hdr, sizeof(conn->file_hdr)); - if (rc != sizeof(conn->file_hdr)) { + 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; @@ -297,27 +298,116 @@ 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) +static int validate_link_hdr_pcap(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) { struct pcap_file_header *hdr; hdr = (struct pcap_file_header *) &data->data[0]; - + if (data->len < sizeof(struct pcap_file_header)) { + LOGP(DSERVER, LOGL_ERROR, + "Implausible llink_hdr length: %u < %zu\n", + data->len, sizeof(struct pcap_file_header)); + return -1; + } if (hdr->snaplen > conn->server->max_snaplen) { LOGP(DSERVER, LOGL_ERROR, "The recvd pcap_file_header contains too big snaplen %zu > %zu\n", (size_t) hdr->snaplen, (size_t) conn->server->max_snaplen); return -1; } + return 0; +} + +static int validate_link_hdr_pcapng(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) +{ + + const struct pcapng_block_header *bh = (const struct pcapng_block_header *)&data->data[0]; + const size_t pcapnb_bh_min_len = sizeof(struct pcapng_block_header) + sizeof(uint32_t); + uint32_t block_total_length, block_type; + + if (data->len < pcapnb_bh_min_len) { + LOGP(DSERVER, LOGL_ERROR, "Implausible data length: %u < %zu\n", + data->len, pcapnb_bh_min_len); + return -1; + } + + block_total_length = osmo_pcapng_file_read_uint32((uint8_t *)&bh->block_total_length, conn->pcapng_endian_swapped); + if (block_total_length & 0x00000003) { + LOGP(DSERVER, LOGL_ERROR, "Implausible pcapng block total length not multiple of 4: %u\n", + block_total_length); + return -1; + } + + /* We have a SHB block + N IDB blocks here, so it most probably won't be equal + * since we are only checking the 1st SHB block here: */ + if (block_total_length > data->len) { + LOGP(DSERVER, LOGL_ERROR, "Implausible pcapng block total length: %u > %u\n", + block_total_length, data->len); + return -1; + } + + block_type = osmo_pcapng_file_read_uint32((uint8_t *)&bh->block_type, conn->pcapng_endian_swapped); + if (block_type != BLOCK_TYPE_SHB) { + LOGP(DSERVER, LOGL_ERROR, "Implausible pcapng Block Header type %u vs exp %u\n", + block_type, BLOCK_TYPE_SHB); + return -1; + } + + /* TODO: validate each idb->snaplen in data->data to be <= conn->server->max_snaplen */ + + return 0; +} + +static int validate_link_hdr(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) +{ + + /* Validation checks: */ + switch (conn->file_fmt) { + case OSMO_PCAP_FMT_PCAP: + return validate_link_hdr_pcap(conn, data); + case OSMO_PCAP_FMT_PCAPNG: + return validate_link_hdr_pcapng(conn, data); + default: + OSMO_ASSERT(0); + } +} + +/* returns >0 on success, <= 0 on failure (closes conn) */ +static int rx_link_hdr(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data) +{ + int rc; + + rc = osmo_pcap_file_discover_fmt(data->data, data->len, &conn->file_fmt); + if (rc < 0) + return rc; + + if (conn->file_fmt == OSMO_PCAP_FMT_PCAPNG) { + rc = osmo_pcapng_file_is_swapped(data->data, data->len); + if (rc < 0) { + LOGP(DSERVER, LOGL_ERROR, "Unable to figure out pcapng file endianness\n"); + return rc; + } + conn->pcapng_endian_swapped = !!rc; + } + + /* Validation checks: */ + if ((rc = validate_link_hdr(conn, data)) < 0) + return rc; if (conn->store && conn->local_fd < 0) { /* First received link hdr in conn */ - conn->file_hdr = *hdr; + talloc_free(conn->file_hdr); + 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); - } else if (memcmp(&conn->file_hdr, hdr, sizeof(*hdr)) != 0) { + } else if (conn->file_hdr_len != data->len || + memcmp(&conn->file_hdr, data->data, data->len) != 0) { /* Client changed the link hdr in conn */ - conn->file_hdr = *hdr; + talloc_free(conn->file_hdr); + 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); } @@ -461,12 +551,95 @@ 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; + + min_len = sizeof(struct osmo_pcap_pkthdr); + max_len = conn->server->max_snaplen + sizeof(struct osmo_pcap_pkthdr); + if (data->len < min_len || data->len > max_len) { + LOGP(DSERVER, LOGL_ERROR, "Implausible data length: %u < %u <= %u\n", + min_len, data->len, max_len); + return -1; + } + return 0; +} + +/* pcapng: validate size of payload (pkt) in EPB doesn't go through snaplen. */ +static int validate_link_data_pcapng(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) +{ + + const struct pcapng_block_header *bh = (const struct pcapng_block_header *)&data->data[0]; + const struct pcapng_enhanced_packet_block *epb; + const size_t pcapnb_bh_min_len = sizeof(struct pcapng_block_header) + sizeof(uint32_t); + uint32_t block_total_length, block_type, captured_len; + + if (data->len < pcapnb_bh_min_len) { + LOGP(DSERVER, LOGL_ERROR, "Implausible data length: %u < %zu\n", + data->len, pcapnb_bh_min_len); + return -1; + } + + block_total_length = osmo_pcapng_file_read_uint32((uint8_t *)&bh->block_total_length, conn->pcapng_endian_swapped); + if (block_total_length & 0x00000003) { + LOGP(DSERVER, LOGL_ERROR, "Implausible pcapng block total length not multiple of 4: %u\n", + block_total_length); + return -1; + } + + if (block_total_length != data->len) { + LOGP(DSERVER, LOGL_ERROR, "Implausible pcapng block total length: %u != %u\n", + block_total_length, data->len); + return -1; + } + + block_type = osmo_pcapng_file_read_uint32((uint8_t *)&bh->block_type, conn->pcapng_endian_swapped); + switch (block_type) { + case BLOCK_TYPE_EPB: + if (data->len < pcapnb_bh_min_len + sizeof(struct pcapng_enhanced_packet_block)) { + LOGP(DSERVER, LOGL_ERROR, "Implausible data length: %u < %zu\n", + data->len, pcapnb_bh_min_len + sizeof(struct pcapng_enhanced_packet_block)); + return -1; + } + epb = (struct pcapng_enhanced_packet_block *)&bh->block_body[0]; + captured_len = osmo_pcapng_file_read_uint32((uint8_t *)&epb->captured_len, conn->pcapng_endian_swapped); + if (captured_len > conn->server->max_snaplen) { + LOGP(DSERVER, LOGL_ERROR, "Implausible pcapng EPB captured length: %u > %u\n", + captured_len, conn->server->max_snaplen); + return -1; + } + break; + default: + LOGP(DSERVER, LOGL_DEBUG, "Unexpected pcapng Block Header type %u\n", block_type); + /* Other types exist which we don't specifically support right now, but which may + * be sent by newer osmo-pcap-client. Allow storing it without further checks. */ + break; + } + return 0; +} + +static int validate_link_data(const struct osmo_pcap_conn *conn, const struct osmo_pcap_data *data) +{ + /* Validation checks: */ + switch (conn->file_fmt) { + case OSMO_PCAP_FMT_PCAP: + return validate_link_data_pcap(conn, data); + case OSMO_PCAP_FMT_PCAPNG: + return validate_link_data_pcapng(conn, data); + default: + OSMO_ASSERT(0); + } +} + /* 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) { @@ -500,6 +673,42 @@ 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) { @@ -513,8 +722,7 @@ return NULL; } - conn->data_max_len = OSMO_MAX(sizeof(struct pcap_file_header), - sizeof(struct osmo_pcap_pkthdr) + server->max_snaplen); + 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); @@ -587,36 +795,6 @@ return do_read_tls(conn, buf, size); } -static bool pcap_data_valid(struct osmo_pcap_conn *conn) -{ - unsigned int min_len, max_len; - switch ((enum OsmoPcapDataType) conn->data->type) { - case PKT_LINK_HDR: - if (conn->data->len != sizeof(struct pcap_file_header)) { - LOGP(DSERVER, LOGL_ERROR, - "Implausible llink_hdr length: %u != %zu\n", - conn->data->len, sizeof(struct osmo_pcap_pkthdr)); - return false; - } - break; - case PKT_LINK_DATA: - min_len = sizeof(struct osmo_pcap_pkthdr); - max_len = conn->server->max_snaplen + sizeof(struct osmo_pcap_pkthdr); - if (conn->data->len < min_len || conn->data->len > max_len) { - LOGP(DSERVER, LOGL_ERROR, - "Implausible data length: %u < %u <= %u\n", - min_len, conn->data->len, max_len); - return false; - } - break; - default: - LOGP(DSERVER, LOGL_ERROR, "Unknown data type %" PRIx8 "\n", - conn->data->type); - return false; - } - 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) @@ -641,8 +819,11 @@ conn->data->len = ntohs(conn->data->len); - if (!pcap_data_valid(conn)) + if (conn->data->len > conn->data_max_len) { + LOGP(DSERVER, LOGL_ERROR, "Implausible data length: %u > %zu (snaplen %u)\n", + conn->data->len, conn->data_max_len, conn->server->max_snaplen); return -1; + } conn->state = STATE_DATA; conn->pend = conn->data->len; @@ -767,7 +948,8 @@ { close_connection(client); - memset(&client->file_hdr, 0, sizeof(client->file_hdr)); + TALLOC_FREE(client->file_hdr); + client->file_hdr_len = 0; client->rem_wq.bfd.fd = new_fd; if (osmo_fd_register(&client->rem_wq.bfd) != 0) { LOGP(DSERVER, LOGL_ERROR, "Failed to register fd.\n"); diff --git a/tests/rotate_localtime/Makefile.am b/tests/rotate_localtime/Makefile.am index fca9ff8..265e4fe 100644 --- a/tests/rotate_localtime/Makefile.am +++ b/tests/rotate_localtime/Makefile.am @@ -28,6 +28,7 @@ $(NULL) rotate_localtime_test_LDADD = \ + $(top_builddir)/src/osmo_pcap_file.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/+/39287?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: I275d28ab418a1514fa9c5c7c20f3d831cc6af8bb Gerrit-Change-Number: 39287 Gerrit-PatchSet: 6 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-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-pcap[master]: server: Support storing of pcapng format
by pespin 13 Jan '25

13 Jan '25
Attention is currently required from: daniel, osmith. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39287?usp=email ) Change subject: server: Support storing of pcapng format ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39287?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: I275d28ab418a1514fa9c5c7c20f3d831cc6af8bb Gerrit-Change-Number: 39287 Gerrit-PatchSet: 6 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-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Jan 2025 20:16:22 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-bsc[master]: nokia_site: introduce hopping control for Nokia *Site
by fixeria 13 Jan '25

13 Jan '25
Attention is currently required from: csaba.sipos. fixeria has posted comments on this change by csaba.sipos. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39290?usp=email ) Change subject: nokia_site: introduce hopping control for Nokia *Site ...................................................................... Patch Set 8: (1 comment) Patchset: PS8: Oh, I almost forgot to bring this up... You're adding a new command, but you didn't update `config_write_bts_single()` to print it -- please do it. Otherwise changes made via the VTY will not be saved. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39290?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Idb1d269d2ee80d72ede2394125e8acedf0ee8b06 Gerrit-Change-Number: 39290 Gerrit-PatchSet: 8 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> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: csaba.sipos <metro4(a)freemail.hu> Gerrit-Comment-Date: Mon, 13 Jan 2025 19:41:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[L] Change in osmo-pcap[master]: server: Support storing of pcapng format
by laforge 13 Jan '25

13 Jan '25
Attention is currently required from: daniel, osmith, pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39287?usp=email ) Change subject: server: Support storing of pcapng format ...................................................................... Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39287?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: I275d28ab418a1514fa9c5c7c20f3d831cc6af8bb Gerrit-Change-Number: 39287 Gerrit-PatchSet: 6 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-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Jan 2025 19:40:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-msc[master]: vlr: only set HLR number if field is present
by pespin 13 Jan '25

13 Jan '25
Attention is currently required from: lynxis lazus. pespin has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-msc/+/39232?usp=email ) Change subject: vlr: only set HLR number if field is present ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/39232?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I26dc4c00b81723cd7ead095a515269afd0f73f8e Gerrit-Change-Number: 39232 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Mon, 13 Jan 2025 19:36:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-msc[master]: vlr: Add support for CS and PS timers
by pespin 13 Jan '25

13 Jan '25
Attention is currently required from: daniel, lynxis lazus. pespin has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-msc/+/38486?usp=email ) Change subject: vlr: Add support for CS and PS timers ...................................................................... Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38486?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I364973b8d9e277ec5963343c0a83061e81a5baba Gerrit-Change-Number: 38486 Gerrit-PatchSet: 5 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Mon, 13 Jan 2025 19:36:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • ...
  • 150
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.