commit 9335680cd8eebbe87ea329fba278cc858a606df4
parent aa3dc1b95348dea177e9d8c2c3063b29e20fe2e9
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Wed, 9 Sep 2020 01:49:18 +0200
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.
Diffstat:
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/scan.c b/src/scan.c
@@ -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;
diff --git a/src/scan.h b/src/scan.h
@@ -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,