Skip to content

Commit 3d92cb0

Browse files
sebastien-meterinfrastation
authored andcommitted
802.11: fix header length when HT Control header is present
When the ORDER bit is set in the 802.11 flags, the header length needs to be incremented by the size of the HTControl field (4 B).
1 parent ba9257e commit 3d92cb0

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

print-802_11.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,10 +2108,16 @@ extract_header_length(netdissect_options *ndo,
21082108

21092109
switch (FC_TYPE(fc)) {
21102110
case T_MGMT:
2111-
return MGMT_HDRLEN;
2111+
len = MGMT_HDRLEN;
2112+
// HT Control field presence determined by +HTC bit
2113+
// (9.2.4.6 of IEEE 802.11-2020)
2114+
if (FC_ORDER(fc))
2115+
len += IEEE802_11_HT_CONTROL_LEN;
2116+
return len;
21122117
case T_CTRL:
21132118
switch (FC_SUBTYPE(fc)) {
21142119
case CTRL_CONTROL_WRAPPER:
2120+
// HT Control field included in length
21152121
return CTRL_CONTROL_WRAPPER_HDRLEN;
21162122
case CTRL_BAR:
21172123
return CTRL_BAR_HDRLEN;
@@ -2135,8 +2141,13 @@ extract_header_length(netdissect_options *ndo,
21352141
}
21362142
case T_DATA:
21372143
len = (FC_TO_DS(fc) && FC_FROM_DS(fc)) ? 30 : 24;
2138-
if (DATA_FRAME_IS_QOS(FC_SUBTYPE(fc)))
2144+
if (DATA_FRAME_IS_QOS(FC_SUBTYPE(fc))) {
21392145
len += 2;
2146+
// HT Control field presence determined by +HTC bit
2147+
// (9.2.4.6 of IEEE 802.11-2020)
2148+
if (FC_ORDER(fc))
2149+
len += IEEE802_11_HT_CONTROL_LEN;
2150+
}
21402151
return len;
21412152
default:
21422153
ND_PRINT("unknown 802.11 frame type (%u)", FC_TYPE(fc));

tests/TESTLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ scps_invalid scps_invalid.pcap scps_invalid.out
337337
802.11_exthdr ieee802.11_exthdr.pcap ieee802.11_exthdr.out -v
338338
802.11_rx-stbc ieee802.11_rx-stbc.pcap ieee802.11_rx-stbc.out
339339
802.11_meshid ieee802.11_meshid.pcap ieee802.11_meshid.out
340+
802.11_htc ieee802.11_htc.pcap ieee802.11_htc.out -e
340341

341342
# OpenFlow tests
342343
of10_p3295-vv of10_p3295.pcap of10_p3295-vv.out -vv

tests/ieee802.11_htc.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 2025-09-30 12:22:28.668829 967750278us tsft wep 5180 MHz 11a -45dBm signal -107dBm noise antenna 0 [bit 23] CF +QoS BSSID:36:80:94:c0:22:8b SA:b0:be:83:5b:4b:40 DA:ff:ff:ff:ff:ff:ff LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype IPv4 (0x0800), length 328: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from b0:be:83:5b:4b:40, length 300

tests/ieee802.11_htc.pcap

466 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)