Skip to content

feat(userspace/libscap): Add a raw block engine - #3038

Open
geraldcombs wants to merge 4 commits into
falcosecurity:masterfrom
geraldcombs:raw-block-engine
Open

feat(userspace/libscap): Add a raw block engine#3038
geraldcombs wants to merge 4 commits into
falcosecurity:masterfrom
geraldcombs:raw-block-engine

Conversation

@geraldcombs

Copy link
Copy Markdown
Contributor

Add an engine that lets you process individual scap / pcapng blocks in memory. This lets another application that might have a scap file open make use of the analysis features in libsinsp.

Assisted-by: Claude:claude-opus-4-6 claude-opus-4-8

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind test

/kind feature

/kind sync

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area automation

/area drivers

/area driver-kmod

/area driver-modern-bpf

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

This adds a "raw_block" engine, which lets you process events from scap/pcapng blocks in memory. This would let Stratoshark process scap events without having to open capture files concurrently within Stratoshark and libs: https://gitlab.com/wireshark/wireshark/-/work_items/21014.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@geraldcombs

Copy link
Copy Markdown
Contributor Author

The corresponding Stratoshark merge request can be found at https://gitlab.com/wireshark/wireshark/-/merge_requests/25550.

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

Perf diff from master - unit tests

     9.00%    +18.28%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_lock_nothrow()
    20.64%    -16.29%  [.] sinsp_thread_manager::create_thread_dependencies(std::shared_ptr<sinsp_threadinfo> const&)
    21.38%    -11.51%  [.] std::__shared_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__weak_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     4.30%     +8.55%  [.] thread_group_info::get_first_thread() const
     8.37%     -6.41%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_get_use_count() const
    10.70%     +6.32%  [.] sinsp_threadinfo::get_main_thread()
     5.65%     +2.17%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__weak_count<(__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     9.43%     -0.80%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
     3.98%     +0.34%  [.] sinsp_threadinfo::get_fd_table()
     0.10%     -0.08%  [.] std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::accessor const*>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::accessor const*> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable()

Heap diff from master - unit tests

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                                               Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                                                  -0.0588         -0.0588           297           279           297           279
BM_sinsp_split_median                                                                -0.0567         -0.0567           296           280           296           279
BM_sinsp_split_stddev                                                                -0.6828         -0.6695             4             1             4             1
BM_sinsp_split_cv                                                                    -0.6630         -0.6489             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                                        -0.0130         -0.0129            84            83            84            83
BM_sinsp_concatenate_paths_relative_path_median                                      -0.0167         -0.0164            84            83            84            83
BM_sinsp_concatenate_paths_relative_path_stddev                                      -0.6710         -0.6744             1             0             1             0
BM_sinsp_concatenate_paths_relative_path_cv                                          -0.6667         -0.6701             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                                           +0.0792         +0.0793            46            50            46            50
BM_sinsp_concatenate_paths_empty_path_median                                         +0.0808         +0.0808            46            50            46            49
BM_sinsp_concatenate_paths_empty_path_stddev                                         -0.8158         -0.8135             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                                             -0.8293         -0.8272             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                                        +0.0100         +0.0100            85            86            85            86
BM_sinsp_concatenate_paths_absolute_path_median                                      +0.0120         +0.0120            86            87            86            87
BM_sinsp_concatenate_paths_absolute_path_stddev                                      -0.1044         -0.1057             1             1             1             1
BM_sinsp_concatenate_paths_absolute_path_cv                                          -0.1132         -0.1145             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_short_mean                                  +0.0005         +0.0006            19            19            19            19
BM_sinsp_sanitize_string_fast_path_ascii_short_median                                +0.0003         +0.0003            19            19            19            19
BM_sinsp_sanitize_string_fast_path_ascii_short_stddev                                -0.5356         -0.5800             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_short_cv                                    -0.5359         -0.5802             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_long_mean                                   -0.0005         -0.0005           165           165           165           165
BM_sinsp_sanitize_string_fast_path_ascii_long_median                                 -0.0005         -0.0006           165           165           165           165
BM_sinsp_sanitize_string_fast_path_ascii_long_stddev                                 -0.4462         -0.4355             0             0             0             0
BM_sinsp_sanitize_string_fast_path_ascii_long_cv                                     -0.4459         -0.4352             0             0             0             0
BM_sinsp_sanitize_string_fast_path_multibyte_short_mean                              +0.0003         +0.0003            14            14            14            14
BM_sinsp_sanitize_string_fast_path_multibyte_short_median                            +0.0004         +0.0003            14            14            14            14
BM_sinsp_sanitize_string_fast_path_multibyte_short_stddev                            -0.2816         -0.0407             0             0             0             0
BM_sinsp_sanitize_string_fast_path_multibyte_short_cv                                -0.2818         -0.0410             0             0             0             0
BM_sinsp_sanitize_string_fast_path_multibyte_long_mean                               +0.0089         +0.0091          4891          4934          4888          4933
BM_sinsp_sanitize_string_fast_path_multibyte_long_median                             +0.0143         +0.0143          4866          4936          4865          4934
BM_sinsp_sanitize_string_fast_path_multibyte_long_stddev                             -0.9411         -0.9391           106             6           106             6
BM_sinsp_sanitize_string_fast_path_multibyte_long_cv                                 -0.9416         -0.9397             0             0             0             0
BM_sinsp_sanitize_string_fast_path_mixed_long_mean                                   +0.1267         +0.1269          2068          2330          2067          2330
BM_sinsp_sanitize_string_fast_path_mixed_long_median                                 +0.1265         +0.1270          2068          2330          2067          2329
BM_sinsp_sanitize_string_fast_path_mixed_long_stddev                                 -0.8990         -0.9005            12             1            12             1
BM_sinsp_sanitize_string_fast_path_mixed_long_cv                                     -0.9104         -0.9117             0             0             0             0
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_mean                       -0.0044         -0.0044          6256          6229          6254          6227
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_median                     +0.0021         +0.0024          6141          6154          6137          6152
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_stddev                     +0.0913         +0.0895           150           164           151           164
BM_sinsp_sanitize_string_slow_path_c1_controls_long_alloc_cv                         +0.0961         +0.0943             0             0             0             0
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_mean                     +0.0072         +0.0072          6073          6116          6071          6115
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_median                   -0.0469         -0.0471          6318          6022          6317          6019
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_stddev                   -0.5420         -0.5421           402           184           402           184
BM_sinsp_sanitize_string_slow_path_c1_controls_long_noalloc_cv                       -0.5453         -0.5454             0             0             0             0
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_mean                    +0.0248         +0.0248           324           332           324           332
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_median                  +0.0262         +0.0264           324           333           324           332
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_stddev                  +1.1548         +1.1563             2             3             2             3
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_alloc_cv                      +1.1026         +1.1040             0             0             0             0
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_mean                  -0.0089         -0.0089           219           217           219           217
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_median                -0.0095         -0.0094           219           217           219           217
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_stddev                +0.2451         +0.2416             1             1             1             1
BM_sinsp_sanitize_string_slow_path_sparse_invalid_long_noalloc_cv                    +0.2563         +0.2528             0             0             0             0
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_mean                       +0.0403         +0.0404         11964         12446         11959         12442
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_median                     +0.0435         +0.0436         11925         12444         11919         12439
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_stddev                     -0.9584         -0.9597           189             8           190             8
BM_sinsp_sanitize_string_slow_path_all_invalid_long_alloc_cv                         -0.9600         -0.9612             0             0             0             0
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_mean                     -0.0502         -0.0502         12881         12234         12877         12230
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_median                   -0.0502         -0.0502         12881         12234         12875         12229
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_stddev                   -0.5009         -0.4683             7             4             7             4
BM_sinsp_sanitize_string_slow_path_all_invalid_long_noalloc_cv                       -0.4745         -0.4402             0             0             0             0

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 1.23457% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.56%. Comparing base (504e395) to head (3681475).
⚠️ Report is 22 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/examples/test.cpp 0.00% 71 Missing ⚠️
userspace/libsinsp/sinsp.cpp 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3038      +/-   ##
==========================================
- Coverage   75.74%   75.56%   -0.19%     
==========================================
  Files         299      299              
  Lines       33251    33331      +80     
  Branches     5139     5181      +42     
==========================================
  Hits        25187    25187              
- Misses       8064     8144      +80     
Flag Coverage Δ
libsinsp 75.56% <1.23%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add an engine that lets you process individual scap / pcapng blocks in
memory. This lets another application that might have a scap file open
make use of the analysis features in libsinsp.

Assisted-by: Claude:claude-opus-4-6 claude-opus-4-8

Signed-off-by: Gerald Combs <gerald@wireshark.org>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new libscap “raw_block” engine and corresponding libsinsp API to process scap/pcapng blocks from an in-memory buffer, enabling external applications to reuse libsinsp analysis without concurrently opening capture files.

Changes:

  • Introduces the raw_block libscap engine (plus a membuf reader) and wires it into engine selection/build config.
  • Exposes sinsp::open_raw_block() and updates the sinsp example + CI to exercise the new engine.
  • Refactors parts of the savefile engine to share block parsing/event reading code with the new engine.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
userspace/libsinsp/sinsp.h Adds open_raw_block() API and documentation.
userspace/libsinsp/sinsp.cpp Implements sinsp::open_raw_block() using the new engine/platform.
userspace/libsinsp/examples/test.cpp Adds --raw_block option and in-memory (optionally gzip-inflated) replay logic.
userspace/libsinsp/examples/CMakeLists.txt Links the example against zlib for gzip inflation support.
userspace/libscap/scap.h Includes the raw_block engine public header.
userspace/libscap/scap_engines.h Declares scap_raw_block_engine under HAS_ENGINE_RAW_BLOCK.
userspace/libscap/scap_config.h.in Adds HAS_ENGINE_RAW_BLOCK configure define.
userspace/libscap/engine/savefile/scap_savefile.c Exposes savefile init/next helpers for reuse by raw_block.
userspace/libscap/engine/savefile/savefile.h Declares the newly exposed savefile helper APIs.
userspace/libscap/engine/raw_block/scap_reader_membuf.c New reader implementation over a memory buffer.
userspace/libscap/engine/raw_block/scap_raw_block.c New engine implementation reusing savefile parsing + converter.
userspace/libscap/engine/raw_block/raw_block.h Defines raw_block engine handle type (alias of savefile_engine).
userspace/libscap/engine/raw_block/raw_block_public.h Public params/docs for configuring the raw_block engine.
userspace/libscap/engine/raw_block/raw_block_platform.h Platform struct definition for raw_block.
userspace/libscap/engine/raw_block/CMakeLists.txt Adds the raw_block engine static library target and deps.
userspace/libscap/CMakeLists.txt Builds/links raw_block engine when enabled.
cmake/modules/engine_config.cmake Enables HAS_ENGINE_RAW_BLOCK by default.
.github/workflows/ci.yml Runs sinsp-example with --raw_block and diffs output vs savefile engine.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +778 to +783
scap_platform* platform = scap_raw_block_alloc_platform({::on_proc_table_refresh_start,
::on_proc_table_refresh_end,
::on_new_entry_from_proc,
this});
params.platform = platform;
oargs.engine_params = &params;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right place for the check? We don't check for null in the other open_XXX routines, and if we do care we should probably check in sinsp::open_common().

Comment thread userspace/libscap/engine/raw_block/scap_raw_block.c
Comment thread userspace/libscap/engine/raw_block/scap_reader_membuf.c
Comment thread userspace/libscap/engine/raw_block/scap_raw_block.c
Comment thread userspace/libscap/engine/raw_block/raw_block_public.h Outdated
Comment thread userspace/libsinsp/sinsp.h
Comment thread userspace/libsinsp/examples/test.cpp
Comment thread userspace/libsinsp/examples/test.cpp
Fix a few issues found by Copilot.

Assisted-by: GitHub Copilot

Signed-off-by: Gerald Combs <gerald@wireshark.org>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Gerald Combs <gerald@wireshark.org>
this});
params.platform = platform;
oargs.engine_params = &params;
try_open_common(&oargs, &scap_raw_block_engine, platform, SINSP_MODE_CAPTURE);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a separate SINSP_MODE_RAW_BLOCK and corresponding sinsp::is_raw_block()?

Don't set our mode until our platform has been successfully initialized.

Signed-off-by: Gerald Combs <gerald@wireshark.org>

@ekoops ekoops left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana

poiana commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 571c909d00135556b3a7d4768f217ef7babe924f

@ekoops ekoops added this to the 0.26.0 milestone Jul 16, 2026
@poiana

poiana commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ekoops, geraldcombs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@leogr leogr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

This is a really nice work 👍

I took a look by myself and then with the help of https://github.com/leogr/falco-expert

It SGTM already, I just have one doubt before the final approve, plus a few minor things (that you're free to ignore 😅 )

See inline comments 👇


// Our platform is initialized. Save the mode used by the inspector.
// (should this be a member of scap_platform instead?)
m_mode = mode;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a doubt here 🤔

On master, m_mode is set at the very top of open_common(), before scap_init(). This moves it after scap_platform_init(), so during the proc-table scan (on_new_entry_from_proc) m_mode is still SINSP_MODE_NONE (it hasn't been set to mode yet).

That scan runs inside scap_init() for the capture engines (savefile/raw_block populate the proclist from the metadata blocks via scap_savefile_read_init()), and inside scap_platform_init() for nodriver. In both cases on_new_entry_from_proc reads the mode:

  • is_capture() (sinsp.cpp:1006 and :1095) gates the internal-filter simulation that sets m_filtered_out on the threads/fds loaded from the capture. With the mode not set yet, that simulation is skipped, so a capture opened with an internal filter wouldn't mark those entries as filtered out (i.e., they'd end up in a re-dumped file).
  • is_nodriver() (sinsp.cpp:979) selects the dedup-by-clone_ts path during the procfs scan.

So this looks like a behavioral change for offline captures (and nodriver), not just raw_block. Was that intended?

If the goal is just to avoid leaving a stale m_mode when the open fails, may we reset it in the try_open_common() catch instead, and keep the assignment before scap_init()? That way the proc-scan callbacks still see the right mode.

wdyt? 🤔

this});
params.platform = platform;
oargs.engine_params = &params;
try_open_common(&oargs, &scap_raw_block_engine, platform, SINSP_MODE_CAPTURE);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a separate SINSP_MODE_RAW_BLOCK and corresponding sinsp::is_raw_block()?

I'd avoid it, unless we have a concrete need to tell raw_block apart from a regular capture. Since the engine behaves exactly like an offline capture, SINSP_MODE_CAPTURE looks correct to me, and a new mode would mean auditing all the is_capture()/is_offline() call sites to preserve the offline behavior we get for free here, for no real gain atm.

If a use case for distinguishing them shows up later, we can add it then 👍

::on_new_entry_from_proc,
this});
params.platform = platform;
oargs.engine_params = &params;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right place for the check? [...] if we do care we should probably check in sinsp::open_common()

Agreed, I wouldn't special-case it here. The engine init() already bails out on a NULL platform (scap_raw_block.c:105), and both scap_platform_close() and scap_platform_free() handle NULL (scap_platform.c:109 / :128), so try_open_common() won't blow up even on the OOM path.

So this is consistent with the other open_* routines and fine as-is IMO 👍

return SCAP_SUCCESS;
}

static int32_t next(struct scap_engine_handle engine,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit / non-blocking.

The conversion loop below is basically a copy of the one in the savefile engine's next() (scap_savefile.c). Since you already extracted scap_savefile_read_init() and scap_savefile_next_event_from_file() into shared helpers, may we do the same for this loop (e.g. a scap_savefile_convert_event(handle, pevent) that both engines call)?

The len > MAX_EVENT_SIZE guard was recently added to both copies, which is exactly the kind of drift that's easy to miss keeping in sync. Not a blocker for this PR, we can do it as a follow-up 🙏

<< std::endl;
exit(EXIT_FAILURE);
}
// Demonstrate incremental feeding: open the engine with only the section header +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that the metadata-only-then-grow path is covered here 👍

One thing: raw_block_public.h also documents feeding more blocks after next() returns SCAP_EOF (the streaming case). Here the buffer is grown to full size before the first next(), so SCAP_EOF is only hit at the true end and that resume-after-EOF path isn't exercised. AFAIK sinsp::next() doesn't set any terminal flag on SCAP_EOF, so it should work, but since that's the incremental contract Stratoshark would rely on, may we add a small case that consumes to SCAP_EOF, grows the buffer, and resumes?

Non-blocking, just to lock the contract down 🙏

block, any metadata blocks, and zero or more event blocks. The buffer
contents are processed by calling \ref sinsp::next until it returns
\ref SCAP_EOF, which signals that the current buffer has been
consumed. Additional blocks can besupplied in one of two ways:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
consumed. Additional blocks can besupplied in one of two ways:
consumed. Additional blocks can be supplied in one of two ways:

Nit. besupplied 🙏

/*

This engine lets you process a scap file using a memory buffer. Buffers
must be a sequence of whole pcapng blocks as defined at

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.B. not a blocker, and it's inherited from the savefile parser.

The doc points at the pcapng spec for the block layout, but the parser we reuse (scap_read_section_header) only accepts a native-endian SHB: a byte-swapped SHB_MAGIC (0x4D3C2B1A) is rejected with invalid magic number rather than byte-swapped. So raw_block is effectively native-endian only.

pcapng itself allows both byte orders. Since the whole point here is feeding Stratoshark-produced blocks, may we confirm those are always host-endian? Otherwise we'd want to document the constraint here, or handle the swap. wdyt? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants