blob: 904fa9bb66fedd0e351e3c476704273bad505af0 [file] [log] [blame]
mukesh agrawal8a3188d2011-12-01 20:56:44 +00001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
mukesh agrawalb54601c2011-06-07 17:39:22 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/wifi_service.h"
6
7#include <string>
Gaurav Shah10109f22011-11-11 20:16:22 -08008#include <utility>
mukesh agrawalb54601c2011-06-07 17:39:22 -07009
Chris Masone34af2182011-08-22 11:59:36 -070010#include <base/stringprintf.h>
11#include <base/string_number_conversions.h>
Paul Stewarta41e38d2011-11-11 07:47:29 -080012#include <base/string_split.h>
Chris Masone34af2182011-08-22 11:59:36 -070013#include <base/string_util.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070014#include <chromeos/dbus/service_constants.h>
mukesh agrawal6e277772011-09-29 15:04:23 -070015#include <dbus/dbus.h>
mukesh agrawalb54601c2011-06-07 17:39:22 -070016
mukesh agrawale1d90e92012-02-15 17:36:08 -080017#include "shill/adaptor_interfaces.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070018#include "shill/control_interface.h"
19#include "shill/device.h"
mukesh agrawal1a056262011-10-05 14:36:54 -070020#include "shill/error.h"
Paul Stewart26b327e2011-10-19 11:38:09 -070021#include "shill/event_dispatcher.h"
mukesh agrawal1a056262011-10-05 14:36:54 -070022#include "shill/ieee80211.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070023#include "shill/logging.h"
Paul Stewart4357f4e2012-04-26 17:39:26 -070024#include "shill/manager.h"
Thieu Le48e6d6d2011-12-06 00:40:27 +000025#include "shill/metrics.h"
Paul Stewartecf4cd12012-04-17 11:08:39 -070026#include "shill/nss.h"
Thieu Lef7709452011-11-15 01:13:19 +000027#include "shill/property_accessor.h"
Paul Stewartd08f4432011-11-04 07:48:20 -070028#include "shill/store_interface.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070029#include "shill/wifi.h"
mukesh agrawal6e277772011-09-29 15:04:23 -070030#include "shill/wifi_endpoint.h"
31#include "shill/wpa_supplicant.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070032
mukesh agrawal261daca2011-12-02 18:56:56 +000033using std::set;
mukesh agrawalb54601c2011-06-07 17:39:22 -070034using std::string;
mukesh agrawal1a056262011-10-05 14:36:54 -070035using std::vector;
mukesh agrawalb54601c2011-06-07 17:39:22 -070036
37namespace shill {
mukesh agrawalb54601c2011-06-07 17:39:22 -070038
mukesh agrawalbf14e942012-03-02 14:36:34 -080039const char WiFiService::kAutoConnBusy[] = "busy";
40const char WiFiService::kAutoConnNoEndpoint[] = "no endpoints";
41
Paul Stewartd08f4432011-11-04 07:48:20 -070042const char WiFiService::kStorageHiddenSSID[] = "WiFi.HiddenSSID";
Paul Stewart2706aaf2011-12-14 16:44:04 -080043const char WiFiService::kStorageMode[] = "WiFi.Mode";
44const char WiFiService::kStoragePassphrase[] = "Passphrase";
45const char WiFiService::kStorageSecurity[] = "WiFi.Security";
46const char WiFiService::kStorageSSID[] = "SSID";
mukesh agrawale1d90e92012-02-15 17:36:08 -080047bool WiFiService::logged_signal_warning = false;
Paul Stewartd08f4432011-11-04 07:48:20 -070048
mukesh agrawalb54601c2011-06-07 17:39:22 -070049WiFiService::WiFiService(ControlInterface *control_interface,
50 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080051 Metrics *metrics,
Chris Masone6791a432011-07-12 13:23:19 -070052 Manager *manager,
Chris Masone2b105542011-06-22 10:58:09 -070053 const WiFiRefPtr &device,
Paul Stewarta41e38d2011-11-11 07:47:29 -080054 const vector<uint8_t> &ssid,
55 const string &mode,
56 const string &security,
Paul Stewartced6a0b2011-11-08 15:32:04 -080057 bool hidden_ssid)
Thieu Le3426c8f2012-01-11 17:35:11 -080058 : Service(control_interface, dispatcher, metrics, manager,
59 Technology::kWifi),
Chris Masone75612302011-10-12 16:31:21 -070060 need_passphrase_(false),
mukesh agrawal6e277772011-09-29 15:04:23 -070061 security_(security),
Chris Masone092df3e2011-08-22 09:41:39 -070062 mode_(mode),
Paul Stewartced6a0b2011-11-08 15:32:04 -080063 hidden_ssid_(hidden_ssid),
Thieu Lee41a72d2012-02-06 20:46:51 +000064 frequency_(0),
Paul Stewart20088d82012-02-16 06:58:55 -080065 physical_mode_(0),
Paul Stewart23b393a2012-09-25 21:21:06 -070066 raw_signal_strength_(0),
mukesh agrawalb54601c2011-06-07 17:39:22 -070067 wifi_(device),
Paul Stewartecf4cd12012-04-17 11:08:39 -070068 ssid_(ssid),
69 nss_(NSS::GetInstance()) {
mukesh agrawalde29fa82011-09-16 16:16:36 -070070 PropertyStore *store = this->mutable_store();
Paul Stewartac4ac002011-08-26 12:04:26 -070071 store->RegisterConstString(flimflam::kModeProperty, &mode_);
mukesh agrawal292dc0f2012-01-26 18:02:46 -080072 HelpRegisterWriteOnlyDerivedString(flimflam::kPassphraseProperty,
73 &WiFiService::SetPassphrase,
74 &WiFiService::ClearPassphrase,
75 NULL);
Paul Stewartac4ac002011-08-26 12:04:26 -070076 store->RegisterBool(flimflam::kPassphraseRequiredProperty, &need_passphrase_);
77 store->RegisterConstString(flimflam::kSecurityProperty, &security_);
Chris Masone3bd3c8c2011-06-13 08:20:26 -070078
Paul Stewartac4ac002011-08-26 12:04:26 -070079 store->RegisterConstString(flimflam::kWifiAuthMode, &auth_mode_);
Paul Stewart0cab5682012-09-13 18:50:34 -070080 store->RegisterBool(flimflam::kWifiHiddenSsid, &hidden_ssid_);
Paul Stewartac4ac002011-08-26 12:04:26 -070081 store->RegisterConstUint16(flimflam::kWifiFrequency, &frequency_);
82 store->RegisterConstUint16(flimflam::kWifiPhyMode, &physical_mode_);
mukesh agrawal923f14f2012-06-04 16:46:08 -070083 store->RegisterConstString(flimflam::kWifiBSsid, &bssid_);
Paul Stewart72b2fdc2012-06-02 08:58:51 -070084 store->RegisterConstStringmap(kWifiVendorInformationProperty,
85 &vendor_information_);
mukesh agrawal32399322011-09-01 10:53:43 -070086
mukesh agrawald835b202011-10-07 15:26:47 -070087 hex_ssid_ = base::HexEncode(ssid_.data(), ssid_.size());
88 string ssid_string(
89 reinterpret_cast<const char *>(ssid_.data()), ssid_.size());
mukesh agrawal16bc1b82012-02-09 18:38:26 -080090 if (WiFi::SanitizeSSID(&ssid_string)) {
mukesh agrawald835b202011-10-07 15:26:47 -070091 // WifiHexSsid property should only be present if Name property
92 // has been munged.
93 store->RegisterConstString(flimflam::kWifiHexSsid, &hex_ssid_);
94 }
95 set_friendly_name(ssid_string);
Chris Masone9d779932011-08-25 16:33:41 -070096
mukesh agrawal6e277772011-09-29 15:04:23 -070097 // TODO(quiche): determine if it is okay to set EAP.KeyManagement for
98 // a service that is not 802.1x.
Gaurav Shah29d68882012-01-30 19:06:42 -080099 if (Is8021x()) {
Gaurav Shah10109f22011-11-11 20:16:22 -0800100 // Passphrases are not mandatory for 802.1X.
101 need_passphrase_ = false;
mukesh agrawal6e277772011-09-29 15:04:23 -0700102 } else if (security_ == flimflam::kSecurityPsk) {
103 SetEAPKeyManagement("WPA-PSK");
mukesh agrawal6e277772011-09-29 15:04:23 -0700104 } else if (security_ == flimflam::kSecurityRsn) {
105 SetEAPKeyManagement("WPA-PSK");
mukesh agrawal6e277772011-09-29 15:04:23 -0700106 } else if (security_ == flimflam::kSecurityWpa) {
107 SetEAPKeyManagement("WPA-PSK");
mukesh agrawal6e277772011-09-29 15:04:23 -0700108 } else if (security_ == flimflam::kSecurityWep) {
109 SetEAPKeyManagement("NONE");
mukesh agrawal6e277772011-09-29 15:04:23 -0700110 } else if (security_ == flimflam::kSecurityNone) {
111 SetEAPKeyManagement("NONE");
mukesh agrawal6e277772011-09-29 15:04:23 -0700112 } else {
Gaurav Shah10109f22011-11-11 20:16:22 -0800113 LOG(ERROR) << "Unsupported security method " << security_;
mukesh agrawal6e277772011-09-29 15:04:23 -0700114 }
115
Paul Stewartd08f4432011-11-04 07:48:20 -0700116 // Until we know better (at Profile load time), use the generic name.
117 storage_identifier_ = GetGenericStorageIdentifier();
mukesh agrawal29c13a12011-11-24 00:09:19 +0000118 UpdateConnectable();
Paul Stewartcb59fed2012-03-21 21:14:46 -0700119
120 IgnoreParameterForConfigure(flimflam::kModeProperty);
121 IgnoreParameterForConfigure(flimflam::kSSIDProperty);
122 IgnoreParameterForConfigure(flimflam::kSecurityProperty);
mukesh agrawalb54601c2011-06-07 17:39:22 -0700123}
124
Darin Petkov9cd7ca12012-07-03 11:06:40 +0200125WiFiService::~WiFiService() {}
mukesh agrawalb54601c2011-06-07 17:39:22 -0700126
mukesh agrawalbf14e942012-03-02 14:36:34 -0800127bool WiFiService::IsAutoConnectable(const char **reason) const {
128 if (!Service::IsAutoConnectable(reason)) {
129 return false;
130 }
131
132 // Only auto-connect to Services which have visible Endpoints.
133 // (Needed because hidden Services may remain registered with
134 // Manager even without visible Endpoints.)
135 if (!HasEndpoints()) {
136 *reason = kAutoConnNoEndpoint;
137 return false;
138 }
139
140 // Do not preempt an existing connection (whether pending, or
141 // connected, and whether to this service, or another).
142 if (!wifi_->IsIdle()) {
143 *reason = kAutoConnBusy;
144 return false;
145 }
146
147 return true;
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000148}
149
Darin Petkov4a66cc52012-06-15 10:08:29 +0200150void WiFiService::AddEndpoint(const WiFiEndpointConstRefPtr &endpoint) {
mukesh agrawal261daca2011-12-02 18:56:56 +0000151 DCHECK(endpoint->ssid() == ssid());
152 endpoints_.insert(endpoint);
mukesh agrawale1d90e92012-02-15 17:36:08 -0800153 UpdateFromEndpoints();
mukesh agrawal261daca2011-12-02 18:56:56 +0000154}
155
Darin Petkov4a66cc52012-06-15 10:08:29 +0200156void WiFiService::RemoveEndpoint(const WiFiEndpointConstRefPtr &endpoint) {
mukesh agrawal261daca2011-12-02 18:56:56 +0000157 set<WiFiEndpointConstRefPtr>::iterator i = endpoints_.find(endpoint);
158 DCHECK(i != endpoints_.end());
159 if (i == endpoints_.end()) {
160 LOG(WARNING) << "In " << __func__ << "(): "
161 << "ignorning non-existent endpoint "
162 << endpoint->bssid_string();
163 return;
164 }
165 endpoints_.erase(i);
mukesh agrawale1d90e92012-02-15 17:36:08 -0800166 if (current_endpoint_ == endpoint) {
167 current_endpoint_ = NULL;
168 }
169 UpdateFromEndpoints();
mukesh agrawal261daca2011-12-02 18:56:56 +0000170}
171
mukesh agrawale1d90e92012-02-15 17:36:08 -0800172void WiFiService::NotifyCurrentEndpoint(const WiFiEndpoint *endpoint) {
173 DCHECK(!endpoint || (endpoints_.find(endpoint) != endpoints_.end()));
174 current_endpoint_ = endpoint;
175 UpdateFromEndpoints();
Thieu Lee41a72d2012-02-06 20:46:51 +0000176}
177
mukesh agrawalb20776f2012-02-10 16:00:36 -0800178void WiFiService::NotifyEndpointUpdated(const WiFiEndpoint &endpoint) {
179 DCHECK(endpoints_.find(&endpoint) != endpoints_.end());
mukesh agrawale1d90e92012-02-15 17:36:08 -0800180 UpdateFromEndpoints();
mukesh agrawalb20776f2012-02-10 16:00:36 -0800181}
182
Chris Masone6515aab2011-10-12 16:19:09 -0700183string WiFiService::GetStorageIdentifier() const {
Paul Stewartd08f4432011-11-04 07:48:20 -0700184 return storage_identifier_;
Chris Masone34af2182011-08-22 11:59:36 -0700185}
mukesh agrawal445e72c2011-06-22 11:13:50 -0700186
mukesh agrawal1a056262011-10-05 14:36:54 -0700187void WiFiService::SetPassphrase(const string &passphrase, Error *error) {
188 if (security_ == flimflam::kSecurityWep) {
Thieu Lef4cbda92011-11-10 23:41:24 +0000189 ValidateWEPPassphrase(passphrase, error);
mukesh agrawal1a056262011-10-05 14:36:54 -0700190 } else if (security_ == flimflam::kSecurityPsk ||
191 security_ == flimflam::kSecurityWpa ||
192 security_ == flimflam::kSecurityRsn) {
Thieu Lef4cbda92011-11-10 23:41:24 +0000193 ValidateWPAPassphrase(passphrase, error);
194 } else {
195 error->Populate(Error::kNotSupported);
mukesh agrawal1a056262011-10-05 14:36:54 -0700196 }
Thieu Lef4cbda92011-11-10 23:41:24 +0000197
Paul Stewart2706aaf2011-12-14 16:44:04 -0800198 if (error->IsSuccess()) {
Thieu Lef4cbda92011-11-10 23:41:24 +0000199 passphrase_ = passphrase;
Paul Stewart2706aaf2011-12-14 16:44:04 -0800200 }
mukesh agrawal29c13a12011-11-24 00:09:19 +0000201
202 UpdateConnectable();
mukesh agrawal1a056262011-10-05 14:36:54 -0700203}
204
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800205// ClearPassphrase is separate from SetPassphrase, because the default
206// value for |passphrase_| would not pass validation.
207void WiFiService::ClearPassphrase(Error */*error*/) {
208 passphrase_.clear();
209 UpdateConnectable();
210}
211
Paul Stewartd08f4432011-11-04 07:48:20 -0700212bool WiFiService::IsLoadableFrom(StoreInterface *storage) const {
213 return storage->ContainsGroup(GetGenericStorageIdentifier()) ||
214 storage->ContainsGroup(GetSpecificStorageIdentifier());
215}
216
Paul Stewarta41e38d2011-11-11 07:47:29 -0800217bool WiFiService::IsVisible() const {
Paul Stewarta41e38d2011-11-11 07:47:29 -0800218 // WiFi Services should be displayed only if they are in range (have
219 // endpoints that have shown up in a scan) or if the service is actively
220 // being connected.
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000221 return HasEndpoints() || IsConnected() || IsConnecting();
Paul Stewarta41e38d2011-11-11 07:47:29 -0800222}
223
Paul Stewartd08f4432011-11-04 07:48:20 -0700224bool WiFiService::Load(StoreInterface *storage) {
225 // First find out which storage identifier is available in priority order
226 // of specific, generic.
227 string id = GetSpecificStorageIdentifier();
228 if (!storage->ContainsGroup(id)) {
229 id = GetGenericStorageIdentifier();
230 if (!storage->ContainsGroup(id)) {
231 LOG(WARNING) << "Service is not available in the persistent store: "
232 << id;
233 return false;
234 }
235 }
236
237 // Set our storage identifier to match the storage name in the Profile.
238 storage_identifier_ = id;
239
240 // Load properties common to all Services.
241 if (!Service::Load(storage)) {
242 return false;
243 }
244
245 // Load properties specific to WiFi services.
246 storage->GetBool(id, kStorageHiddenSSID, &hidden_ssid_);
mukesh agrawal29c13a12011-11-24 00:09:19 +0000247
Paul Stewart2706aaf2011-12-14 16:44:04 -0800248 // NB: mode, security and ssid parameters are never read in from
249 // Load() as they are provided from the scan.
250
251 string passphrase;
252 if (storage->GetCryptedString(id, kStoragePassphrase, &passphrase)) {
253 Error error;
254 SetPassphrase(passphrase, &error);
255 if (!error.IsSuccess()) {
256 LOG(ERROR) << "Passphrase could not be set: "
257 << Error::GetName(error.type());
258 }
259 }
260
Paul Stewartd08f4432011-11-04 07:48:20 -0700261 return true;
262}
263
264bool WiFiService::Save(StoreInterface *storage) {
265 // Save properties common to all Services.
266 if (!Service::Save(storage)) {
267 return false;
268 }
269
270 // Save properties specific to WiFi services.
271 const string id = GetStorageIdentifier();
Paul Stewart2706aaf2011-12-14 16:44:04 -0800272 storage->SetBool(id, kStorageHiddenSSID, hidden_ssid_);
273 storage->SetString(id, kStorageMode, mode_);
274 storage->SetCryptedString(id, kStoragePassphrase, passphrase_);
275 storage->SetString(id, kStorageSecurity, security_);
276 storage->SetString(id, kStorageSSID, hex_ssid_);
mukesh agrawal29c13a12011-11-24 00:09:19 +0000277
Paul Stewartd08f4432011-11-04 07:48:20 -0700278 return true;
279}
280
Paul Stewart65512e12012-03-26 18:01:08 -0700281bool WiFiService::Unload() {
Paul Stewartd8ad3c42012-01-09 12:39:38 -0800282 Service::Unload();
283 hidden_ssid_ = false;
Wade Guthrie005bd342012-05-02 09:37:07 -0700284 Error unused_error;
285 ClearPassphrase(&unused_error);
Paul Stewart66c86002012-01-30 18:00:52 -0800286 if (security_ == flimflam::kSecurity8021x) {
287 // TODO(pstew): 802.1x/RSN networks (as opposed to 802.1x/WPA or
288 // 802.1x/WEP) have the ability to cache WPA PMK credentials.
289 // Make sure that these are cleared when credentials for networks
290 // of this type goes away.
291 //
292 // When wpa_supplicant gains the ability, do this credential
293 // clearing on a per-service basis. Also do this whenever the credentials
294 // for a service changes. crosbug.com/25670
295 wifi_->ClearCachedCredentials();
296 }
Paul Stewart65512e12012-03-26 18:01:08 -0700297 return !IsVisible();
Paul Stewartd8ad3c42012-01-09 12:39:38 -0800298}
299
Paul Stewart6ab23a92011-11-09 17:17:47 -0800300bool WiFiService::IsSecurityMatch(const string &security) const {
301 return GetSecurityClass(security) == GetSecurityClass(security_);
302}
303
Thieu Le48e6d6d2011-12-06 00:40:27 +0000304void WiFiService::InitializeCustomMetrics() const {
305 string histogram = metrics()->GetFullMetricName(
306 Metrics::kMetricTimeToJoinMilliseconds,
307 technology());
308 metrics()->AddServiceStateTransitionTimer(this,
309 histogram,
310 Service::kStateAssociating,
311 Service::kStateConfiguring);
312}
313
Thieu Leb84ba342012-03-02 15:15:19 -0800314void WiFiService::SendPostReadyStateMetrics(
315 int64 time_resume_to_ready_milliseconds) const {
Thieu Le48e6d6d2011-12-06 00:40:27 +0000316 metrics()->SendEnumToUMA(
317 metrics()->GetFullMetricName(Metrics::kMetricNetworkChannel,
318 technology()),
319 Metrics::WiFiFrequencyToChannel(frequency_),
320 Metrics::kMetricNetworkChannelMax);
Thieu Lead1ec2c2012-01-05 23:39:48 +0000321
322 DCHECK(physical_mode_ < Metrics::kWiFiNetworkPhyModeMax);
323 metrics()->SendEnumToUMA(
324 metrics()->GetFullMetricName(Metrics::kMetricNetworkPhyMode,
325 technology()),
326 static_cast<Metrics::WiFiNetworkPhyMode>(physical_mode_),
327 Metrics::kWiFiNetworkPhyModeMax);
328
329 Metrics::WiFiSecurity security_uma =
330 Metrics::WiFiSecurityStringToEnum(security_);
331 DCHECK(security_uma != Metrics::kWiFiSecurityUnknown);
332 metrics()->SendEnumToUMA(
333 metrics()->GetFullMetricName(Metrics::kMetricNetworkSecurity,
334 technology()),
335 security_uma,
336 Metrics::kMetricNetworkSecurityMax);
Thieu Leb84ba342012-03-02 15:15:19 -0800337
Paul Stewart23b393a2012-09-25 21:21:06 -0700338 // We invert the sign of the signal strength value, since UMA histograms
339 // cannot represent negative numbers (it stores them but cannot display
340 // them), and dBm values of interest start at 0 and go negative from there.
341 metrics()->SendToUMA(
342 metrics()->GetFullMetricName(Metrics::kMetricNetworkSignalStrength,
343 technology()),
344 -raw_signal_strength_,
345 Metrics::kMetricNetworkSignalStrengthMin,
346 Metrics::kMetricNetworkSignalStrengthMax,
347 Metrics::kMetricNetworkSignalStrengthNumBuckets);
348
Thieu Leb84ba342012-03-02 15:15:19 -0800349 if (time_resume_to_ready_milliseconds > 0) {
350 metrics()->SendToUMA(
351 metrics()->GetFullMetricName(
352 Metrics::kMetricTimeResumeToReadyMilliseconds, technology()),
353 time_resume_to_ready_milliseconds,
354 Metrics::kTimerHistogramMillisecondsMin,
355 Metrics::kTimerHistogramMillisecondsMax,
356 Metrics::kTimerHistogramNumBuckets);
357 }
Thieu Le48e6d6d2011-12-06 00:40:27 +0000358}
359
mukesh agrawal32399322011-09-01 10:53:43 -0700360// private methods
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800361void WiFiService::HelpRegisterWriteOnlyDerivedString(
362 const string &name,
363 void(WiFiService::*set)(const string &, Error *),
364 void(WiFiService::*clear)(Error *),
365 const string *default_value) {
366 mutable_store()->RegisterDerivedString(
Thieu Lef7709452011-11-15 01:13:19 +0000367 name,
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800368 StringAccessor(
369 new CustomWriteOnlyAccessor<WiFiService, string>(
370 this, set, clear, default_value)));
Thieu Lef7709452011-11-15 01:13:19 +0000371}
372
Wade Guthrie005bd342012-05-02 09:37:07 -0700373void WiFiService::Connect(Error *error) {
374 LOG(INFO) << "In " << __func__ << "(): Service " << friendly_name();
mukesh agrawal6e277772011-09-29 15:04:23 -0700375 std::map<string, DBus::Variant> params;
376 DBus::MessageIter writer;
377
Wade Guthrie005bd342012-05-02 09:37:07 -0700378 if (!connectable()) {
379 LOG(ERROR) << "Can't connect. Service " << friendly_name()
380 << " is not connectable";
Christopher Wiley1ce658d2012-10-10 10:02:03 -0700381 Error::PopulateAndLog(error,
382 Error::kOperationFailed,
383 Error::GetDefaultMessage(Error::kOperationFailed));
384 return;
385 }
386 if (IsConnecting() || IsConnected()) {
387 LOG(WARNING) << "Can't connect. Service " << friendly_name()
388 << " is already connecting or connected.";
389 Error::PopulateAndLog(error,
390 Error::kAlreadyConnected,
391 Error::GetDefaultMessage(Error::kAlreadyConnected));
Wade Guthrie005bd342012-05-02 09:37:07 -0700392 return;
393 }
Wade Guthrie8bc50882012-10-31 16:23:20 -0700394 if (wifi_->IsCurrentService(this)) {
395 LOG(WARNING) << "Can't connect. Service " << friendly_name()
396 << " is the current service (but, in " << GetStateString()
397 << " state, not connected.";
398 Error::PopulateAndLog(error,
399 Error::kInProgress,
400 Error::GetDefaultMessage(Error::kInProgress));
401 return;
402 }
Wade Guthrie005bd342012-05-02 09:37:07 -0700403
mukesh agrawal6e277772011-09-29 15:04:23 -0700404 params[wpa_supplicant::kNetworkPropertyMode].writer().
405 append_uint32(WiFiEndpoint::ModeStringToUint(mode_));
406
Paul Stewarte2d7c502012-07-16 16:35:10 -0700407 if (mode_ == flimflam::kModeAdhoc && frequency_ != 0) {
408 // Frequency is required in order to successfully conntect to an IBSS
409 // with wpa_supplicant. If we have one from our endpoint, insert it
410 // here.
411 params[wpa_supplicant::kNetworkPropertyFrequency].writer().
412 append_int32(frequency_);
413 }
414
Gaurav Shah29d68882012-01-30 19:06:42 -0800415 if (Is8021x()) {
416 // Is EAP key management is not set, set to a default.
Gaurav Shah10109f22011-11-11 20:16:22 -0800417 if (GetEAPKeyManagement().empty())
418 SetEAPKeyManagement("WPA-EAP");
419 Populate8021xProperties(&params);
Paul Stewartbc6e7392012-05-24 07:07:48 -0700420 ClearEAPCertification();
mukesh agrawal6e277772011-09-29 15:04:23 -0700421 } else if (security_ == flimflam::kSecurityPsk) {
Gaurav Shahf8721ee2011-11-07 09:12:46 -0800422 const string psk_proto = StringPrintf("%s %s",
423 wpa_supplicant::kSecurityModeWPA,
424 wpa_supplicant::kSecurityModeRSN);
425 params[wpa_supplicant::kPropertySecurityProtocol].writer().
426 append_string(psk_proto.c_str());
427 params[wpa_supplicant::kPropertyPreSharedKey].writer().
428 append_string(passphrase_.c_str());
mukesh agrawal6e277772011-09-29 15:04:23 -0700429 } else if (security_ == flimflam::kSecurityRsn) {
mukesh agrawalf2fd7452011-10-03 16:38:47 -0700430 params[wpa_supplicant::kPropertySecurityProtocol].writer().
431 append_string(wpa_supplicant::kSecurityModeRSN);
432 params[wpa_supplicant::kPropertyPreSharedKey].writer().
433 append_string(passphrase_.c_str());
mukesh agrawal6e277772011-09-29 15:04:23 -0700434 } else if (security_ == flimflam::kSecurityWpa) {
435 params[wpa_supplicant::kPropertySecurityProtocol].writer().
436 append_string(wpa_supplicant::kSecurityModeWPA);
437 params[wpa_supplicant::kPropertyPreSharedKey].writer().
438 append_string(passphrase_.c_str());
439 } else if (security_ == flimflam::kSecurityWep) {
Thieu Lef4cbda92011-11-10 23:41:24 +0000440 params[wpa_supplicant::kPropertyAuthAlg].writer().
441 append_string(wpa_supplicant::kSecurityAuthAlg);
442 Error error;
443 int key_index;
444 std::vector<uint8> password_bytes;
445 ParseWEPPassphrase(passphrase_, &key_index, &password_bytes, &error);
446 writer = params[wpa_supplicant::kPropertyWEPKey +
447 base::IntToString(key_index)].writer();
448 writer << password_bytes;
449 params[wpa_supplicant::kPropertyWEPTxKeyIndex].writer().
450 append_uint32(key_index);
mukesh agrawal6e277772011-09-29 15:04:23 -0700451 } else if (security_ == flimflam::kSecurityNone) {
Gaurav Shahf8721ee2011-11-07 09:12:46 -0800452 // Nothing special to do here.
mukesh agrawal6e277772011-09-29 15:04:23 -0700453 } else {
Gaurav Shahf8721ee2011-11-07 09:12:46 -0800454 LOG(ERROR) << "Can't connect. Unsupported security method " << security_;
mukesh agrawal6e277772011-09-29 15:04:23 -0700455 }
456
Gaurav Shah10109f22011-11-11 20:16:22 -0800457 params[wpa_supplicant::kNetworkPropertyEapKeyManagement].writer().
mukesh agrawal6e277772011-09-29 15:04:23 -0700458 append_string(key_management().c_str());
Gaurav Shah7ad8e532011-11-11 17:14:49 -0800459
460 // See note in dbus_adaptor.cc on why we need to use a local.
mukesh agrawal6e277772011-09-29 15:04:23 -0700461 writer = params[wpa_supplicant::kNetworkPropertySSID].writer();
462 writer << ssid_;
463
464 wifi_->ConnectTo(this, params);
mukesh agrawalb54601c2011-06-07 17:39:22 -0700465}
466
Eric Shienbrood9a245532012-03-07 14:20:39 -0500467void WiFiService::Disconnect(Error *error) {
468 LOG(INFO) << __func__;
469 Service::Disconnect(error);
mukesh agrawal0ed0f2e2011-12-05 20:36:17 +0000470 wifi_->DisconnectFrom(this);
471}
472
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800473string WiFiService::GetDeviceRpcId(Error */*error*/) {
Chris Masone95207da2011-06-29 16:50:49 -0700474 return wifi_->GetRpcIdentifier();
475}
476
mukesh agrawal29c13a12011-11-24 00:09:19 +0000477void WiFiService::UpdateConnectable() {
Gaurav Shah10109f22011-11-11 20:16:22 -0800478 bool is_connectable = false;
mukesh agrawal29c13a12011-11-24 00:09:19 +0000479 if (security_ == flimflam::kSecurityNone) {
480 DCHECK(passphrase_.empty());
Paul Stewartd8ad3c42012-01-09 12:39:38 -0800481 need_passphrase_ = false;
Gaurav Shah10109f22011-11-11 20:16:22 -0800482 is_connectable = true;
Gaurav Shah29d68882012-01-30 19:06:42 -0800483 } else if (Is8021x()) {
484 is_connectable = Is8021xConnectable();
mukesh agrawal29c13a12011-11-24 00:09:19 +0000485 } else if (security_ == flimflam::kSecurityWep ||
486 security_ == flimflam::kSecurityWpa ||
487 security_ == flimflam::kSecurityPsk ||
488 security_ == flimflam::kSecurityRsn) {
Paul Stewartd8ad3c42012-01-09 12:39:38 -0800489 need_passphrase_ = passphrase_.empty();
Gaurav Shah10109f22011-11-11 20:16:22 -0800490 is_connectable = !need_passphrase_;
mukesh agrawal29c13a12011-11-24 00:09:19 +0000491 }
Gaurav Shah10109f22011-11-11 20:16:22 -0800492 set_connectable(is_connectable);
mukesh agrawal29c13a12011-11-24 00:09:19 +0000493}
494
mukesh agrawale1d90e92012-02-15 17:36:08 -0800495void WiFiService::UpdateFromEndpoints() {
496 const WiFiEndpoint *representative_endpoint = NULL;
497
498 if (current_endpoint_) {
mukesh agrawale1d90e92012-02-15 17:36:08 -0800499 representative_endpoint = current_endpoint_;
500 } else {
501 int16 best_signal = std::numeric_limits<int16>::min();
502 for (set<WiFiEndpointConstRefPtr>::iterator i = endpoints_.begin();
503 i != endpoints_.end(); ++i) {
504 if ((*i)->signal_strength() >= best_signal) {
505 best_signal = (*i)->signal_strength();
506 representative_endpoint = *i;
507 }
508 }
509 }
510
Paul Stewart72b2fdc2012-06-02 08:58:51 -0700511 uint16 frequency = 0;
512 int16 signal = std::numeric_limits<int16>::min();
mukesh agrawal923f14f2012-06-04 16:46:08 -0700513 string bssid;
Paul Stewart72b2fdc2012-06-02 08:58:51 -0700514 Stringmap vendor_information;
Paul Stewart23b393a2012-09-25 21:21:06 -0700515 // Represent "unknown raw signal strength" as 0.
516 raw_signal_strength_ = 0;
Paul Stewart72b2fdc2012-06-02 08:58:51 -0700517 if (representative_endpoint) {
mukesh agrawale1d90e92012-02-15 17:36:08 -0800518 frequency = representative_endpoint->frequency();
519 signal = representative_endpoint->signal_strength();
Paul Stewart23b393a2012-09-25 21:21:06 -0700520 raw_signal_strength_ = signal;
mukesh agrawal923f14f2012-06-04 16:46:08 -0700521 bssid = representative_endpoint->bssid_string();
Paul Stewart72b2fdc2012-06-02 08:58:51 -0700522 vendor_information = representative_endpoint->GetVendorInformation();
mukesh agrawale1d90e92012-02-15 17:36:08 -0800523 }
524
525 if (frequency_ != frequency) {
526 frequency_ = frequency;
527 adaptor()->EmitUint16Changed(flimflam::kWifiFrequency, frequency_);
528 }
mukesh agrawal923f14f2012-06-04 16:46:08 -0700529 if (bssid_ != bssid) {
530 bssid_ = bssid;
531 adaptor()->EmitStringChanged(flimflam::kWifiBSsid, bssid_);
532 }
Paul Stewart72b2fdc2012-06-02 08:58:51 -0700533 if (vendor_information_ != vendor_information) {
534 vendor_information_ = vendor_information;
535 adaptor()->EmitStringmapChanged(kWifiVendorInformationProperty,
536 vendor_information_);
537 }
mukesh agrawale1d90e92012-02-15 17:36:08 -0800538 SetStrength(SignalToStrength(signal));
539}
540
mukesh agrawal1a056262011-10-05 14:36:54 -0700541// static
Thieu Lef4cbda92011-11-10 23:41:24 +0000542void WiFiService::ValidateWEPPassphrase(const std::string &passphrase,
543 Error *error) {
544 ParseWEPPassphrase(passphrase, NULL, NULL, error);
mukesh agrawal1a056262011-10-05 14:36:54 -0700545}
546
547// static
Thieu Lef4cbda92011-11-10 23:41:24 +0000548void WiFiService::ValidateWPAPassphrase(const std::string &passphrase,
549 Error *error) {
mukesh agrawal1a056262011-10-05 14:36:54 -0700550 unsigned int length = passphrase.length();
551 vector<uint8> passphrase_bytes;
552
553 if (base::HexStringToBytes(passphrase, &passphrase_bytes)) {
554 if (length != IEEE_80211::kWPAHexLen &&
555 (length < IEEE_80211::kWPAAsciiMinLen ||
556 length > IEEE_80211::kWPAAsciiMaxLen)) {
557 error->Populate(Error::kInvalidPassphrase);
558 }
559 } else {
560 if (length < IEEE_80211::kWPAAsciiMinLen ||
561 length > IEEE_80211::kWPAAsciiMaxLen) {
562 error->Populate(Error::kInvalidPassphrase);
563 }
564 }
Thieu Lef4cbda92011-11-10 23:41:24 +0000565}
mukesh agrawal1a056262011-10-05 14:36:54 -0700566
Thieu Lef4cbda92011-11-10 23:41:24 +0000567// static
568void WiFiService::ParseWEPPassphrase(const string &passphrase,
569 int *key_index,
570 std::vector<uint8> *password_bytes,
571 Error *error) {
572 unsigned int length = passphrase.length();
573 int key_index_local;
574 std::string password_text;
575 bool is_hex = false;
576
577 switch (length) {
578 case IEEE_80211::kWEP40AsciiLen:
579 case IEEE_80211::kWEP104AsciiLen:
580 key_index_local = 0;
581 password_text = passphrase;
582 break;
583 case IEEE_80211::kWEP40AsciiLen + 2:
584 case IEEE_80211::kWEP104AsciiLen + 2:
585 if (CheckWEPKeyIndex(passphrase, error)) {
586 base::StringToInt(passphrase.substr(0,1), &key_index_local);
587 password_text = passphrase.substr(2);
588 }
589 break;
590 case IEEE_80211::kWEP40HexLen:
591 case IEEE_80211::kWEP104HexLen:
592 if (CheckWEPIsHex(passphrase, error)) {
593 key_index_local = 0;
594 password_text = passphrase;
595 is_hex = true;
596 }
597 break;
598 case IEEE_80211::kWEP40HexLen + 2:
599 case IEEE_80211::kWEP104HexLen + 2:
600 if(CheckWEPKeyIndex(passphrase, error) &&
601 CheckWEPIsHex(passphrase.substr(2), error)) {
602 base::StringToInt(passphrase.substr(0,1), &key_index_local);
603 password_text = passphrase.substr(2);
604 is_hex = true;
605 } else if (CheckWEPPrefix(passphrase, error) &&
606 CheckWEPIsHex(passphrase.substr(2), error)) {
607 key_index_local = 0;
608 password_text = passphrase.substr(2);
609 is_hex = true;
610 }
611 break;
612 case IEEE_80211::kWEP40HexLen + 4:
613 case IEEE_80211::kWEP104HexLen + 4:
614 if (CheckWEPKeyIndex(passphrase, error) &&
615 CheckWEPPrefix(passphrase.substr(2), error) &&
616 CheckWEPIsHex(passphrase.substr(4), error)) {
617 base::StringToInt(passphrase.substr(0,1), &key_index_local);
618 password_text = passphrase.substr(4);
619 is_hex = true;
620 }
621 break;
622 default:
623 error->Populate(Error::kInvalidPassphrase);
624 break;
625 }
626
mukesh agrawal1a056262011-10-05 14:36:54 -0700627 if (error->IsSuccess()) {
Thieu Lef4cbda92011-11-10 23:41:24 +0000628 if (key_index)
629 *key_index = key_index_local;
630 if (password_bytes) {
631 if (is_hex)
632 base::HexStringToBytes(password_text, password_bytes);
633 else
634 password_bytes->insert(password_bytes->end(),
635 password_text.begin(),
636 password_text.end());
637 }
mukesh agrawal1a056262011-10-05 14:36:54 -0700638 }
639}
640
641// static
642bool WiFiService::CheckWEPIsHex(const string &passphrase, Error *error) {
643 vector<uint8> passphrase_bytes;
644 if (base::HexStringToBytes(passphrase, &passphrase_bytes)) {
645 return true;
646 } else {
647 error->Populate(Error::kInvalidPassphrase);
648 return false;
649 }
650}
651
652// static
653bool WiFiService::CheckWEPKeyIndex(const string &passphrase, Error *error) {
654 if (StartsWithASCII(passphrase, "0:", false) ||
655 StartsWithASCII(passphrase, "1:", false) ||
656 StartsWithASCII(passphrase, "2:", false) ||
657 StartsWithASCII(passphrase, "3:", false)) {
658 return true;
659 } else {
660 error->Populate(Error::kInvalidPassphrase);
661 return false;
662 }
663}
664
665// static
666bool WiFiService::CheckWEPPrefix(const string &passphrase, Error *error) {
667 if (StartsWithASCII(passphrase, "0x", false)) {
668 return true;
669 } else {
670 error->Populate(Error::kInvalidPassphrase);
671 return false;
672 }
673}
674
Paul Stewart6ab23a92011-11-09 17:17:47 -0800675// static
Paul Stewart6ab23a92011-11-09 17:17:47 -0800676string WiFiService::GetSecurityClass(const string &security) {
677 if (security == flimflam::kSecurityRsn ||
678 security == flimflam::kSecurityWpa) {
679 return flimflam::kSecurityPsk;
Paul Stewartd08f4432011-11-04 07:48:20 -0700680 } else {
Paul Stewart6ab23a92011-11-09 17:17:47 -0800681 return security;
Paul Stewartd08f4432011-11-04 07:48:20 -0700682 }
683}
684
Paul Stewarta41e38d2011-11-11 07:47:29 -0800685// static
686bool WiFiService::ParseStorageIdentifier(const string &storage_name,
687 string *address,
688 string *mode,
689 string *security) {
690 vector<string> wifi_parts;
691 base::SplitString(storage_name, '_', &wifi_parts);
Paul Stewart0756db92012-01-27 08:34:47 -0800692 if ((wifi_parts.size() != 5 && wifi_parts.size() != 6) ||
693 wifi_parts[0] != flimflam::kTypeWifi) {
Paul Stewarta41e38d2011-11-11 07:47:29 -0800694 return false;
695 }
696 *address = wifi_parts[1];
697 *mode = wifi_parts[3];
Paul Stewart0756db92012-01-27 08:34:47 -0800698 if (wifi_parts.size() == 5) {
699 *security = wifi_parts[4];
700 } else {
701 // Account for security type "802_1x" which got split up above.
702 *security = wifi_parts[4] + "_" + wifi_parts[5];
703 }
Paul Stewarta41e38d2011-11-11 07:47:29 -0800704 return true;
705}
706
mukesh agrawale1d90e92012-02-15 17:36:08 -0800707// static
708uint8 WiFiService::SignalToStrength(int16 signal_dbm) {
709 int16 strength;
710 if (signal_dbm > 0) {
711 if (!logged_signal_warning) {
712 LOG(WARNING) << "Signal strength is suspiciously high. "
713 << "Assuming value " << signal_dbm << " is not in dBm.";
714 logged_signal_warning = true;
715 }
716 strength = signal_dbm;
717 } else {
718 strength = 120 + signal_dbm; // Call -20dBm "perfect".
719 }
720
mukesh agrawal8f3f7752012-02-17 19:42:09 -0800721 if (strength > kStrengthMax) {
722 strength = kStrengthMax;
723 } else if (strength < kStrengthMin) {
724 strength = kStrengthMin;
mukesh agrawale1d90e92012-02-15 17:36:08 -0800725 }
726 return strength;
727}
728
Paul Stewart6ab23a92011-11-09 17:17:47 -0800729string WiFiService::GetGenericStorageIdentifier() const {
730 return GetStorageIdentifierForSecurity(GetSecurityClass(security_));
731}
732
Paul Stewartd08f4432011-11-04 07:48:20 -0700733string WiFiService::GetSpecificStorageIdentifier() const {
734 return GetStorageIdentifierForSecurity(security_);
735}
736
737string WiFiService::GetStorageIdentifierForSecurity(
738 const string &security) const {
739 return StringToLowerASCII(base::StringPrintf("%s_%s_%s_%s_%s",
740 flimflam::kTypeWifi,
741 wifi_->address().c_str(),
742 hex_ssid_.c_str(),
743 mode_.c_str(),
744 security.c_str()));
745}
746
Gary Moraine4aaf5e2012-04-05 14:37:32 -0700747void WiFiService::set_eap(const EapCredentials &new_eap) {
748 EapCredentials modified_eap = new_eap;
749
750 // An empty key_management field is invalid. Prevent it, if possible.
751 if (modified_eap.key_management.empty()) {
752 modified_eap.key_management = eap().key_management;
753 }
754 Service::set_eap(modified_eap);
Gaurav Shah10109f22011-11-11 20:16:22 -0800755 UpdateConnectable();
756}
757
Paul Stewart4357f4e2012-04-26 17:39:26 -0700758void WiFiService::OnProfileConfigured() {
759 if (profile() || !hidden_ssid()) {
760 return;
761 }
762 // This situation occurs when a hidden WiFi service created via GetService
763 // has been persisted to a profile in Manager::ConfigureService(). Now
764 // that configuration is saved, we must join the service with its profile,
765 // which will make this SSID eligible for directed probes during scans.
766 manager()->RegisterService(this);
767}
768
Gaurav Shah29d68882012-01-30 19:06:42 -0800769bool WiFiService::Is8021x() const {
770 if (security_ == flimflam::kSecurity8021x)
771 return true;
772
773 // Dynamic WEP + 802.1x.
774 if (security_ == flimflam::kSecurityWep &&
775 GetEAPKeyManagement() == "IEEE8021X")
776 return true;
777 return false;
778}
779
Gaurav Shah10109f22011-11-11 20:16:22 -0800780void WiFiService::Populate8021xProperties(
781 std::map<string, DBus::Variant> *params) {
Paul Stewartecf4cd12012-04-17 11:08:39 -0700782 string ca_cert = eap().ca_cert;
783 if (!eap().ca_cert_nss.empty()) {
784 vector<char> id(ssid_.begin(), ssid_.end());
785 FilePath certfile = nss_->GetDERCertfile(eap().ca_cert_nss, id);
786 if (certfile.empty()) {
787 LOG(ERROR) << "Unable to extract certificate: " << eap().ca_cert_nss;
788 } else {
789 ca_cert = certfile.value();
790 }
791 }
792
793
Gaurav Shah10109f22011-11-11 20:16:22 -0800794 typedef std::pair<const char *, const char *> KeyVal;
Paul Stewart20550982012-04-16 12:16:11 -0700795 KeyVal init_propertyvals[] = {
Gaurav Shah10109f22011-11-11 20:16:22 -0800796 KeyVal(wpa_supplicant::kNetworkPropertyEapIdentity, eap().identity.c_str()),
797 KeyVal(wpa_supplicant::kNetworkPropertyEapEap, eap().eap.c_str()),
798 KeyVal(wpa_supplicant::kNetworkPropertyEapInnerEap,
799 eap().inner_eap.c_str()),
800 KeyVal(wpa_supplicant::kNetworkPropertyEapAnonymousIdentity,
801 eap().anonymous_identity.c_str()),
802 KeyVal(wpa_supplicant::kNetworkPropertyEapClientCert,
803 eap().client_cert.c_str()),
804 KeyVal(wpa_supplicant::kNetworkPropertyEapPrivateKey,
805 eap().private_key.c_str()),
806 KeyVal(wpa_supplicant::kNetworkPropertyEapPrivateKeyPassword,
807 eap().private_key_password.c_str()),
Paul Stewartecf4cd12012-04-17 11:08:39 -0700808 KeyVal(wpa_supplicant::kNetworkPropertyEapCaCert, ca_cert.c_str()),
Gaurav Shah10109f22011-11-11 20:16:22 -0800809 KeyVal(wpa_supplicant::kNetworkPropertyEapCaPassword,
810 eap().password.c_str()),
811 KeyVal(wpa_supplicant::kNetworkPropertyEapCertId, eap().cert_id.c_str()),
812 KeyVal(wpa_supplicant::kNetworkPropertyEapKeyId, eap().key_id.c_str()),
813 KeyVal(wpa_supplicant::kNetworkPropertyEapCaCertId,
814 eap().ca_cert_id.c_str()),
Paul Stewartbc6e7392012-05-24 07:07:48 -0700815 KeyVal(wpa_supplicant::kNetworkPropertyEapSubjectMatch,
816 eap().subject_match.c_str())
Gaurav Shah10109f22011-11-11 20:16:22 -0800817 };
818
Paul Stewart20550982012-04-16 12:16:11 -0700819 vector<KeyVal> propertyvals(init_propertyvals,
820 init_propertyvals + arraysize(init_propertyvals));
821 if (eap().use_system_cas) {
822 propertyvals.push_back(KeyVal(
823 wpa_supplicant::kNetworkPropertyCaPath, wpa_supplicant::kCaPath));
Paul Stewartecf4cd12012-04-17 11:08:39 -0700824 } else if (ca_cert.empty()) {
Paul Stewart20550982012-04-16 12:16:11 -0700825 LOG(WARNING) << __func__
826 << ": No certificate authorities are configured."
827 << " Server certificates will be accepted"
828 << " unconditionally.";
829 }
830
831 if (!eap().cert_id.empty() || !eap().key_id.empty() ||
832 !eap().ca_cert_id.empty()) {
833 propertyvals.push_back(KeyVal(
834 wpa_supplicant::kNetworkPropertyEapPin, eap().pin.c_str()));
835 propertyvals.push_back(KeyVal(
836 wpa_supplicant::kNetworkPropertyEngineId,
837 wpa_supplicant::kEnginePKCS11));
838 // We can't use the propertyvals vector for this since this argument
839 // is a uint32, not a string.
840 (*params)[wpa_supplicant::kNetworkPropertyEngine].writer().
841 append_uint32(wpa_supplicant::kDefaultEngine);
842 }
843
844 vector<KeyVal>::iterator it;
845 for (it = propertyvals.begin(); it != propertyvals.end(); ++it) {
846 if (strlen((*it).second) > 0) {
847 (*params)[(*it).first].writer().append_string((*it).second);
Gaurav Shah10109f22011-11-11 20:16:22 -0800848 }
849 }
850}
851
mukesh agrawalb54601c2011-06-07 17:39:22 -0700852} // namespace shill