diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2010-02-05 14:33:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-08 16:50:58 -0500 |
commit | 21b2d8bd2f0d4e0f21ade147fd193c8b9c1fd2b9 (patch) | |
tree | d69fedb037aa95d112adfae2847be13fbccf1d4d | |
parent | ed56a3f15a0561e900957ecca0dee42b9b453a9e (diff) |
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: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 49 |
2 files changed, 34 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b528a20ade4f..f51b8cd80de5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2631,7 +2631,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv) | |||
2631 | */ | 2631 | */ |
2632 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 2632 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
2633 | 2633 | ||
2634 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | 2634 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX + 1; |
2635 | /* we create the 802.11 header and a zero-length SSID element */ | 2635 | /* we create the 802.11 header and a zero-length SSID element */ |
2636 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 2636 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; |
2637 | 2637 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 08faafae8497..f786a407638f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -651,9 +651,20 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, | |||
651 | if (left < 0) | 651 | if (left < 0) |
652 | return 0; | 652 | return 0; |
653 | *pos++ = WLAN_EID_SSID; | 653 | *pos++ = WLAN_EID_SSID; |
654 | *pos++ = 0; | 654 | if (!priv->is_internal_short_scan && |
655 | 655 | priv->scan_request->n_ssids) { | |
656 | len += 2; | 656 | struct cfg80211_ssid *ssid = |
657 | priv->scan_request->ssids; | ||
658 | |||
659 | /* Broadcast if ssid_len is 0 */ | ||
660 | *pos++ = ssid->ssid_len; | ||
661 | memcpy(pos, ssid->ssid, ssid->ssid_len); | ||
662 | pos += ssid->ssid_len; | ||
663 | len += 2 + ssid->ssid_len; | ||
664 | } else { | ||
665 | *pos++ = 0; | ||
666 | len += 2; | ||
667 | } | ||
657 | 668 | ||
658 | if (WARN_ON(left < ie_len)) | 669 | if (WARN_ON(left < ie_len)) |
659 | return len; | 670 | return len; |
@@ -782,20 +793,26 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
782 | if (priv->is_internal_short_scan) { | 793 | if (priv->is_internal_short_scan) { |
783 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); | 794 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); |
784 | } else if (priv->scan_request->n_ssids) { | 795 | } else if (priv->scan_request->n_ssids) { |
785 | int i, p = 0; | ||
786 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); | 796 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); |
787 | for (i = 0; i < priv->scan_request->n_ssids; i++) { | 797 | /* |
788 | /* always does wildcard anyway */ | 798 | * The first SSID to scan is stuffed into the probe request |
789 | if (!priv->scan_request->ssids[i].ssid_len) | 799 | * template and the remaining ones are handled through the |
790 | continue; | 800 | * direct_scan array. |
791 | scan->direct_scan[p].id = WLAN_EID_SSID; | 801 | */ |
792 | scan->direct_scan[p].len = | 802 | if (priv->scan_request->n_ssids > 1) { |
793 | priv->scan_request->ssids[i].ssid_len; | 803 | int i, p = 0; |
794 | memcpy(scan->direct_scan[p].ssid, | 804 | for (i = 1; i < priv->scan_request->n_ssids; i++) { |
795 | priv->scan_request->ssids[i].ssid, | 805 | if (!priv->scan_request->ssids[i].ssid_len) |
796 | priv->scan_request->ssids[i].ssid_len); | 806 | continue; |
797 | n_probes++; | 807 | scan->direct_scan[p].id = WLAN_EID_SSID; |
798 | p++; | 808 | scan->direct_scan[p].len = |
809 | priv->scan_request->ssids[i].ssid_len; | ||
810 | memcpy(scan->direct_scan[p].ssid, | ||
811 | priv->scan_request->ssids[i].ssid, | ||
812 | priv->scan_request->ssids[i].ssid_len); | ||
813 | n_probes++; | ||
814 | p++; | ||
815 | } | ||
799 | } | 816 | } |
800 | is_active = true; | 817 | is_active = true; |
801 | } else | 818 | } else |