3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

scan: Enable the usage of MAC randomization flag

This commit is contained in:
Tim Kourt 2019-01-15 19:14:55 -08:00 committed by Denis Kenzior
parent 81d570572e
commit 71b10ab271

View File

@ -306,6 +306,19 @@ static void scan_freq_count(uint32_t freq, void *user_data)
*count += 1; *count += 1;
} }
static bool scan_mac_address_randomization_is_disabled(void)
{
const struct l_settings *config = iwd_get_config();
bool disabled;
if (!l_settings_get_bool(config, "Scan",
"disable_mac_address_randomization",
&disabled))
return false;
return disabled;
}
static struct l_genl_msg *scan_build_cmd(struct scan_context *sc, static struct l_genl_msg *scan_build_cmd(struct scan_context *sc,
bool ignore_flush_flag, bool ignore_flush_flag,
const struct scan_parameters *params) const struct scan_parameters *params)
@ -335,20 +348,14 @@ static struct l_genl_msg *scan_build_cmd(struct scan_context *sc,
if (params->flush && !ignore_flush_flag) if (params->flush && !ignore_flush_flag)
flags |= NL80211_SCAN_FLAG_FLUSH; flags |= NL80211_SCAN_FLAG_FLUSH;
if (params->randomize_mac_addr_hint &&
wiphy_can_randomize_mac_addr(sc->wiphy) &&
!scan_mac_address_randomization_is_disabled())
/* /*
* TODO: Discovery of the hidden networks with randomization flag set
* works with real hardware, but fails when used in simulated
* environment with mac80211_hwsim. This needs to be investigated.
*
* if (params->randomize_mac_addr_hint &&
* wiphy_has_feature(sc->wiphy,
* NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR))
*
* Randomizing 46 bits (locally administered 1 and multicast 0 * Randomizing 46 bits (locally administered 1 and multicast 0
* is assumed). * is assumed).
*
* flags |= NL80211_SCAN_FLAG_RANDOM_ADDR;
*/ */
flags |= NL80211_SCAN_FLAG_RANDOM_ADDR;
if (flags) if (flags)
l_genl_msg_append_attr(msg, NL80211_ATTR_SCAN_FLAGS, 4, &flags); l_genl_msg_append_attr(msg, NL80211_ATTR_SCAN_FLAGS, 4, &flags);