From patchwork Mon Jan 9 17:53:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 9505661 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 B9CE160757 for ; Mon, 9 Jan 2017 17:54:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E77F9284D2 for ; Mon, 9 Jan 2017 17:54:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBC4A284C0; Mon, 9 Jan 2017 17:54: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6D9A2284C0 for ; Mon, 9 Jan 2017 17:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939003AbdAIRyE (ORCPT ); Mon, 9 Jan 2017 12:54:04 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:52969 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938269AbdAIRxw (ORCPT ); Mon, 9 Jan 2017 12:53:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1483984432; x=1515520432; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=uDpL4696unhtOr+D34P4AJzI1f/BjOAvypkxtm8p/3w=; b=Sc+Bxq9Frb2efdRmCiC7YT7lU2fx++C+p//s0n1tge5LjKPUke2PScv2 +lym4bJD36Hp3wxFv89YqFJuQJdXBzA8fKtqBy+GQH70pSsGEAn8yc+jv K7x0SJtrnKmCHYu/va0vrDSqwbGJDKIqDnDmie/ouN2J5seu5Wdf8UJf3 8=; X-IronPort-AV: E=Sophos;i="5.33,340,1477983600"; d="scan'208";a="349375752" Received: from unknown (HELO Ironmsg04-L.qualcomm.com) ([10.53.140.111]) by wolverine02.qualcomm.com with ESMTP; 09 Jan 2017 09:53:51 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8403"; a="1268892937" X-Amp-Result: CLEAN Received: from nasanexm02c.na.qualcomm.com ([10.85.0.43]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 09 Jan 2017 09:53:51 -0800 Received: from euamsexm01e.eu.qualcomm.com (10.251.127.42) by NASANEXM02C.na.qualcomm.com (10.85.0.43) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 9 Jan 2017 09:53:50 -0800 Received: from jouni.qca.qualcomm.com (10.80.80.8) by euamsexm01e.eu.qualcomm.com (10.251.127.42) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 9 Jan 2017 18:53:45 +0100 From: Jouni Malinen To: Johannes Berg CC: , vamsi krishna , Jouni Malinen Subject: [PATCH v2 2/3] cfg80211: Add support to randomize TA of Public Action frames Date: Mon, 9 Jan 2017 19:53:07 +0200 Message-ID: <1483984388-30237-2-git-send-email-jouni@qca.qualcomm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483984388-30237-1-git-send-email-jouni@qca.qualcomm.com> References: <1483984388-30237-1-git-send-email-jouni@qca.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01C.na.qualcomm.com (10.85.0.83) To euamsexm01e.eu.qualcomm.com (10.251.127.42) 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 From: vamsi krishna Add support to use a random local address (Address 2 = TA in transmit and the same address in receive functionality) for Public Action frames in order to improve privacy of WLAN clients. Applications fill the random transmit address in the frame buffer in the NL80211_CMD_FRAME command. This can be used only with the drivers that indicate support for random local address by setting the new NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA and/or NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED in ext_features. The driver needs to configure receive behavior to accept frames to the specified random address during the time the frame exchange is pending and such frames need to be acknowledged similarly to frames sent to the local permanent address when this random address functionality is not used. Signed-off-by: vamsi krishna Signed-off-by: Jouni Malinen --- include/uapi/linux/nl80211.h | 6 ++++++ net/wireless/mlme.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) v2: - remove unnecessary NL80211_ATTR_MGMT_TX_RANDOM_SA and allow address change based on the driver capability flag without requiring explicit per-frame indication from user space - rename "SA" to "TA" to be more accurate for the RX/ACK purposes diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 4e8bf28..ebed28e 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4727,6 +4727,10 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI: The driver supports sched_scan * for reporting BSSs with better RSSI than the current connected BSS * (%NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI). + * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA: This driver supports randomized TA + * in @NL80211_CMD_FRAME while not associated. + * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED: This driver supports + * randomized TA in @NL80211_CMD_FRAME while associated. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -4743,6 +4747,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_BEACON_RATE_VHT, NL80211_EXT_FEATURE_FILS_STA, NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI, + NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA, + NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 1c63a77..b876f40 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -662,8 +662,25 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, return err; } - if (!ether_addr_equal(mgmt->sa, wdev_address(wdev))) - return -EINVAL; + if (!ether_addr_equal(mgmt->sa, wdev_address(wdev))) { + /* Allow random TA to be used with Public Action frames if the + * driver has indicated support for this. Otherwise, only allow + * the local address to be used. + */ + if (!ieee80211_is_action(mgmt->frame_control) || + mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) + return -EINVAL; + if (!wdev->current_bss && + !wiphy_ext_feature_isset( + &rdev->wiphy, + NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA)) + return -EINVAL; + if (wdev->current_bss && + !wiphy_ext_feature_isset( + &rdev->wiphy, + NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED)) + return -EINVAL; + } /* Transmit the Action frame as requested by user space */ return rdev_mgmt_tx(rdev, wdev, params, cookie);