Skip to content

Commit 474eb16

Browse files
avrabeclaude
andauthored
feat(trace-topology): PCAPNG FrameSource (v0.10.x B-2) (#210)
* chore(vet): add exemptions for pcap-parser deps 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> * feat(trace-topology): PCAPNG FrameSource (v0.10.x B-2) 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> * ci: re-trigger CI after self-hosted runner disk-full flakes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2104cc6 commit 474eb16

7 files changed

Lines changed: 556 additions & 28 deletions

File tree

Cargo.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

artifacts/requirements.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,4 +1863,20 @@ artifacts:
18631863
status: implemented
18641864
tags: [trace-topology, ingest, lldp, v0100]
18651865

1866+
- id: REQ-TRACE-TOPOLOGY-003
1867+
type: requirement
1868+
title: PCAPNG FrameSource for L2 frame ingest
1869+
description: >
1870+
System shall provide a PCAPNG-backed FrameSource implementation
1871+
in spar-trace-topology that, given a `.pcapng` file recorded
1872+
with tcpdump / tshark / Wireshark from a TAP/SPAN port, yields
1873+
a stream of CapturedFrame records carrying mac_src, mac_dst,
1874+
optional 802.1Q VLAN-ID and PCP, and a Unix-epoch ns timestamp
1875+
derived from the per-IDB ts_resol option. Built atop the
1876+
`pcap-parser` crate. Errors carry concrete kinds (Truncated,
1877+
UnsupportedLinkType, MalformedPcapng, Io). Per the v0.10.0
1878+
trace-topology design's §"Implementation phasing" PCAPNG entry.
1879+
status: implemented
1880+
tags: [trace-topology, ingest, pcapng, v0100]
1881+
18661882
# Research findings tracked separately in research/findings.yaml

artifacts/verification.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,3 +2429,23 @@ artifacts:
24292429
links:
24302430
- type: satisfies
24312431
target: REQ-TRACE-TOPOLOGY-004
2432+
2433+
- id: TEST-TRACE-TOPOLOGY-PCAPNG
2434+
type: feature
2435+
title: PcapngFrameSource yields correct typed CapturedFrames
2436+
description: >
2437+
Tests in crates/spar-trace-topology/src/ingest.rs cover an
2438+
untagged Ethernet frame roundtrip, an 802.1Q-tagged frame with
2439+
VLAN-ID and PCP extraction, a truncated frame producing
2440+
IngestError::Truncated, an unsupported link type producing
2441+
IngestError::UnsupportedLinkType, and per-IDB ts_resol
2442+
handling for both µs and ns resolutions.
2443+
fields:
2444+
method: automated-test
2445+
steps:
2446+
- run: cargo test -p spar-trace-topology --lib -- ingest::tests
2447+
status: passing
2448+
tags: [trace-topology, ingest, pcapng, v0100]
2449+
links:
2450+
- type: satisfies
2451+
target: REQ-TRACE-TOPOLOGY-003

crates/spar-trace-topology/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ spar-base-db.workspace = true
1212
spar-syntax.workspace = true
1313
serde = { workspace = true, features = ["derive"] }
1414
serde_json = { workspace = true }
15+
pcap-parser = "0.16"
1516

1617
[dev-dependencies]
1718
tempfile = "3"

0 commit comments

Comments
 (0)