3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

scan: Add optional source_mac scan parameter

This is similar to randomize_mac_addr_hint but it sets a specific source
MAC address for our probe frames.
This commit is contained in:
Andrew Zaborowski 2020-09-09 01:49:18 +02:00 committed by Denis Kenzior
parent aa3dc1b953
commit 9335680cd8
2 changed files with 13 additions and 0 deletions

View File

@ -361,6 +361,18 @@ static struct l_genl_msg *scan_build_cmd(struct scan_context *sc,
*/
flags |= NL80211_SCAN_FLAG_RANDOM_ADDR;
if (!is_passive && params->source_mac &&
wiphy_can_randomize_mac_addr(sc->wiphy)) {
static const uint8_t mask[6] = /* No random bits */
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
flags |= NL80211_SCAN_FLAG_RANDOM_ADDR;
l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, 6,
params->source_mac);
l_genl_msg_append_attr(msg, NL80211_ATTR_MAC_MASK, 6,
mask);
}
if (!is_passive && wiphy_has_ext_feature(sc->wiphy,
NL80211_EXT_FEATURE_SCAN_RANDOM_SN))
flags |= NL80211_SCAN_FLAG_RANDOM_SN;

View File

@ -104,6 +104,7 @@ struct scan_parameters {
bool no_cck_rates : 1;
bool duration_mandatory : 1;
const char *ssid; /* Used for direct probe request */
const uint8_t *source_mac;
};
static inline int scan_bss_addr_cmp(const struct scan_bss *a1,