Skip to content

feat(trace-topology): PCAPNG FrameSource (v0.10.x B-2)#210

Merged
avrabe merged 3 commits into
mainfrom
feat/v0.10.x-b2-pcapng-ingest
May 11, 2026
Merged

feat(trace-topology): PCAPNG FrameSource (v0.10.x B-2)#210
avrabe merged 3 commits into
mainfrom
feat/v0.10.x-b2-pcapng-ingest

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 10, 2026

Summary

  • First real runtime-artefact parser on top of the v0.10.0 trace-topology foundation: PcapngFrameSource reads pcapng captures (tcpdump/tshark/Wireshark) and yields typed CapturedFrame records with mac_src, mac_dst, optional 802.1Q VLAN-ID + PCP, and a Unix-epoch ns timestamp resolved via the per-IDB ts_resol option.
  • Built atop pcap-parser = "0.16" (Pierre Chifflier); we own only the L2-header decode and tick-to-ns conversion on top of the crate's NG block iterator.
  • IngestError grows concrete kinds (Io, Truncated, MalformedPcapng, UnsupportedLinkType); Unimplemented stays for the LLDP/Qcc/gPTP placeholders shipping in sibling commits.

Test plan

  • pcapng_roundtrip_untagged_frame — untagged Ethernet header decodes mac_dst/mac_src, vlan_id == None, pcp == None, ts == ticks*1000 (µs IDB).
  • pcapng_roundtrip_8021q_tagged — 802.1Q TCI yields vlan_id == Some(100), pcp == Some(5).
  • pcapng_truncated_frame_yields_error — 8-byte EPB data triggers IngestError::Truncated.
  • pcapng_unsupported_linktype_errors_at_open — IDB linktype 101 (RAW) rejected at open() with UnsupportedLinkType(101).
  • pcapng_ts_resol_nanoseconds — IDB if_tsresol = 9 makes ts_ns == raw ticks (no x1000 multiply).

Plus: cargo clippy -p spar-trace-topology --all-targets -- -D warnings clean; cargo fmt clean; rivet validate PASS.

🤖 Generated with Claude Code

@avrabe avrabe enabled auto-merge (squash) May 10, 2026 19:25
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

❌ Patch coverage is 87.90036% with 34 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-trace-topology/src/ingest.rs 87.90% 34 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe force-pushed the feat/v0.10.x-b2-pcapng-ingest branch from 4258e3e to aec996e Compare May 11, 2026 03:25
avrabe and others added 2 commits May 11, 2026 07:00
cargo-vet flagged pcap-parser 0.16.0 and its two transitive deps
(circular 0.3.0, rusticata-macros 4.1.0) as missing safe-to-deploy
audits. Add exemptions in the established pattern; first-party
audits can land later once the maintenance burden is small.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a PCAPNG-backed FrameSource on top of the trace-topology
foundation. Built on Pierre Chifflier's pcap-parser crate; yields
typed CapturedFrame records carrying L2 identity (mac_src, mac_dst,
optional 802.1Q VLAN-ID and PCP) plus a Unix-epoch nanosecond
timestamp resolved via the per-IDB ts_resol option.

Errors carry concrete kinds (Truncated, MalformedPcapng,
UnsupportedLinkType, Io). LINKTYPE_ETHERNET (1) is the only accepted
link type; other captures fail fast at open() time.

Tests: 5 new — untagged frame roundtrip, 802.1Q tagged with VLAN+PCP,
truncated frame error, unsupported link type error, ns-resolution
timestamp. All 6 LLDP tests from B-3 continue to pass alongside.

Closes the v0.10.x B-2 milestone (B-3 LLDP merged as #208).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe force-pushed the feat/v0.10.x-b2-pcapng-ingest branch from aec996e to a7f51e8 Compare May 11, 2026 05:17
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 474eb16 into main May 11, 2026
16 of 17 checks passed
@avrabe avrabe deleted the feat/v0.10.x-b2-pcapng-ingest branch May 11, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant