Commit 21b2d8bd authored by Samuel Ortiz's avatar Samuel Ortiz Committed by John W. Linville

iwlwifi: Send broadcast probe request only when asked to

When running directed active scans we currently end up sending both the SSID
probe requests and an additional broadcast one.
This is due to the fact that we always leave the probe request template SSID IE
length to 0. Instead we should set it to the first SSID to scan, and fill the
direct_scan array with the remaining SSIDs to scan for. This way we only send
what we've been asked to: a broadcast probe request when no directed scan is
requested, and directed probe requests otherwise.
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ed56a3f1
...@@ -2631,7 +2631,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv) ...@@ -2631,7 +2631,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv)
*/ */
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX + 1;
/* we create the 802.11 header and a zero-length SSID element */ /* we create the 802.11 header and a zero-length SSID element */
hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2;
......
...@@ -651,9 +651,20 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, ...@@ -651,9 +651,20 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
if (left < 0) if (left < 0)
return 0; return 0;
*pos++ = WLAN_EID_SSID; *pos++ = WLAN_EID_SSID;
*pos++ = 0; if (!priv->is_internal_short_scan &&
priv->scan_request->n_ssids) {
len += 2; struct cfg80211_ssid *ssid =
priv->scan_request->ssids;
/* Broadcast if ssid_len is 0 */
*pos++ = ssid->ssid_len;
memcpy(pos, ssid->ssid, ssid->ssid_len);
pos += ssid->ssid_len;
len += 2 + ssid->ssid_len;
} else {
*pos++ = 0;
len += 2;
}
if (WARN_ON(left < ie_len)) if (WARN_ON(left < ie_len))
return len; return len;
...@@ -782,20 +793,26 @@ static void iwl_bg_request_scan(struct work_struct *data) ...@@ -782,20 +793,26 @@ static void iwl_bg_request_scan(struct work_struct *data)
if (priv->is_internal_short_scan) { if (priv->is_internal_short_scan) {
IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
} else if (priv->scan_request->n_ssids) { } else if (priv->scan_request->n_ssids) {
int i, p = 0;
IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
for (i = 0; i < priv->scan_request->n_ssids; i++) { /*
/* always does wildcard anyway */ * The first SSID to scan is stuffed into the probe request
if (!priv->scan_request->ssids[i].ssid_len) * template and the remaining ones are handled through the
continue; * direct_scan array.
scan->direct_scan[p].id = WLAN_EID_SSID; */
scan->direct_scan[p].len = if (priv->scan_request->n_ssids > 1) {
priv->scan_request->ssids[i].ssid_len; int i, p = 0;
memcpy(scan->direct_scan[p].ssid, for (i = 1; i < priv->scan_request->n_ssids; i++) {
priv->scan_request->ssids[i].ssid, if (!priv->scan_request->ssids[i].ssid_len)
priv->scan_request->ssids[i].ssid_len); continue;
n_probes++; scan->direct_scan[p].id = WLAN_EID_SSID;
p++; scan->direct_scan[p].len =
priv->scan_request->ssids[i].ssid_len;
memcpy(scan->direct_scan[p].ssid,
priv->scan_request->ssids[i].ssid,
priv->scan_request->ssids[i].ssid_len);
n_probes++;
p++;
}
} }
is_active = true; is_active = true;
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment