diff mbox

mac80211: correct header length calculation

Message ID 1421640460-5094-1-git-send-email-fred.chou.nd@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

fred.chou.nd@gmail.com Jan. 19, 2015, 4:07 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>
---
 net/wireless/util.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Johannes Berg Jan. 19, 2015, 9:58 a.m. UTC | #1
On Mon, 2015-01-19 at 12:07 +0800, Fred Chou wrote:
> 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>
> ---
>  net/wireless/util.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 1d2fcfa..ce9617c 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 1d2fcfa..ce9617c 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -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;