]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cfg80211: Add support for randomizing TA of Public Action frames
authorvamsi krishna <vamsin@qti.qualcomm.com>
Thu, 12 Jan 2017 23:12:19 +0000 (01:12 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 13 Jan 2017 08:39:47 +0000 (09:39 +0100)
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 <vamsin@qti.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/uapi/linux/nl80211.h
net/wireless/mlme.c

index 174f4b30e804c3db11b490055f64f51409f62caf..908886c8389490ae5593c03ed7cc6775806c4dd1 100644 (file)
@@ -4699,6 +4699,10 @@ enum nl80211_feature_flags {
  *     configuration (AP/mesh) with VHT rates.
  * @NL80211_EXT_FEATURE_FILS_STA: This driver supports Fast Initial Link Setup
  *     with user space SME (NL80211_CMD_AUTHENTICATE) in station mode.
+ * @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.
@@ -4714,6 +4718,8 @@ enum nl80211_ext_feature_index {
        NL80211_EXT_FEATURE_BEACON_RATE_HT,
        NL80211_EXT_FEATURE_BEACON_RATE_VHT,
        NL80211_EXT_FEATURE_FILS_STA,
+       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,
index 1c63a77aea3482ff6c4f5aea5405727a3b2122d0..b876f40c9dada536c4847ff9f49a665aa0bd1ce0 100644 (file)
@@ -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);