diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2013-11-29 14:59:48 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2013-11-29 15:42:37 +0100 |
commit | 6c96f5f7776b7c5a86512be3fd2ea24d61e4c6a0 (patch) | |
tree | 8032a9e9003ce3617b9211fe5632bfa77890c845 | |
parent | aa54604f5974a9dd47d80f0e952cc88ae1036636 (diff) | |
download | NetworkManager-6c96f5f7776b7c5a86512be3fd2ea24d61e4c6a0.tar.gz |
manager: fix connection auto-activation in timestamp-based order (rh #1029854)
This commit fixes a regression from a1f16cd4d9fff66d7feeee0846e554c9c3a5f998
(nm-policy.c change).
https://bugzilla.redhat.com/show_bug.cgi?id=1029854
-rw-r--r-- | src/nm-manager.c | 8 | ||||
-rw-r--r-- | src/settings/nm-settings.c | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index adb8d72185..77b042c2a0 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -429,6 +429,12 @@ find_ac_for_connection (NMManager *manager, NMConnection *connection) return NULL; } +/* Filter out connections that are already active. + * nm_settings_get_connections() returns sorted list. We need to preserve the + * order so that we didn't change auto-activation order (recent timestamps + * are first). + * Caller is responsible for freeing the returned list with g_slist_free(). + */ GSList * nm_manager_get_activatable_connections (NMManager *manager) { @@ -445,7 +451,7 @@ nm_manager_get_activatable_connections (NMManager *manager) } g_slist_free (all_connections); - return connections; + return g_slist_reverse (connections); } static NMActiveConnection * diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index be413f8759..c08ccfb744 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -331,8 +331,10 @@ connection_sort (gconstpointer pa, gconstpointer pb) return 1; } -/* Returns a list of NMSettingsConnections. Caller must free the list with - * g_slist_free(). +/* Returns a list of NMSettingsConnections. + * The list is sorted in the order suitable for auto-connecting, i.e. + * first go connections with autoconnect=yes and most recent timestamp. + * Caller must free the list with g_slist_free(). */ GSList * nm_settings_get_connections (NMSettings *self) |