From 9b55936dee6904312932c8c03451e035aaa375ee Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 9 Sep 2009 12:21:55 -0700 Subject: [PATCH] device: only invalidate connections if they failed during activation Otherwise, connections used to get marked invalid on hot-unplug, which isn't really correct. --- src/NetworkManagerPolicy.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index 2cb39cb9ea..5adc91b850 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -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);