From patchwork Tue Jan 20 02:17:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fred.chou.nd@gmail.com X-Patchwork-Id: 5662181 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4E3FA9F333 for ; Tue, 20 Jan 2015 02:14:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7018203A5 for ; Tue, 20 Jan 2015 02:14:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F145D20386 for ; Tue, 20 Jan 2015 02:14:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751530AbbATCOr (ORCPT ); Mon, 19 Jan 2015 21:14:47 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:40203 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751465AbbATCOq (ORCPT ); Mon, 19 Jan 2015 21:14:46 -0500 Received: by mail-pd0-f175.google.com with SMTP id fl12so6929961pdb.6 for ; Mon, 19 Jan 2015 18:14:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=HxY3CrMh5gSpeQj3vAUpFuOKo/C0PP8JYVDy8kl/dn0=; b=FpMrnlk1iqs3DJMYwROS80j51smt5KdiWYM88zuPlCyIU+AqIb9RPuCRsDQQCjsqCf NA4Ad85b8Sz01kx29hEJlz7HM4nsP6nYXPsF4Dj1gjOSTkTIt3cXwMWCuBNCfipo0m8v N/4+FzwHeWEzq/wG2xOyTure+Mhw7cIwbghT8wGyUVbeTkun2aoNa+d+QJ3+XA0VEDmD m4Hxa5RSrRUVWwvNskSykczNa+aKWqCtjr/KXXqStqicKOQR/hoyGKMqoRkqNlM706U5 kt271cjvd4fvTc0P6BdYkEvMiJ+dgyeAYSq1RbHR6VTyp9td07hMK22DU2ku9OXwMZ7A v9QA== X-Received: by 10.66.121.168 with SMTP id ll8mr49804805pab.34.1421720086265; Mon, 19 Jan 2015 18:14:46 -0800 (PST) Received: from fred-EP43-DS3L.a-star.edu.sg ([192.122.131.10]) by mx.google.com with ESMTPSA id ku12sm1543439pab.39.2015.01.19.18.14.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jan 2015 18:14:45 -0800 (PST) From: Fred Chou X-Google-Original-From: Fred Chou To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Fred Chou Subject: [PATCH v2] mac80211: correct header length calculation Date: Tue, 20 Jan 2015 10:17:27 +0800 Message-Id: <1421720247-19787-1-git-send-email-fred.chou.nd@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fred Chou 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 --- v2: insert management frame header length calculation after data net/wireless/util.c | 6 ++++++ 1 file changed, 6 insertions(+) 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