diff mbox

[v2] mac80211: correct header length calculation

Message ID 1421720247-19787-1-git-send-email-fred.chou.nd@gmail.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show

Commit Message

fred.chou.nd@gmail.com Jan. 20, 2015, 2:17 a.m. UTC
From: Fred Chou <fred.chou.nd@gmail.com>

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.

Signed-off-by: Fred Chou <fred.chou.nd@gmail.com>
---
v2: insert management frame header length calculation after data

 net/wireless/util.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 3535e8a..e2ae2d7 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -308,6 +308,12 @@  unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc)
 		goto out;
 	}
 
+	if (ieee80211_is_mgmt(fc)) {
+		if (ieee80211_has_order(fc))
+			hdrlen += IEEE80211_HT_CTL_LEN;
+		goto out;
+	}
+
 	if (ieee80211_is_ctl(fc)) {
 		/*
 		 * ACK and CTS are 10 bytes, all others 16. To see how