device: only invalidate connections if they failed during activation

Otherwise, connections used to get marked invalid on hot-unplug, which
isn't really correct.
This commit is contained in:
Dan Williams 2009-09-09 12:21:55 -07:00
parent f28a0df4a6
commit 9b55936dee

View file

@ -765,8 +765,12 @@ device_state_changed (NMDevice *device,
switch (new_state) {
case NM_DEVICE_STATE_FAILED:
/* Mark the connection invalid so it doesn't get automatically chosen */
if (connection) {
/* Mark the connection invalid if it failed during activation so that
* it doesn't get automatically chosen over and over and over again.
*/
if ( connection
&& (old_state > NM_DEVICE_STATE_DISCONNECTED)
&& (old_state < NM_DEVICE_STATE_ACTIVATED)) {
g_object_set_data (G_OBJECT (connection), INVALID_TAG, GUINT_TO_POINTER (TRUE));
nm_info ("Marking connection '%s' invalid.", get_connection_id (connection));
nm_connection_clear_secrets (connection);