shill: add RekeyInProgress WiFi device property
Expose the is_rekey_in_progress_ flag via D-Bus so that clients know
when a rekey is happening (e.g. for testing purposes).
BUG=b:171086223
TEST=unit tests
TEST=wifi.PTK, used dbus-monitor to watch property changes
Change-Id: Ie118ba305833204b7edeba0f14204f39a890928f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2586211
Tested-by: Matthew Wang <matthewmwang@chromium.org>
Commit-Queue: Matthew Wang <matthewmwang@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
diff --git a/shill/doc/device-api.txt b/shill/doc/device-api.txt
index 285e610..c3aabed 100644
--- a/shill/doc/device-api.txt
+++ b/shill/doc/device-api.txt
@@ -624,6 +624,17 @@
these counters from all interfaces every 60 seconds
so this value returned might be slightly old.
+ boolean RekeyInProgress [readonly]
+
+ (Defined in WiFi)
+
+ True when the connected network is attempting to
+ rekey. PSK networks can periodically change pairwise
+ or group keys for increased protection against attacks.
+ This flag guards against state changes in shill that
+ would otherwise change the service sort order and
+ potentially disrupt connectivity.
+
uint16 ScanInterval [readwrite]
(Defined in WiFi and Cellular)
diff --git a/shill/wifi/wifi.cc b/shill/wifi/wifi.cc
index 933445a..28e9402 100644
--- a/shill/wifi/wifi.cc
+++ b/shill/wifi/wifi.cc
@@ -185,6 +185,7 @@
HelpRegisterDerivedBool(store, kMacAddressRandomizationEnabledProperty,
&WiFi::GetRandomMacEnabled,
&WiFi::SetRandomMacEnabled);
+ store->RegisterConstBool(kRekeyInProgressProperty, &is_rekey_in_progress_);
store->RegisterDerivedKeyValueStore(
kLinkStatisticsProperty,
@@ -802,7 +803,7 @@
supplicant_bss_ = new_bss;
has_already_completed_ = false;
is_roaming_in_progress_ = false;
- is_rekey_in_progress_ = false;
+ SetIsRekeyInProgress(false);
// Any change in CurrentBSS means supplicant is actively changing our
// connectivity. We no longer need to track any previously pending
@@ -1893,7 +1894,7 @@
affected_service->SetRoamState(Service::kRoamStateConfiguring);
}
} else if (is_rekey_in_progress_) {
- is_rekey_in_progress_ = false;
+ SetIsRekeyInProgress(false);
LOG(INFO) << link_name()
<< " EAP re-key complete. No need to renew L3 configuration.";
}
@@ -1945,7 +1946,7 @@
// nothing when it happens in a PSK network. Unless roaming is in
// progress, we assume supplicant state transitions from completed to an
// auth/assoc state are a result of a re-key.
- is_rekey_in_progress_ = true;
+ SetIsRekeyInProgress(true);
} else {
affected_service->SetState(Service::kStateAssociating);
}
@@ -3269,4 +3270,12 @@
return true;
}
+void WiFi::SetIsRekeyInProgress(bool is_rekey_in_progress) {
+ if (is_rekey_in_progress == is_rekey_in_progress_) {
+ return;
+ }
+ is_rekey_in_progress_ = is_rekey_in_progress;
+ adaptor()->EmitBoolChanged(kRekeyInProgressProperty, is_rekey_in_progress_);
+}
+
} // namespace shill
diff --git a/shill/wifi/wifi.h b/shill/wifi/wifi.h
index b440f34..71ecc9d 100644
--- a/shill/wifi/wifi.h
+++ b/shill/wifi/wifi.h
@@ -609,6 +609,8 @@
void SetSupplicantInterfaceProxy(
std::unique_ptr<SupplicantInterfaceProxyInterface> proxy);
+ void SetIsRekeyInProgress(bool is_rekey_in_progress);
+
// Pointer to the provider object that maintains WiFiService objects.
WiFiProvider* provider_;
diff --git a/system_api/dbus/shill/dbus-constants.h b/system_api/dbus/shill/dbus-constants.h
index a34a654..db8e178 100644
--- a/system_api/dbus/shill/dbus-constants.h
+++ b/system_api/dbus/shill/dbus-constants.h
@@ -384,6 +384,7 @@
const char kMacAddressRandomizationSupportedProperty[] =
"MACAddressRandomizationSupported";
const char kNetDetectScanPeriodSecondsProperty[] = "NetDetectScanPeriodSeconds";
+const char kRekeyInProgressProperty[] = "RekeyInProgress";
const char kWakeOnWiFiFeaturesEnabledProperty[] = "WakeOnWiFiFeaturesEnabled";
const char kWakeToScanPeriodSecondsProperty[] = "WakeToScanPeriodSeconds";
const char kWifiSupportedFrequenciesProperty[] = "WiFi.SupportedFrequencies";