nl80211: Use attribute NL80211_ATTR_BSSID to scan for specific BSSID
With changes to optimize scan for specific BSSID, there arises a scenario where in nl80211_trigger_scan() is called with a scan randomization enabled. A combination of NL80211_ATTR_MAC for BSSID and scan randomization, which uses NL80211_ATTR_MAC for a different purpose, results in invalid error for the scan request. To fix the issue use attribute NL80211_ATTR_BSSID instead of NL80211_ATTR_MAC. NL80211_ATTR_BSSID was introduced in kernel commit 2fa436b3a2a7 ("nl80211: Use different attrs for BSSID and random MAC addr in scan req") in 2016. Prior to that, only NL80211_ATTR_MAC could be used for specifying the target BSSID. For backwards compatibility, add the NL80211_ATTR_MAC attribute as well when not using a random MAC address. Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
This commit is contained in:
parent
5bbc9462a0
commit
7ee7b046a9
1 changed files with 9 additions and 1 deletions
|
@ -385,7 +385,15 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss,
|
||||||
if (params->bssid) {
|
if (params->bssid) {
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Scan for a specific BSSID: "
|
wpa_printf(MSG_DEBUG, "nl80211: Scan for a specific BSSID: "
|
||||||
MACSTR, MAC2STR(params->bssid));
|
MACSTR, MAC2STR(params->bssid));
|
||||||
if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, params->bssid))
|
if (nla_put(msg, NL80211_ATTR_BSSID, ETH_ALEN, params->bssid))
|
||||||
|
goto fail;
|
||||||
|
/* NL80211_ATTR_MAC was used for this purpose initially and the
|
||||||
|
* NL80211_ATTR_BSSID was added in 2016 when MAC address
|
||||||
|
* randomization was added. For compatibility with older kernel
|
||||||
|
* versions, add the NL80211_ATTR_MAC attribute as well when
|
||||||
|
* the conflicting functionality is not in use. */
|
||||||
|
if (!params->mac_addr_rand &&
|
||||||
|
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, params->bssid))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue