nl80211: Add an option to specify the BSSID to scan for
This allows scans to be optimized when a response is needed only from a single, known BSS. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
452874a9df
commit
eb20cea590
3 changed files with 29 additions and 0 deletions
|
@ -439,6 +439,15 @@ struct wpa_driver_scan_params {
|
||||||
*/
|
*/
|
||||||
unsigned int sched_scan_plans_num;
|
unsigned int sched_scan_plans_num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bssid - Specific BSSID to scan for
|
||||||
|
*
|
||||||
|
* This optional parameter can be used to replace the default wildcard
|
||||||
|
* BSSID with a specific BSSID to scan for if results are needed from
|
||||||
|
* only a single BSS.
|
||||||
|
*/
|
||||||
|
const u8 *bssid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: Whenever adding new parameters here, please make sure
|
* NOTE: Whenever adding new parameters here, please make sure
|
||||||
* wpa_scan_clone_params() and wpa_scan_free_params() get updated with
|
* wpa_scan_clone_params() and wpa_scan_free_params() get updated with
|
||||||
|
|
|
@ -257,6 +257,13 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params->bssid) {
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: Scan for a specific BSSID: "
|
||||||
|
MACSTR, MAC2STR(params->bssid));
|
||||||
|
if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, params->bssid))
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||||
msg = NULL;
|
msg = NULL;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
@ -2259,6 +2259,17 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src)
|
||||||
params->mac_addr_mask = mac_addr + ETH_ALEN;
|
params->mac_addr_mask = mac_addr + ETH_ALEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->bssid) {
|
||||||
|
u8 *bssid;
|
||||||
|
|
||||||
|
bssid = os_malloc(ETH_ALEN);
|
||||||
|
if (!bssid)
|
||||||
|
goto failed;
|
||||||
|
os_memcpy(bssid, src->bssid, ETH_ALEN);
|
||||||
|
params->bssid = bssid;
|
||||||
|
}
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
@ -2287,6 +2298,8 @@ void wpa_scan_free_params(struct wpa_driver_scan_params *params)
|
||||||
*/
|
*/
|
||||||
os_free((u8 *) params->mac_addr);
|
os_free((u8 *) params->mac_addr);
|
||||||
|
|
||||||
|
os_free((u8 *) params->bssid);
|
||||||
|
|
||||||
os_free(params);
|
os_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue