wpa_supplicant(hidl): Turn on scan MAC randomization
Even though we moved scan handling to wificond, wpa_supplicant may
issue scans on its own in certain connection-related scenarios.
Ensure that we only use randomized scans in those cases on Android
devices.
Bug: 73642801
Test: Ensured that we can connect to wifi networks.
Test: Triggered scans via wpa_cli and ensured they use random MAC
addresses.
Change-Id: I95d0e021db7f4ec22ec13720f3a2de578e63f0a6
diff --git a/wpa_supplicant/hidl/1.1/hidl_manager.cpp b/wpa_supplicant/hidl/1.1/hidl_manager.cpp
index ca614d2..2798e35 100644
--- a/wpa_supplicant/hidl/1.1/hidl_manager.cpp
+++ b/wpa_supplicant/hidl/1.1/hidl_manager.cpp
@@ -14,6 +14,7 @@
#include "misc_utils.h"
extern "C" {
+#include "scan.h"
#include "src/eap_common/eap_sim_common.h"
}
@@ -470,6 +471,16 @@
}
sta_iface_callbacks_map_[wpa_s->ifname] =
std::vector<android::sp<ISupplicantStaIfaceCallback>>();
+ // Turn on Android specific customizations for STA interfaces
+ // here!
+ //
+ // Turn on scan randomization.
+ if (wpas_mac_addr_rand_scan_set(
+ wpa_s, MAC_ADDR_RAND_SCAN, nullptr, nullptr)) {
+ wpa_printf(
+ MSG_ERROR,
+ "Failed to enable scan mac randomization");
+ }
}
// Invoke the |onInterfaceCreated| method on all registered callbacks.