Skip to contentSkip to conversation

mac80211: correct header length calculation

PATCH Superseded Fred Chou 2 participants 2 messages Jan 19, 2015 802.11 (including cfg80211/NL80211)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fred Chou

author
#0 lore raw

PATCH 1/1 mac80211: correct header length calculation

From: Fred Chou <[email protected]>

HT Control field may also be present in management frames, as defined in 8.2.4.1.10 of 802.11-2012. Account for this in calculation of header length.

---
 net/wireless/util.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/wireless/util.c +6 -0
index 1d2fcfa..ce9617c 100644
@@ -297,6 +297,12 @@ unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc)
 {
 	unsigned int hdrlen = 24;
 
+	if (ieee80211_is_mgmt(fc)) {
+		if (ieee80211_has_order(fc))
+			hdrlen += IEEE80211_HT_CTL_LEN;
+		goto out;
+	}
+
 	if (ieee80211_is_data(fc)) {
 		if (ieee80211_has_a4(fc))
 			hdrlen = 30;
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 16 lines · Fred Chou

From: Fred Chou <[email protected]>

HT Control field may also be present in management frames, as defined in 8.2.4.1.10 of 802.11-2012. Account for this in calculation of header length.

---
 net/wireless/util.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/wireless/util.c +0 -0
index 1d2fcfa..ce9617c 100644

net/wireless/util.c unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc) · line 306

Quoted 10 lines
net/wireless/util.c +6 -0
@@ -297,6 +297,12 @@ unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc)
 {
 	unsigned int hdrlen = 24;
 
+	if (ieee80211_is_mgmt(fc)) {
+		if (ieee80211_has_order(fc))
+			hdrlen += IEEE80211_HT_CTL_LEN;
+		goto out;
+	}
+
 	if (ieee80211_is_data(fc)) {

I think you should insert this after data since data frames are more common.

johannes