scan: Use randomization flag only for active scans

This commit is contained in:
Tim Kourt 2019-04-11 13:56:06 -07:00 committed by Denis Kenzior
parent 91105768e0
commit b1d77d52b9
1 changed files with 5 additions and 4 deletions

View File

@ -300,7 +300,7 @@ static bool scan_mac_address_randomization_is_disabled(void)
} }
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, bool is_passive,
const struct scan_parameters *params) const struct scan_parameters *params)
{ {
struct l_genl_msg *msg; struct l_genl_msg *msg;
@ -321,7 +321,7 @@ 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 && if (!is_passive && params->randomize_mac_addr_hint &&
wiphy_can_randomize_mac_addr(sc->wiphy) && wiphy_can_randomize_mac_addr(sc->wiphy) &&
!scan_mac_address_randomization_is_disabled()) !scan_mac_address_randomization_is_disabled())
/* /*
@ -368,7 +368,8 @@ static bool scan_cmds_add_hidden(const struct network_info *network,
* The 'flush' flag is ignored, this allows to get the results * The 'flush' flag is ignored, this allows to get the results
* of all scans in the batch after the last scan is finished. * of all scans in the batch after the last scan is finished.
*/ */
*data->cmd = scan_build_cmd(data->sc, true, data->params); *data->cmd = scan_build_cmd(data->sc, true, false,
data->params);
l_genl_msg_enter_nested(*data->cmd, NL80211_ATTR_SCAN_SSIDS); l_genl_msg_enter_nested(*data->cmd, NL80211_ATTR_SCAN_SSIDS);
} }
@ -388,7 +389,7 @@ static void scan_cmds_add(struct l_queue *cmds, struct scan_context *sc,
wiphy_get_max_num_ssids_per_scan(sc->wiphy), wiphy_get_max_num_ssids_per_scan(sc->wiphy),
}; };
cmd = scan_build_cmd(sc, false, params); cmd = scan_build_cmd(sc, false, passive, params);
if (passive) { if (passive) {
/* passive scan */ /* passive scan */