summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Caruso <ejcaruso@google.com>2016-06-17 17:44:21 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-17 17:44:21 +0000
commit197d69b1cd6fdb3459fe66e62874ab0e5ae03504 (patch)
tree5cbb7e2420cd9a48633e71ad91ca1464cf927d8c
parent7ffb4b81bd40c29d2f6ad73cb6d53e7d2b2c307b (diff)
parentc65e95eb7742f228e495f44c1ce03f7de8b7c6d1 (diff)
downloadshill-197d69b1cd6fdb3459fe66e62874ab0e5ae03504.tar.gz
wifi: do not send random MAC request until supplicant appears
am: c65e95eb77 Change-Id: Iff4d7eaf605f63e50d93f15d5bcbf66ae872532b
-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();
}