shill: wifi: Register newly-configured hidden networks
When a hidden WiFi service is created via ConfigureService,
it should be registered. This matches up exactly with how
hidden services are loaded from newly pushed profile in
WiFi::LoadHiddenServices().
BUG=chromium-os:26676
TEST=New unit tests, manual -- configure a hidden network via
configure-hidden-wifi, then propose a scan via "test-flimflam scan",
while running "iw event" to confirm whether the new SSID appears in
the scan list
Change-Id: I09cc26ad93c816ae109d5ce993354e2a9ed6240c
Reviewed-on: https://gerrit.chromium.org/gerrit/21289
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/wifi_service.cc b/wifi_service.cc
index e61e0c1..8ce3693 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -21,6 +21,7 @@
#include "shill/error.h"
#include "shill/event_dispatcher.h"
#include "shill/ieee80211.h"
+#include "shill/manager.h"
#include "shill/metrics.h"
#include "shill/nss.h"
#include "shill/property_accessor.h"
@@ -305,7 +306,6 @@
storage->SetString(id, kStorageSecurity, security_);
storage->SetString(id, kStorageSSID, hex_ssid_);
- // TODO(quiche): Save Passphrase property. (crosbug.com/23467)
return true;
}
@@ -728,6 +728,17 @@
UpdateConnectable();
}
+void WiFiService::OnProfileConfigured() {
+ if (profile() || !hidden_ssid()) {
+ return;
+ }
+ // This situation occurs when a hidden WiFi service created via GetService
+ // has been persisted to a profile in Manager::ConfigureService(). Now
+ // that configuration is saved, we must join the service with its profile,
+ // which will make this SSID eligible for directed probes during scans.
+ manager()->RegisterService(this);
+}
+
bool WiFiService::Is8021x() const {
if (security_ == flimflam::kSecurity8021x)
return true;