manager: fix connection auto-activation in timestamp-based order (rh #1029854)

This commit fixes a regression from a1f16cd4d9
(nm-policy.c change).

https://bugzilla.redhat.com/show_bug.cgi?id=1029854
This commit is contained in:
Jiří Klimeš 2013-11-29 14:59:48 +01:00
parent aa54604f59
commit 6c96f5f777
2 changed files with 11 additions and 3 deletions

View file

@ -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 *

View file

@ -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)