diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-04 20:30:04 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-04 20:30:04 +0000 |
commit | 5720421b32f7ffe5f95cd37d6bbddd2355de368c (patch) | |
tree | 67cdb1ab63b93feabd3819a59b9a8d10373ee6da /chrome/browser/chromeos/cros/network_library.cc | |
parent | 5b0ee08cf9896cb4858bac35745a7b9dcb29528a (diff) | |
download | chromium_src-5720421b32f7ffe5f95cd37d6bbddd2355de368c.zip chromium_src-5720421b32f7ffe5f95cd37d6bbddd2355de368c.tar.gz chromium_src-5720421b32f7ffe5f95cd37d6bbddd2355de368c.tar.bz2 |
Add additional checks to request a network passphrase on failure.
Shill transitions from Association -> Idle when it fails to connect to a PSK network.
Detect this transition as a connect failure, and if a connection was requested by the user, trigger a notification.
BUG=152522
TEST=Test connecting to a range of networks with incorrect and correct passphrases. Test changing the passphrase. Test against a flakey network and on the edge of the connection range; ensure the connect dialog does not come up when it shouldn't, and the notification is not noisy. Test WiMax in particular.
Review URL: https://chromiumcodereview.appspot.com/11026016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/cros/network_library.cc')
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 7fa69fc..5ef8ef7 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -297,10 +297,8 @@ void Network::SetState(ConnectionState new_state) { ConnectionState old_state = state_; VLOG(2) << "Entering new state: " << ConnectionStateString(new_state); state_ = new_state; - if (!IsConnectingState(new_state)) - set_connection_started(false); if (new_state == STATE_FAILURE) { - VLOG(2) << "Detected Failure state."; + VLOG(1) << service_path() << ": Detected Failure state."; if (old_state != STATE_UNKNOWN && old_state != STATE_IDLE) { // New failure, the user needs to be notified. // Transition STATE_IDLE -> STATE_FAILURE sometimes happens on resume @@ -313,6 +311,13 @@ void Network::SetState(ConnectionState new_state) { error_ = ERROR_UNKNOWN; } } + } else if (new_state == STATE_IDLE && IsConnectingState(old_state) + && connection_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; } else if (new_state != STATE_UNKNOWN) { notify_failure_ = false; // State changed, so refresh IP address. @@ -321,6 +326,8 @@ void Network::SetState(ConnectionState new_state) { } 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) { @@ -1224,9 +1231,11 @@ std::string WifiNetwork::GetEncryptionString() const { } bool WifiNetwork::IsPassphraseRequired() const { - // TODO(stevenjb): Remove error_ tests when fixed. - // (http://crosbug.com/10135). - if (error() == ERROR_BAD_PASSPHRASE || error() == ERROR_BAD_WEPKEY) + 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) return true; // For 802.1x networks, configuration is required if connectable is false // unless we're using a certificate pattern. |