feat(trace-topology): PCAPNG FrameSource (v0.10.x B-2)#210
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
4258e3e to
aec996e
Compare
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>
aec996e to
a7f51e8
Compare
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PcapngFrameSourcereads pcapng captures (tcpdump/tshark/Wireshark) and yields typedCapturedFramerecords with mac_src, mac_dst, optional 802.1Q VLAN-ID + PCP, and a Unix-epoch ns timestamp resolved via the per-IDBts_resoloption.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.IngestErrorgrows concrete kinds (Io,Truncated,MalformedPcapng,UnsupportedLinkType);Unimplementedstays 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 triggersIngestError::Truncated.pcapng_unsupported_linktype_errors_at_open— IDB linktype 101 (RAW) rejected atopen()withUnsupportedLinkType(101).pcapng_ts_resol_nanoseconds— IDBif_tsresol = 9makes ts_ns == raw ticks (no x1000 multiply).Plus:
cargo clippy -p spar-trace-topology --all-targets -- -D warningsclean;cargo fmtclean;rivet validatePASS.🤖 Generated with Claude Code