From patchwork Tue Aug 25 08:58:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 1350898 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=bKcNggBt; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BbNGC2kzVz9sTd for ; Tue, 25 Aug 2020 18:59:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729560AbgHYI7L (ORCPT ); Tue, 25 Aug 2020 04:59:11 -0400 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:53959 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728033AbgHYI7K (ORCPT ); Tue, 25 Aug 2020 04:59:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K/g6npRGDt3zip5HjkdenYT0LYy/YQ5Tu+UZLe5gS05jAUs3CKNKOnKt+RycgoF61ttuAFTAGIJ7AdcSmTI+wdwmePlFO8QCZWhkQvtUMPvb6yoKmFSGSELRz5zKWCiRyr4QTd/3clsMJEKcD0pvw4kUJmULoZ4nJXZm9xTqWrnKFO7gwwWuet/TzedcI/tX1PIztdqH5qhAkTVeGFIuqVRNfZi72N6AgjznGPX+iVi1QxttOlb1jiMtPNqewlp22wupDIIjRJcCGbrOJPivUDpRbN4jVz69wVlr6HFJLMvunfshq+ugBmkXOG8X0AZhfziBvTNdVo/XDWQ41RNsAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s0sp6y30pjqI5Gazn1kr2gtAgYJ9qqAzqY75gitmdAo=; b=XwodiuVqZpXTin2Hz6IQ0+OwoXbk1nGE8zG+Nh3uUAj6biQIkQzy2JGhsg/WQR4IWQC4ARdi9aHbWXen+tT1NVhSOUUF30W88eS4CDFDK7/r5B50OVQ9GGflKDYlNeo7vEMEJlW06jLXF2cyRBE7GDBxDQsv0QLxSekDYTpRRbC1fqbhtJRAY2w/cxB3Gh+MwuAqdzA+NjiaU7REQesQ1sJMPOY5Hsu1T7HhO7n8KzcieIWH3WkdSrB0a4PA2TKMdwcSHn8pYqYiQEh61e4qNM4RDcBEvn3UFE0kC4lpsqnAEkkA+Dma4sRlMqOG2fJVBjgZ0D9QCgkV1HHGqbeWrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s0sp6y30pjqI5Gazn1kr2gtAgYJ9qqAzqY75gitmdAo=; b=bKcNggBtOCMlrGWWlRY7NwEGPmgS2Jo1/YwkxHOGjmd2iqLqc9cdqlYRFKcF1NDJA82Pb9EhzNhmyoZfaem4IKelfuUeOVDQnaf4uiMA26UjmaJ0kizZln5MKIKUyDr0xGxabmN7pck3Pmmvx3+x8oMSas7aNbWEfj0+PKmsZLI= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none;driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:58:58 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:58:58 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 03/12] staging: wfx: fix BA when MFP is disabled but BSS is MFP capable Date: Tue, 25 Aug 2020 10:58:19 +0200 Message-Id: <20200825085828.399505-3-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> References: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:58:56 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de8e4718-8781-483a-64bb-08d848d51a6f X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6b/aNcRRR9Z8lU26fqoMPDPKKHiuVlKPbrkOHFlWPbq7H1qfsBICspRxfDQJtFnjeMx3e4rBMmshRB5OMtPOz0TCdEZ1Wwybl08BLjI9+0oIxqW3BMnesu7COwZyyMvuRRPNstASRdqFVm4LnkydM4VHuXWS8PFdm4xAuASt0KjGE8QsZjyFGIeqrhHRtU+/pB6qSDj57YjHFn47BXqe/McugmMvkphbTNzhqNGXdG2lzx+LNbzZq0rc3G5WiwVgBa7ix/svPG0cFpaL+R24VMV6ZYa10x/YohG880wTmY1/bRuSf8PaXHCB/rUl9VLMDlurz8eZdJx4E27LMh7k7Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2718.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(39830400003)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: L41zHTgrwyPjhzCJGmoQNTtxXXFmYxIPh9prwjvk9lpqsOxyekzeZrtAODyOPPiEfTVC98mrSP2S7ki/c5sA+eR0gNP/HD9/s/E5sxGrBXthMOumU8Rwg8c/f1S3NC05jHyMxZym3wgDooTFFbrbRPMNT6txpDS0O5yuFvjXXw/vxck0pGFSLVnz3CJ9YNaAH8fNSmoJJWxLVJJi9GXDncfM/+Z5o9m2Zeys3lDvzynrGwWcwp1FWplBf3V3HSzROYY0eLv5llg+KQab/xGJgjxrMyUW8/z98ISJpszyq8a+E31l7zrZnMjOKYlTTd3M6FUufD3Q21wUR5KS4o07vU/aqoE8kqUsTTsArmCQJ2cLNe4KaFY9KOB7DwD716se5hoEQPePJBNvy4aSol5J1kstz9iqVVmNjs74JLFrUf4cq4paDzqrUtDMnV+BS2ctFu5bGGXNov00vlTjs5KEA20CJDwinvYFYT3Rmd4cB9nCY4/qiDsh0MzQRKFAbuKILvcZ+1cquSPrmwfmSSGN5MTanwpSJeQrlnuxvGAYINywjDfLCM5tDc1d0ngIiUM8Gx0QkLRBJSxW0VLWrfLR3H2YsEL7li5uCv/VeNCtME6iAATn5WvX4Jd9S07SnPzch0KJmbBpgkAFb8dGvaSK4A== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: de8e4718-8781-483a-64bb-08d848d51a6f X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:58:58.3735 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8ndhZjhv/mq3CZtJxFQwhGYaM5/01+jCf5Cbm/WAD692vsRC3Fewl/bH3OXq206OYL4M9JH01jw1mMTEsMuzKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller The protection of the management frames is mainly done by mac80211. However, frames for the management of the BlockAck sessions are directly sent by the device. These frames have to be protected if MFP is in use. So the driver has to pass the MFP configuration to the device. Until now, the driver directly read the RSN IE of the BSS. However, it didn't work when the BSS was MFP capable (ieee80211w=1) and the local device has disabled MFP (ieee80211w=0). This patch read the MFP information directly from the struct ieee80211_sta. This information take into account the MFP negotiated during the association. In addition, the code is far simpler. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index b6ccb04f308a..2b848b8985df 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -323,36 +323,6 @@ void wfx_set_default_unicast_key(struct ieee80211_hw *hw, hif_wep_default_key_id(wvif, idx); } -static void wfx_set_mfp(struct wfx_vif *wvif, - struct cfg80211_bss *bss) -{ - const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); - const int pairwise_cipher_suite_size = 4 / sizeof(u16); - const int akm_suite_size = 4 / sizeof(u16); - const u16 *ptr = NULL; - bool mfpc = false; - bool mfpr = false; - - /* 802.11w protected mgmt frames */ - - /* retrieve MFPC and MFPR flags from beacon or PBRSP */ - - rcu_read_lock(); - if (bss) - ptr = (const u16 *)ieee80211_bss_get_ie(bss, WLAN_EID_RSN); - - if (ptr) { - ptr += pairwise_cipher_suite_count_offset; - ptr += 1 + pairwise_cipher_suite_size * *ptr; - ptr += 1 + akm_suite_size * *ptr; - mfpr = *ptr & BIT(6); - mfpc = *ptr & BIT(7); - } - rcu_read_unlock(); - - hif_set_mfp(wvif, mfpc, mfpr); -} - void wfx_reset(struct wfx_vif *wvif) { struct wfx_dev *wdev = wvif->wdev; @@ -400,7 +370,6 @@ static void wfx_do_join(struct wfx_vif *wvif) } rcu_read_unlock(); - wfx_set_mfp(wvif, bss); cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); wvif->join_in_progress = true; @@ -427,6 +396,9 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, sta_priv->vif_id = wvif->id; + if (vif->type == NL80211_IFTYPE_STATION) + hif_set_mfp(wvif, sta->mfp, sta->mfp); + // In station mode, the firmware interprets new link-id as a TDLS peer. if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) return 0;