Add opt-in IEEE 802.11 Radiotap PCAP capture - #1130
Open
mgonzalezlopezudc wants to merge 7 commits into
Open
Conversation
mgonzalezlopezudc
marked this pull request as ready for review
August 16, 2026 20:47
Accept an A-MPDU whose final MPDU is followed by exactly the required alignment padding. The equality case is structurally complete for VHT/HE-family aggregates and must not discard every MPDU from the capture. Replace the unrelated PHY payload-length versus header-length comparison with a positive-length check. This permits short nonempty PSDUs while keeping zero-length VHT NDPs and negative lengths out of MAC-frame resolution. Add focused regression coverage for terminal padding, emitted MPDU data and FCS, short OFDM payload resolution, and zero or negative PHY length rejection.
Fall back to a single whole-PSDU Radiotap record when A-MPDU parsing fails or produces no MPDU ranges. This prevents damaged, unusual, and delimiter-only PSDUs from disappearing from capture output and keeps recorder counters aligned with written observations. Preserve established FCS presence when computed-FCS validation cannot serialize the preceding payload, without guessing FCS provenance from untyped byte chunks or fabricating a BADFCS result. Extend the focused recorder tests to verify complete PSDU byte retention for malformed and empty aggregates, retain normal aggregate splitting, and cover the FCS serialization-failure path.
Avoid serializing every captured MPDU and recomputing its FCS when the typed trailer is marked FCS_COMPUTED. Standard INET capture paths calculate that trailer after the final MAC fields are set, so the adapter now treats it as present and trusted while continuing to map FCS_DECLARED_INCORRECT to Radiotap BADFCS. Document the capture design decisions raised during review: typed-chunk requirements for FCS and A-MPDU recognition, aggregate padding and whole-PSDU fallback, Radiotap field layout, adapter registry uniqueness and lifecycle, protocol-adapter record semantics, wireless observation fallback, and PCAPng interface and snaplen handling. Update the Radiotap FCS unit coverage so a deliberately mismatching computed value remains trusted, and remove the obsolete serialization-failure fixture. Verified with the release build and the focused PCAP adapter, A-MPDU, registry, and writer-prefix unit tests.
When protocol-specific capture adapters were enabled, protocolToLinkType() selected the adapter link type but the generic packet overload still used the legacy match-and-convert path. IEEE 802.11 therefore selected Radiotap, failed the link-type match, and aborted because no generic Radiotap converter exists. Delegate adapter-backed packet writes to the existing observation overload so the adapter creates complete prefixed records. Preserve the legacy matching and conversion behavior when either feature flag is disabled or no adapter is registered. Extend PcapRecorderIeee80211Ampdu_1 with a direct packet-overload regression that verifies the Radiotap header fields and exact payload suffix. This catches both the original abort and invalid prefix-less link-type-127 output. Validation: release and debug builds pass; the focused PcapRecorder regression passes. Both PcapRecorder tests also pass in the broader unit run, whose remaining failures match pre-existing unrelated failures.
Contributor
Author
|
@levy With respect to the potential bug signaled by Devin in its review: "Large packets are now silently cut short in the default capture file format: Recorded packets are now shortened to the configured maximum capture size (std::min<size_t>(originalLength, snaplen) at src/inet/common/packet/recorder/PcapngWriter.cc:231) in the PCAPng format, which previously always stored them in full, so existing setups can lose the tail of every oversized frame. Impact: Users who kept the default settings and captured frames larger than the default limit will now find those frames incomplete in their capture files." I think the right behavior for INET is to honor the value of |
Classify VHT modes before HT modes so a future inheritance relationship cannot cause VHT packets to emit HT MCS metadata. Rename the legacy cPacket argument to packetObject in both declaration and definition, avoiding type-name shadowing without changing the virtual API. Document the capture contracts that are easy to misread: PHY payload resolution remains within caller-provided offsets and falls back to generic dissection on malformed headers; outbound A-MPDUs stay split into decodable MPDUs without receive-only status metadata; adapter-backed formats require writer prefix support; and enriched PHY context crosses the legacy virtual hook only for the identical packet. Validation: release build passed; PcapRecorderRadiotapHtVht_1.test and PcapRecorderIeee80211Ampdu_1.test passed; git diff --check passed. Full unit and fingerprint suites were intentionally not run.
Treat a zero PCAPng snap length as unlimited when calculating captured packet data while preserving the zero value advertised in the interface description block. Track the first link type associated with each network interface and reject later mismatches before writing an enhanced packet block, preventing silently misdecoded captures. Reset cached interface identifiers and link types whenever the writer opens a new file so reused writer instances emit self-contained interface descriptions. Extend the focused writer test with unlimited-snaplen, link-type mismatch, and close/reopen regression coverage.
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
Add protocol-specific PCAP capture adapters and an opt-in IEEE 802.11 Radiotap adapter.
enableProtocolSpecificCaptureAdaptersand packet conversion are enabledVHT MU, HE, and EHT metadata are intentionally outside this PR because upstream/master does not contain their authoritative metadata producers.
Validation
git diff --check: PASSNo fingerprint expectations are changed.