Skip to content

Ieee80211 onwire layered fixes#1117

Open
mgonzalezlopezudc wants to merge 7 commits into
inet-framework:masterfrom
mgonzalezlopezudc:ieee80211-onwire-layered-fixes
Open

Ieee80211 onwire layered fixes#1117
mgonzalezlopezudc wants to merge 7 commits into
inet-framework:masterfrom
mgonzalezlopezudc:ieee80211-onwire-layered-fixes

Conversation

@mgonzalezlopezudc

@mgonzalezlopezudc mgonzalezlopezudc commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes several IEEE 802.11 on-wire encoding issues in legacy MAC/PHY serialization and aligns the layered/bitlevel OFDM receive path with the byte representation produced by the packet-level serializers.

Since this PR affects on-wire encoding, fingerprint tests do not PASS. If the PR is accepted, fingerprints should be updated.

The fixes cover:

  • MAC Sequence Control field packing
  • Association/Reassociation Response AID allocation
  • DSSS/HR-DSSS PHY header byte layout
  • OFDM/ERP-OFDM SIGNAL/SERVICE serialization
  • Layered OFDM RATE decoding and byte-represented PHY header decapsulation
  • Unit-test coverage for the corrected on-wire bytes

Motivation

Several serialized IEEE 802.11 fields did not match the bit/octet layout defined by the standard. This affected packet bytes, PCAP output, and fingerprint tests that include packet data.

The affected cases are not model-level semantic changes; they are corrections to how existing MAC/PHY fields are represented on the wire.

Details

Sequence Control

The Sequence Control field is now packed as:

  • bits 0..3: Fragment Number
  • bits 4..15: Sequence Number

and serialized/deserialized using the MAC field octet order.

IEEE Std 802.11-2024 references:

  • Clause 9.2.2, MAC field conventions: Clause 9 fields are depicted in transmission order; numeric field bits are numbered from least to most significant; multi-octet numeric fields are sent from the octet containing the lowest numbered bits to the octet containing the highest numbered bits.
  • Clause 9.2.4.4.1 / Figure 9-7: Sequence Control format places Fragment Number in B0-B3 and Sequence Number in B4-B15.

Association/Reassociation Response AID

Association and Reassociation Responses now return a real AP-assigned AID instead of zero.

IEEE Std 802.11-2024 references:

  • Table 9-65: Association Response frame body includes the AID field.
  • Clause 9.4.1.8: in infrastructure BSS operation, the AID field contains a value assigned by the AP during association.
  • Clause 6.5.7.3.2: for successful non-DMG association, AssociationID is in range 1-2007.
  • Clause 11.2.3.3: AID 0 is reserved for TIM/group-addressed buffered traffic indication, so it should not be used as the STA’s assigned association ID.

This PR adds minimal AID tracking to the MIB, reuses the same AID for repeated association by the same STA, and releases it when the AP transitions the STA out of the associated state.

DSSS / HR-DSSS PHY header serialization

DSSS and HR-DSSS PHY headers are now serialized as the actual 48-bit PHY header:

  • SIGNAL: 8 bits
  • SERVICE: 8 bits
  • LENGTH: 16 bits
  • CRC: 16 bits

This removes non-standard leading padding bytes from the serialized header.

IEEE Std 802.11-2024 references:

  • Clause 15 / Figure 15-1: DSSS PPDU contains PHY preamble, PHY header, and PSDU; the DSSS PHY header fields are SIGNAL, SERVICE, LENGTH, and CRC-16.
  • Clause 16 / Figure 16-1: HR/DSSS long PPDU uses the same PHY header structure: SIGNAL, SERVICE, LENGTH, and CRC-16.

OFDM / ERP-OFDM PHY header serialization

The OFDM SIGNAL field is now packed as the 24-bit on-wire field:

  • bits 0..3: RATE
  • bit 4: Reserved
  • bits 5..16: LENGTH
  • bit 17: parity
  • bits 18..23: SIGNAL tail

The SERVICE field remains the following 16-bit field.

IEEE Std 802.11-2024 references:

  • Clause 17 / Figure 17-1: OFDM PHY header contains RATE, reserved bit, LENGTH, parity, SIGNAL tail, and SERVICE.
  • Clause 17.3.4.1 / Figure 17-5: SIGNAL is 24 bits; RATE occupies bits 0-3, reserved is bit 4, LENGTH occupies bits 5-16, followed by parity and tail.
  • Clause 17.3.4.2 / Table 17-6: RATE is encoded by bits R1-R4.
  • Clause 17.3.4.4: reserved bit handling, parity bit, and SIGNAL tail definition.

Layered/bitlevel OFDM receive path

The layered OFDM receiver now reads RATE from the low nibble of the first SIGNAL byte, matching the corrected SIGNAL byte layout.

The bitlevel OFDM radio decapsulation path now handles byte-represented OFDM PHY headers by parsing the 5-byte header representation directly and stripping the trailer defensively.


Open in Devin Review

Added [Ieee80211OfdmSignalField.h](src/inet/physicallayer/wireless/ieee80211/packetlevel/Ieee80211OfdmSignalField.h) with shared `packIeee80211OfdmSignalField()` / `unpackIeee80211OfdmSignalField()` helpers for the 24-bit OFDM SIGNAL layout.

Then updated:

- [Ieee80211PhyHeaderSerializer.cc](src/inet/physicallayer/wireless/ieee80211/packetlevel/Ieee80211PhyHeaderSerializer.cc) to use the shared helper instead of its private `packOfdmSignal()` logic.
- [Ieee80211OfdmRadio.cc](src/inet/physicallayer/wireless/ieee80211/bitlevel/Ieee80211OfdmRadio.cc) to use the same unpack helper in `decapsulate()` instead of duplicating the bit masks inline.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Reassociation handler missing sendAssocNotification unlike association handler

In handleAssociationRequestFrame (Ieee80211MgmtAp.cc:233), when a STA transitions to ASSOCIATED, sendAssocNotification is called. However, handleReassociationRequestFrame (Ieee80211MgmtAp.cc:268-269) sets the station to ASSOCIATED without calling sendAssocNotification. This is a pre-existing inconsistency not introduced by this PR, but since the PR touched this function to add allocateAssociationId, it may be worth addressing in the same change for completeness.

(Refers to lines 268-269)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solved in the last commit added to the PR

…/inet/linklayer/ieee80211/mgmt/Ieee80211MgmtAp.cc) and added the needed signal overload in [Ieee80211MgmtAp.h](src/inet/linklayer/ieee80211/mgmt/Ieee80211MgmtAp.h).

The AP now waits for `frameSequenceFinishedSignal`, verifies the response frame was ACKed, then marks the STA associated. I removed the eager association/reassociation state writes and the TODO comments.
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