Use random MAC address for scanning only in non-connected state

cfg80211 rejects the scans issued with random MAC address if the STA is
in connected state. This resulted in failures when using MAC_RAND_SCAN
while connected (CTRL-EVENT-SCAN-FAILED ret=-95). Enable random MAC
address functionality only if the STA is not in connected state to avoid
this. The real MAC address of the STA is already revealed in the
association, so this is an acceptable fallback mechanism for now.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Srinivas Dasari 2016-11-21 17:40:36 +05:30 committed by Jouni Malinen
parent afe280539b
commit 346b333d9a

View file

@ -1047,7 +1047,8 @@ ssid_list_set:
}
#endif /* CONFIG_P2P */
if (wpa_s->mac_addr_rand_enable & MAC_ADDR_RAND_SCAN) {
if ((wpa_s->mac_addr_rand_enable & MAC_ADDR_RAND_SCAN) &&
wpa_s->wpa_state <= WPA_SCANNING) {
params.mac_addr_rand = 1;
if (wpa_s->mac_addr_scan) {
params.mac_addr = wpa_s->mac_addr_scan;
@ -1469,7 +1470,8 @@ scan:
wpa_setband_scan_freqs(wpa_s, scan_params);
if (wpa_s->mac_addr_rand_enable & MAC_ADDR_RAND_SCHED_SCAN) {
if ((wpa_s->mac_addr_rand_enable & MAC_ADDR_RAND_SCHED_SCAN) &&
wpa_s->wpa_state <= WPA_SCANNING) {
params.mac_addr_rand = 1;
if (wpa_s->mac_addr_sched_scan) {
params.mac_addr = wpa_s->mac_addr_sched_scan;
@ -2524,7 +2526,8 @@ int wpas_start_pno(struct wpa_supplicant *wpa_s)
params.freqs = wpa_s->manual_sched_scan_freqs;
}
if (wpa_s->mac_addr_rand_enable & MAC_ADDR_RAND_PNO) {
if ((wpa_s->mac_addr_rand_enable & MAC_ADDR_RAND_PNO) &&
wpa_s->wpa_state <= WPA_SCANNING) {
params.mac_addr_rand = 1;
if (wpa_s->mac_addr_pno) {
params.mac_addr = wpa_s->mac_addr_pno;