From patchwork Mon Aug 14 13:49:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 9898959 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B8C8602BA for ; Mon, 14 Aug 2017 13:49:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C4B6284AA for ; Mon, 14 Aug 2017 13:49:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1127128534; Mon, 14 Aug 2017 13:49:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A92FF284AA for ; Mon, 14 Aug 2017 13:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbdHNNtP (ORCPT ); Mon, 14 Aug 2017 09:49:15 -0400 Received: from mga02.intel.com ([134.134.136.20]:46092 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592AbdHNNtO (ORCPT ); Mon, 14 Aug 2017 09:49:14 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2017 06:49:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,373,1498546800"; d="scan'208";a="139403126" Received: from egrumbacbox.jer.intel.com ([10.12.85.56]) by fmsmga005.fm.intel.com with ESMTP; 14 Aug 2017 06:49:11 -0700 From: Emmanuel Grumbach To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Avinash Patil , Igor Mitsyanko , Sergey Matyukevich , Emmanuel Grumbach Subject: [PATCH] nl80211: add an option to allow MFP without requiring it Date: Mon, 14 Aug 2017 16:49:11 +0300 Message-Id: <20170814134911.20869-1-emmanuel.grumbach@intel.com> X-Mailer: git-send-email 2.9.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP User space can now allow the kernel to associate to an AP that requires MFP or that doesn't have MFP enabled in the same NL80211_CMD_CONNECT command. The driver / firmware will decide whether to use it or not. Signed-off-by: Emmanuel Grumbach --- A short tour of the drivers taught me that only Quantenna really look at cfg80211_connect_params::sme which can now be 2. This is why the maintainer of this driver is CCed. --- include/uapi/linux/nl80211.h | 10 ++++++++-- net/wireless/nl80211.c | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 7950c71c0ad4..ea1cfecbf6f4 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1410,8 +1410,12 @@ enum nl80211_commands { * * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is * used for the association (&enum nl80211_mfp, represented as a u32); - * this attribute can be used - * with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests + * this attribute can be used with %NL80211_CMD_ASSOCIATE and + * %NL80211_CMD_CONNECT requests. %NL80211_MFP_OPTIONAL is not allowed for + * %NL80211_CMD_ASSOCIATE since user space SME is expected and hence, it + * must have decided whether to use management frame protection or not. + * Setting %NL80211_MFP_OPTIONAL with a %NL80211_CMD_CONNECT request will + * let the driver (or the firmware) decide whether to use MFP or not. * * @NL80211_ATTR_STA_FLAGS2: Attribute containing a * &struct nl80211_sta_flag_update. @@ -4086,10 +4090,12 @@ enum nl80211_key_type { * enum nl80211_mfp - Management frame protection state * @NL80211_MFP_NO: Management frame protection not used * @NL80211_MFP_REQUIRED: Management frame protection required + * @NL80211_MFP_OPTIONAL: Management frame is optional */ enum nl80211_mfp { NL80211_MFP_NO, NL80211_MFP_REQUIRED, + NL80211_MFP_OPTIONAL, }; enum nl80211_wpa_versions { diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8f035d9868d1..829867132326 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -9115,6 +9115,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) if (info->attrs[NL80211_ATTR_USE_MFP]) { connect.mfp = nla_get_u32(info->attrs[NL80211_ATTR_USE_MFP]); if (connect.mfp != NL80211_MFP_REQUIRED && + connect.mfp != NL80211_MFP_OPTIONAL && connect.mfp != NL80211_MFP_NO) return -EINVAL; } else {