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>
This commit is contained in:
parent
b9be5f39bd
commit
be0b281e8f
|
@ -1106,12 +1106,10 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev,
|
||||||
dev_err(priv->adapter->dev, "failed to alloc scan_req\n");
|
dev_err(priv->adapter->dev, "failed to alloc scan_req\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
for (i = 0; i < request->n_ssids; i++) {
|
|
||||||
memcpy(priv->user_scan_cfg->ssid_list[i].ssid,
|
priv->user_scan_cfg->num_ssids = request->n_ssids;
|
||||||
request->ssids[i].ssid, request->ssids[i].ssid_len);
|
priv->user_scan_cfg->ssid_list = request->ssids;
|
||||||
priv->user_scan_cfg->ssid_list[i].max_len =
|
|
||||||
request->ssids[i].ssid_len;
|
|
||||||
}
|
|
||||||
for (i = 0; i < request->n_channels; i++) {
|
for (i = 0; i < request->n_channels; i++) {
|
||||||
chan = request->channels[i];
|
chan = request->channels[i];
|
||||||
priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
|
priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
|
||||||
|
|
|
@ -852,11 +852,6 @@ struct mwifiex_user_scan_chan {
|
||||||
u32 scan_time;
|
u32 scan_time;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct mwifiex_user_scan_ssid {
|
|
||||||
u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
|
|
||||||
u8 max_len;
|
|
||||||
} __packed;
|
|
||||||
|
|
||||||
struct mwifiex_user_scan_cfg {
|
struct mwifiex_user_scan_cfg {
|
||||||
/*
|
/*
|
||||||
* BSS mode to be sent in the firmware command
|
* BSS mode to be sent in the firmware command
|
||||||
|
@ -867,8 +862,9 @@ struct mwifiex_user_scan_cfg {
|
||||||
u8 reserved;
|
u8 reserved;
|
||||||
/* BSSID filter sent in the firmware command to limit the results */
|
/* BSSID filter sent in the firmware command to limit the results */
|
||||||
u8 specific_bssid[ETH_ALEN];
|
u8 specific_bssid[ETH_ALEN];
|
||||||
/* SSID filter list used in the to limit the scan results */
|
/* SSID filter list used in the firmware to limit the scan results */
|
||||||
struct mwifiex_user_scan_ssid ssid_list[MWIFIEX_MAX_SSID_LIST_LENGTH];
|
struct cfg80211_ssid *ssid_list;
|
||||||
|
u8 num_ssids;
|
||||||
/* Variable number (fixed maximum) of channels to scan up */
|
/* Variable number (fixed maximum) of channels to scan up */
|
||||||
struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
|
struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
|
@ -737,7 +737,7 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
|
||||||
u16 scan_dur;
|
u16 scan_dur;
|
||||||
u8 channel;
|
u8 channel;
|
||||||
u8 radio_type;
|
u8 radio_type;
|
||||||
u32 ssid_idx;
|
int i;
|
||||||
u8 ssid_filter;
|
u8 ssid_filter;
|
||||||
u8 rates[MWIFIEX_SUPPORTED_RATES];
|
u8 rates[MWIFIEX_SUPPORTED_RATES];
|
||||||
u32 rates_size;
|
u32 rates_size;
|
||||||
|
@ -792,14 +792,8 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
|
||||||
user_scan_in->specific_bssid,
|
user_scan_in->specific_bssid,
|
||||||
sizeof(scan_cfg_out->specific_bssid));
|
sizeof(scan_cfg_out->specific_bssid));
|
||||||
|
|
||||||
for (ssid_idx = 0;
|
for (i = 0; i < user_scan_in->num_ssids; i++) {
|
||||||
((ssid_idx < ARRAY_SIZE(user_scan_in->ssid_list))
|
ssid_len = user_scan_in->ssid_list[i].ssid_len;
|
||||||
&& (*user_scan_in->ssid_list[ssid_idx].ssid
|
|
||||||
|| user_scan_in->ssid_list[ssid_idx].max_len));
|
|
||||||
ssid_idx++) {
|
|
||||||
|
|
||||||
ssid_len = strlen(user_scan_in->ssid_list[ssid_idx].
|
|
||||||
ssid) + 1;
|
|
||||||
|
|
||||||
wildcard_ssid_tlv =
|
wildcard_ssid_tlv =
|
||||||
(struct mwifiex_ie_types_wildcard_ssid_params *)
|
(struct mwifiex_ie_types_wildcard_ssid_params *)
|
||||||
|
@ -810,19 +804,26 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
|
||||||
(u16) (ssid_len + sizeof(wildcard_ssid_tlv->
|
(u16) (ssid_len + sizeof(wildcard_ssid_tlv->
|
||||||
max_ssid_length)));
|
max_ssid_length)));
|
||||||
|
|
||||||
/* max_ssid_length = 0 tells firmware to perform
|
/*
|
||||||
specific scan for the SSID filled */
|
* max_ssid_length = 0 tells firmware to perform
|
||||||
wildcard_ssid_tlv->max_ssid_length = 0;
|
* specific scan for the SSID filled, whereas
|
||||||
|
* max_ssid_length = IEEE80211_MAX_SSID_LEN is for
|
||||||
|
* wildcard scan.
|
||||||
|
*/
|
||||||
|
if (ssid_len)
|
||||||
|
wildcard_ssid_tlv->max_ssid_length = 0;
|
||||||
|
else
|
||||||
|
wildcard_ssid_tlv->max_ssid_length =
|
||||||
|
IEEE80211_MAX_SSID_LEN;
|
||||||
|
|
||||||
memcpy(wildcard_ssid_tlv->ssid,
|
memcpy(wildcard_ssid_tlv->ssid,
|
||||||
user_scan_in->ssid_list[ssid_idx].ssid,
|
user_scan_in->ssid_list[i].ssid, ssid_len);
|
||||||
ssid_len);
|
|
||||||
|
|
||||||
tlv_pos += (sizeof(wildcard_ssid_tlv->header)
|
tlv_pos += (sizeof(wildcard_ssid_tlv->header)
|
||||||
+ le16_to_cpu(wildcard_ssid_tlv->header.len));
|
+ le16_to_cpu(wildcard_ssid_tlv->header.len));
|
||||||
|
|
||||||
dev_dbg(adapter->dev, "info: scan: ssid_list[%d]: %s, %d\n",
|
dev_dbg(adapter->dev, "info: scan: ssid[%d]: %s, %d\n",
|
||||||
ssid_idx, wildcard_ssid_tlv->ssid,
|
i, wildcard_ssid_tlv->ssid,
|
||||||
wildcard_ssid_tlv->max_ssid_length);
|
wildcard_ssid_tlv->max_ssid_length);
|
||||||
|
|
||||||
/* Empty wildcard ssid with a maxlen will match many or
|
/* Empty wildcard ssid with a maxlen will match many or
|
||||||
|
@ -831,7 +832,6 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
|
||||||
filtered. */
|
filtered. */
|
||||||
if (!ssid_len && wildcard_ssid_tlv->max_ssid_length)
|
if (!ssid_len && wildcard_ssid_tlv->max_ssid_length)
|
||||||
ssid_filter = false;
|
ssid_filter = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -840,7 +840,7 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
|
||||||
* truncate scan results. That is not an issue with an SSID
|
* truncate scan results. That is not an issue with an SSID
|
||||||
* or BSSID filter applied to the scan results in the firmware.
|
* or BSSID filter applied to the scan results in the firmware.
|
||||||
*/
|
*/
|
||||||
if ((ssid_idx && ssid_filter)
|
if ((i && ssid_filter)
|
||||||
|| memcmp(scan_cfg_out->specific_bssid, &zero_mac,
|
|| memcmp(scan_cfg_out->specific_bssid, &zero_mac,
|
||||||
sizeof(zero_mac)))
|
sizeof(zero_mac)))
|
||||||
*filtered_scan = true;
|
*filtered_scan = true;
|
||||||
|
@ -1876,8 +1876,8 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(scan_cfg->ssid_list[0].ssid, req_ssid->ssid,
|
scan_cfg->ssid_list = req_ssid;
|
||||||
req_ssid->ssid_len);
|
scan_cfg->num_ssids = 1;
|
||||||
|
|
||||||
ret = mwifiex_scan_networks(priv, scan_cfg);
|
ret = mwifiex_scan_networks(priv, scan_cfg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue