summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Caruso <ejcaruso@google.com>2016-06-17 17:47:06 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-17 17:47:06 +0000
commitef28b667abed2134b5e537d739c8d114d95f90e9 (patch)
tree5cbb7e2420cd9a48633e71ad91ca1464cf927d8c
parent1671bcdd215e2e52fc411adf3118a49c2ad2f60c (diff)
parent197d69b1cd6fdb3459fe66e62874ab0e5ae03504 (diff)
downloadshill-ef28b667abed2134b5e537d739c8d114d95f90e9.tar.gz
wifi: do not send random MAC request until supplicant appears am: c65e95eb77
am: 197d69b1cd Change-Id: If3ab1ec7b3fdd31495da1727216b4db8796fe95b
-rw-r--r--wifi/wifi.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/wifi/wifi.cc b/wifi/wifi.cc
index a8577f50..9bcda61a 100644
--- a/wifi/wifi.cc
+++ b/wifi/wifi.cc
@@ -762,6 +762,11 @@ bool WiFi::GetRandomMACEnabled(Error* /*error*/) {
}
bool WiFi::SetRandomMACEnabled(const bool& enabled, Error* error) {
+ if (!supplicant_present_ || !supplicant_interface_proxy_.get()) {
+ SLOG(this, 2) << "Ignoring random MAC while supplicant is not present.";
+ return false;
+ }
+
if (!random_mac_supported_) {
Error::PopulateAndLog(FROM_HERE, error, Error::kNotSupported,
"This WiFi device does not support MAC address randomization");
@@ -2329,6 +2334,13 @@ void WiFi::ConnectToSupplicant() {
<< "May be running an older version of wpa_supplicant.";
}
+ if (random_mac_enabled_ &&
+ !supplicant_interface_proxy_->EnableMACAddressRandomization(
+ kRandomMACMask)) {
+ LOG(ERROR) << "Failed to enable MAC address randomization. "
+ << "May be running an older version of wpa_supplicant.";
+ }
+
Scan(kFullScan, nullptr, __func__);
StartScanTimer();
}