nl80211: add scan features for improved scan privacy
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 May 2018 13:47:40 +0000 (15:47 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Fri, 15 Jun 2018 11:34:33 +0000 (13:34 +0200)
Add the scan flags for randomized SN and minimized probe request
content for improved scan privacy.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index 28b3654..49f718e 100644 (file)
@@ -5133,6 +5133,11 @@ enum nl80211_feature_flags {
  *     support to nl80211.
  * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate
  *      TXQs.
+ * @NL80211_EXT_FEATURE_SCAN_RANDOM_SN: Driver/device supports randomizing the
+ *     SN in probe request frames if requested by %NL80211_SCAN_FLAG_RANDOM_SN.
+ * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data
+ *     except for supported rates from the probe request content if requested
+ *     by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag.
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5167,6 +5172,8 @@ enum nl80211_ext_feature_index {
        NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211,
        NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT,
        NL80211_EXT_FEATURE_TXQS,
+       NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
+       NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
 
        /* add new features before the definition below */
        NUM_NL80211_EXT_FEATURES,
@@ -5272,6 +5279,12 @@ enum nl80211_timeout_reason {
  *     possible scan results. This flag hints the driver to use the best
  *     possible scan configuration to improve the accuracy in scanning.
  *     Latency and power use may get impacted with this flag.
+ * @NL80211_SCAN_FLAG_RANDOM_SN: randomize the sequence number in probe
+ *     request frames from this scan to avoid correlation/tracking being
+ *     possible.
+ * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to
+ *     only have supported rates and no additional capabilities (unless
+ *     added by userspace explicitly.)
  */
 enum nl80211_scan_flags {
        NL80211_SCAN_FLAG_LOW_PRIORITY                          = 1<<0,
@@ -5285,6 +5298,8 @@ enum nl80211_scan_flags {
        NL80211_SCAN_FLAG_LOW_SPAN                              = 1<<8,
        NL80211_SCAN_FLAG_LOW_POWER                             = 1<<9,
        NL80211_SCAN_FLAG_HIGH_ACCURACY                         = 1<<10,
+       NL80211_SCAN_FLAG_RANDOM_SN                             = 1<<11,
+       NL80211_SCAN_FLAG_MIN_PREQ_CONTENT                      = 1<<12,
 };
 
 /**
index 6c3ded1..d267725 100644 (file)
@@ -6925,7 +6925,13 @@ nl80211_check_scan_flags(struct wiphy *wiphy, struct wireless_dev *wdev,
                                     NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION) ||
            !nl80211_check_scan_feat(wiphy, *flags,
                                     NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE,
-                                    NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE))
+                                    NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE) ||
+           !nl80211_check_scan_feat(wiphy, *flags,
+                                    NL80211_SCAN_FLAG_RANDOM_SN,
+                                    NL80211_EXT_FEATURE_SCAN_RANDOM_SN) ||
+           !nl80211_check_scan_feat(wiphy, *flags,
+                                    NL80211_SCAN_FLAG_MIN_PREQ_CONTENT,
+                                    NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT))
                return -EOPNOTSUPP;
 
        if (*flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {