Skip to content

ieee80211: preserve all 12 bits of the A-MPDU delimiter length - #1187

Open
mgonzalezlopezudc wants to merge 1 commit into
inet-framework:masterfrom
mgonzalezlopezudc:fix/ampdu-delimiter-length
Open

ieee80211: preserve all 12 bits of the A-MPDU delimiter length#1187
mgonzalezlopezudc wants to merge 1 commit into
inet-framework:masterfrom
mgonzalezlopezudc:fix/ampdu-delimiter-length

Conversation

@mgonzalezlopezudc

Copy link
Copy Markdown
Contributor

What

Preserve all 12 bits of the A-MPDU delimiter length when deserializing Ieee80211MpduSubframeHeader in Ieee80211MpduSubframeHeaderSerializer.

Why

In Ieee80211MpduSubframeHeaderSerializer::deserializeFields(), the decoder previously discarded the high length nibble and overwrote the length with only the low byte:

stream.readUint4();
mpduSubframe->setLength(stream.readUint4() >> 8);
mpduSubframe->setLength(stream.readUint8());

Because readUint4() >> 8 evaluates to 0 and the subsequent setLength(stream.readUint8()) unconditionally overwrote the length with only the low 8 bits, any delimiter length >= 256 had its upper 4 bits discarded (e.g., decoding 0xABC as 0x0BC).

Restoring:

int length = stream.readUint4() << 8;
length |= stream.readUint8();
mpduSubframe->setLength(length);

restores symmetry with serializeFields(), which emits the 12-bit length across the high nibble and low byte per IEEE Std 802.11 A-MPDU delimiter specifications.

Reading Order

This PR consists of a single self-contained commit:

  1. 97fdb7ba2eieee80211: preserve all 12 bits of the A-MPDU delimiter length
    • Single decision & rationale: Fixes 12-bit length deserialization in Ieee80211MpduSubframeHeaderSerializer::deserializeFields and adds unit test Ieee80211MpduSubframeHeaderSerializer_1.test verifying round-trip serialization/deserialization across byte boundaries (0, 255, 256, 0xABC, 4095) and fixed-byte decoding.
    • Component surface:
      • src/inet/linklayer/ieee80211/mac/Ieee80211MacHeaderSerializer.cc
      • tests/unit/Ieee80211MpduSubframeHeaderSerializer_1.test

Architectural Surface

  • Modules touched:
    • src/inet/linklayer/ieee80211/mac/Ieee80211MacHeaderSerializer.cc
    • tests/unit/Ieee80211MpduSubframeHeaderSerializer_1.test
  • Contracts and protocols: IEEE 802.11 MAC A-MPDU subframe header chunk serializer (Ieee80211MpduSubframeHeaderSerializer).
  • Packet representation: Preserves existing Ieee80211MpduSubframeHeader chunk definition; fixes deserialization of byte-backed packets into chunk fields.
  • Configuration surface: None.
  • Feature descriptors: None.
  • Seals and audit exceptions: All modified source files under src/inet/ are unsealed (doc/project/enforcement/check-source-seals.sh PASS). No architectural deviations (AV-*) or naming deviations (NV-*) introduced.

Baselines

No fingerprint or statistical baseline updates required.

Verification Evidence

  1. Compilation:
    • make MODE=debug -j$(nproc): Clean build (libINET_dbg.so).
    • make MODE=release -j$(nproc): Clean build (libINET.so).
  2. Mechanical gates:
    • doc/project/enforcement/check-commits.sh upstream/master..HEAD: PASS (1 commit, linear, valid subject/facts format, clean splits).
    • doc/project/enforcement/check-source-seals.sh --base upstream/master: PASS (all touched files unsealed).
    • doc/project/enforcement/check-naming.sh --base upstream/master: PASS (0 mechanical candidates in changed files).
    • doc/project/enforcement/check-architecture.sh src/inet/linklayer/ieee80211: PASS (clean architecture).
  3. Direct unit tests:
    • inet_run_unit_tests -m debug -f 'Ieee80211MpduSubframeHeaderSerializer.*': PASS (Ieee80211MpduSubframeHeaderSerializer_1.test passed in 0.594s).

The MPDU subframe decoder discarded the high length nibble and overwrote the length with its low byte, decoding 0xABC as 0xBC. Combine both parts before setting the field to restore symmetry with the encoder.

Add registered-serializer round trips at 0, 255, 256, 0xABC, and 4095 plus a fixed-byte decoding case. Assert decoded fields using fresh byte-backed packets so cached serialized bytes cannot mask the defect.
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