summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/cros/network_library.cc
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 04:20:41 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 04:20:41 +0000
commite8bed13a932d9a5f0c017b9d50088829f63e91f9 (patch)
treecab9eb200e3fd4e65408ba452bae79c09c11045c /chrome/browser/chromeos/cros/network_library.cc
parent692a806c7f11f869de6ffc1ccef0a073c841c233 (diff)
downloadchromium_src-e8bed13a932d9a5f0c017b9d50088829f63e91f9.zip
chromium_src-e8bed13a932d9a5f0c017b9d50088829f63e91f9.tar.gz
chromium_src-e8bed13a932d9a5f0c017b9d50088829f63e91f9.tar.bz2
Detect user initiated network connection failures.
This also recognizes additional Shill authentication errors. BUG=168056 Review URL: https://chromiumcodereview.appspot.com/11824046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/cros/network_library.cc')
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc55
1 files changed, 41 insertions, 14 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc
index b7014fa..121e6a5 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -218,7 +218,7 @@ Network::Network(const std::string& service_path,
: state_(STATE_UNKNOWN),
error_(ERROR_NO_ERROR),
connectable_(true),
- connection_started_(false),
+ user_connect_state_(USER_CONNECT_NONE),
is_active_(false),
priority_(kPriorityNotSet),
auto_connect_(false),
@@ -311,22 +311,32 @@ void Network::SetState(ConnectionState new_state) {
error_ = ERROR_UNKNOWN;
}
}
- } else if (new_state == STATE_IDLE && IsConnectingState(old_state)
- && connection_started()) {
+ if (user_connect_state() == USER_CONNECT_STARTED)
+ set_user_connect_state(USER_CONNECT_FAILED);
+ } else if (new_state == STATE_IDLE && IsConnectingState(old_state) &&
+ user_connect_state() == USER_CONNECT_STARTED) {
// If we requested a connect and never went through a connected state,
// treat it as a failure.
VLOG(1) << service_path() << ": Inferring Failure state.";
notify_failure_ = true;
error_ = ERROR_UNKNOWN;
+ if (user_connect_state() == USER_CONNECT_STARTED)
+ set_user_connect_state(USER_CONNECT_FAILED);
} else if (new_state != STATE_UNKNOWN) {
notify_failure_ = false;
// State changed, so refresh IP address.
InitIPAddress();
+ if (user_connect_state() == USER_CONNECT_STARTED) {
+ if (IsConnectedState(new_state)) {
+ set_user_connect_state(USER_CONNECT_CONNECTED);
+ } else if (!IsConnectingState(new_state)) {
+ LOG(WARNING) << "Connection started and State -> " << GetStateString();
+ set_user_connect_state(USER_CONNECT_FAILED);
+ }
+ }
}
VLOG(1) << name() << ".State [" << service_path() << "]: " << GetStateString()
<< " (was: " << ConnectionStateString(old_state) << ")";
- if (!IsConnectingState(new_state) && new_state != STATE_UNKNOWN)
- set_connection_started(false);
}
void Network::SetError(ConnectionError error) {
@@ -492,6 +502,9 @@ std::string Network::GetErrorString() const {
return l10n_util::GetStringUTF8(
IDS_CHROMEOS_NETWORK_ERROR_IPSEC_CERT_AUTH_FAILED);
case ERROR_PPP_AUTH_FAILED:
+ case ERROR_EAP_AUTHENTICATION_FAILED:
+ case ERROR_EAP_LOCAL_TLS_FAILED:
+ case ERROR_EAP_REMOTE_TLS_FAILED:
return l10n_util::GetStringUTF8(
IDS_CHROMEOS_NETWORK_ERROR_PPP_AUTH_FAILED);
case ERROR_UNKNOWN:
@@ -1222,18 +1235,32 @@ bool WifiNetwork::IsPassphraseRequired() const {
if (encryption_ == SECURITY_NONE)
return false;
// A connection failure might be due to a bad passphrase.
- if (error() == ERROR_BAD_PASSPHRASE || error() == ERROR_BAD_WEPKEY ||
- error() == ERROR_UNKNOWN)
+ if (error() == ERROR_BAD_PASSPHRASE ||
+ error() == ERROR_BAD_WEPKEY ||
+ error() == ERROR_PPP_AUTH_FAILED ||
+ error() == ERROR_EAP_LOCAL_TLS_FAILED ||
+ error() == ERROR_EAP_REMOTE_TLS_FAILED ||
+ error() == ERROR_EAP_AUTHENTICATION_FAILED ||
+ error() == ERROR_CONNECT_FAILED ||
+ error() == ERROR_UNKNOWN) {
+ VLOG(1) << "Authentication Error: " << GetErrorString();
return true;
- // For 802.1x networks, configuration is required if connectable is false
- // unless we're using a certificate pattern.
- if (encryption_ == SECURITY_8021X) {
- if (eap_method_ != EAP_METHOD_TLS ||
- client_cert_type() != CLIENT_CERT_TYPE_PATTERN)
- return !connectable();
+ }
+ // If the user initiated a connection and it failed, request credentials in
+ // case it is a credentials error and Shill was unable to detect it.
+ if (user_connect_state() == USER_CONNECT_FAILED)
+ return true;
+ // WEP/WPA/RSN and PSK networks rely on the PassphraseRequired property.
+ if (encryption_ != SECURITY_8021X)
+ return passphrase_required_;
+ // For 802.1x networks, if we are using a certificate pattern we do not
+ // need any credentials.
+ if (eap_method_ == EAP_METHOD_TLS &&
+ client_cert_type() == CLIENT_CERT_TYPE_PATTERN) {
return false;
}
- return passphrase_required_;
+ // Connectable will be false if 802.1x credentials are not set
+ return !connectable();
}
bool WifiNetwork::RequiresUserProfile() const {