diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2012-02-28 01:04:15 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-05 15:23:13 -0500 |
commit | be0b281e8f7afd56d2250a568b85dafc850bc9ae (patch) | |
tree | 8477ec08085bde90c7b99e3070db50309e4a22fc /drivers/net/wireless/mwifiex/scan.c | |
parent | b9be5f39bdabb25708a9de294c2cae7bdd8dfb17 (diff) |
mwifiex: fix bug in wildcard scan handling
Currently if valid SSID list is provided in scan request, driver
performs specific SSID scan otherwise wildcard scan is chosen.
When wpa_supplicant provides valid SSID list followed by
zero-length SSID for wildcard scan, only specific SSID scan is
performed by driver. Actually driver is expected to do both type
of scanning in this case. The patch fixes this issue.
Also, use SSID list pointer provided by stack directly, instead
of copying SSID's to local structure.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 67422f64f9fe..fd0302fe5bd8 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -737,7 +737,7 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, | |||
737 | u16 scan_dur; | 737 | u16 scan_dur; |
738 | u8 channel; | 738 | u8 channel; |
739 | u8 radio_type; | 739 | u8 radio_type; |
740 | u32 ssid_idx; | 740 | int i; |
741 | u8 ssid_filter; | 741 | u8 ssid_filter; |
742 | u8 rates[MWIFIEX_SUPPORTED_RATES]; | 742 | u8 rates[MWIFIEX_SUPPORTED_RATES]; |
743 | u32 rates_size; | 743 | u32 rates_size; |
@@ -792,14 +792,8 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, | |||
792 | user_scan_in->specific_bssid, | 792 | user_scan_in->specific_bssid, |
793 | sizeof(scan_cfg_out->specific_bssid)); | 793 | sizeof(scan_cfg_out->specific_bssid)); |
794 | 794 | ||
795 | for (ssid_idx = 0; | 795 | for (i = 0; i < user_scan_in->num_ssids; i++) { |
796 | ((ssid_idx < ARRAY_SIZE(user_scan_in->ssid_list)) | 796 | ssid_len = user_scan_in->ssid_list[i].ssid_len; |
797 | && (*user_scan_in->ssid_list[ssid_idx].ssid | ||
798 | || user_scan_in->ssid_list[ssid_idx].max_len)); | ||
799 | ssid_idx++) { | ||
800 | |||
801 | ssid_len = strlen(user_scan_in->ssid_list[ssid_idx]. | ||
802 | ssid) + 1; | ||
803 | 797 | ||
804 | wildcard_ssid_tlv = | 798 | wildcard_ssid_tlv = |
805 | (struct mwifiex_ie_types_wildcard_ssid_params *) | 799 | (struct mwifiex_ie_types_wildcard_ssid_params *) |
@@ -810,19 +804,26 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, | |||
810 | (u16) (ssid_len + sizeof(wildcard_ssid_tlv-> | 804 | (u16) (ssid_len + sizeof(wildcard_ssid_tlv-> |
811 | max_ssid_length))); | 805 | max_ssid_length))); |
812 | 806 | ||
813 | /* max_ssid_length = 0 tells firmware to perform | 807 | /* |
814 | specific scan for the SSID filled */ | 808 | * max_ssid_length = 0 tells firmware to perform |
815 | wildcard_ssid_tlv->max_ssid_length = 0; | 809 | * specific scan for the SSID filled, whereas |
810 | * max_ssid_length = IEEE80211_MAX_SSID_LEN is for | ||
811 | * wildcard scan. | ||
812 | */ | ||
813 | if (ssid_len) | ||
814 | wildcard_ssid_tlv->max_ssid_length = 0; | ||
815 | else | ||
816 | wildcard_ssid_tlv->max_ssid_length = | ||
817 | IEEE80211_MAX_SSID_LEN; | ||
816 | 818 | ||
817 | memcpy(wildcard_ssid_tlv->ssid, | 819 | memcpy(wildcard_ssid_tlv->ssid, |
818 | user_scan_in->ssid_list[ssid_idx].ssid, | 820 | user_scan_in->ssid_list[i].ssid, ssid_len); |
819 | ssid_len); | ||
820 | 821 | ||
821 | tlv_pos += (sizeof(wildcard_ssid_tlv->header) | 822 | tlv_pos += (sizeof(wildcard_ssid_tlv->header) |
822 | + le16_to_cpu(wildcard_ssid_tlv->header.len)); | 823 | + le16_to_cpu(wildcard_ssid_tlv->header.len)); |
823 | 824 | ||
824 | dev_dbg(adapter->dev, "info: scan: ssid_list[%d]: %s, %d\n", | 825 | dev_dbg(adapter->dev, "info: scan: ssid[%d]: %s, %d\n", |
825 | ssid_idx, wildcard_ssid_tlv->ssid, | 826 | i, wildcard_ssid_tlv->ssid, |
826 | wildcard_ssid_tlv->max_ssid_length); | 827 | wildcard_ssid_tlv->max_ssid_length); |
827 | 828 | ||
828 | /* Empty wildcard ssid with a maxlen will match many or | 829 | /* Empty wildcard ssid with a maxlen will match many or |
@@ -831,7 +832,6 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, | |||
831 | filtered. */ | 832 | filtered. */ |
832 | if (!ssid_len && wildcard_ssid_tlv->max_ssid_length) | 833 | if (!ssid_len && wildcard_ssid_tlv->max_ssid_length) |
833 | ssid_filter = false; | 834 | ssid_filter = false; |
834 | |||
835 | } | 835 | } |
836 | 836 | ||
837 | /* | 837 | /* |
@@ -840,7 +840,7 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, | |||
840 | * truncate scan results. That is not an issue with an SSID | 840 | * truncate scan results. That is not an issue with an SSID |
841 | * or BSSID filter applied to the scan results in the firmware. | 841 | * or BSSID filter applied to the scan results in the firmware. |
842 | */ | 842 | */ |
843 | if ((ssid_idx && ssid_filter) | 843 | if ((i && ssid_filter) |
844 | || memcmp(scan_cfg_out->specific_bssid, &zero_mac, | 844 | || memcmp(scan_cfg_out->specific_bssid, &zero_mac, |
845 | sizeof(zero_mac))) | 845 | sizeof(zero_mac))) |
846 | *filtered_scan = true; | 846 | *filtered_scan = true; |
@@ -1876,8 +1876,8 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, | |||
1876 | return -ENOMEM; | 1876 | return -ENOMEM; |
1877 | } | 1877 | } |
1878 | 1878 | ||
1879 | memcpy(scan_cfg->ssid_list[0].ssid, req_ssid->ssid, | 1879 | scan_cfg->ssid_list = req_ssid; |
1880 | req_ssid->ssid_len); | 1880 | scan_cfg->num_ssids = 1; |
1881 | 1881 | ||
1882 | ret = mwifiex_scan_networks(priv, scan_cfg); | 1882 | ret = mwifiex_scan_networks(priv, scan_cfg); |
1883 | 1883 | ||