if (nm_device_get_act_request (data->device))
goto out;
- /* System connections first, then user connections */
- connections = nm_manager_get_connections (policy->manager, NM_CONNECTION_SCOPE_SYSTEM);
- if (nm_manager_auto_user_connections_allowed (policy->manager))
- connections = g_slist_concat (connections, nm_manager_get_connections (policy->manager, NM_CONNECTION_SCOPE_USER));
+ connections = nm_settings_get_connections (policy->settings);
- /* Remove connections that are in the invalid list. */
+ /* Remove connections that have INVALID_TAG and shouldn't be retried any more. */
iter = connections;
while (iter) {
NMConnection *iter_connection = NM_CONNECTION (iter->data);
}
while ((item = g_dir_read_name (dir))) {
- NMKeyfileConnection *connection;
+ NMSysconfigConnection *connection;
char *full_path;
+ if (utils_should_ignore_file (item))
+ continue;
+
full_path = g_build_filename (KEYFILE_DIR, item, NULL);
PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "parsing %s ... ", item);
- connection = nm_keyfile_connection_new (full_path, &error);
- if (connection) {
- NMSettingConnection *s_con;
- const char *cid;
-
- s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION);
- g_assert (s_con);
-
- cid = nm_setting_connection_get_id (s_con);
- g_assert (cid);
-
- g_hash_table_insert (priv->hash,
- (gpointer) nm_keyfile_connection_get_filename (connection),
- connection);
+ connection = _internal_new_connection (self, full_path, NULL, &cid, &error);
+ if (connection) {
PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, " read connection '%s'", cid);
} else {
PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, " error: %s",
NMKeyfileConnection *connection;
GError *error = NULL;
- name = g_file_get_path (file);
- if (utils_should_ignore_file (name)) {
- g_free (name);
+ full_path = g_file_get_path (file);
++ if (utils_should_ignore_file (full_path)) {
++ g_free (full_path);
+ return;
+ }
+
- connection = g_hash_table_lookup (priv->hash, name);
+ connection = g_hash_table_lookup (priv->hash, full_path);
switch (event_type) {
case G_FILE_MONITOR_EVENT_DELETED:
/* Update */
NMKeyfileConnection *tmp;
- tmp = nm_keyfile_connection_new (name, &error);
+ tmp = nm_keyfile_connection_new (full_path, NULL, &error);
if (tmp) {
- update_connection_settings (connection, tmp);
+ if (!nm_connection_compare (NM_CONNECTION (connection),
+ NM_CONNECTION (tmp),
+ NM_SETTING_COMPARE_FLAG_EXACT)) {
+ PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "updating %s", name);
+ update_connection_settings (connection, tmp);
+ }
g_object_unref (tmp);
} else {
/* Error; remove the connection */
PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, " error: %s",
(error && error->message) ? error->message : "(unknown)");
g_clear_error (&error);
- remove_connection (SC_PLUGIN_KEYFILE (config), connection, name);
+ remove_connection (SC_PLUGIN_KEYFILE (config), connection, full_path);
}
} else {
+ PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "updating %s", name);
+
/* New */
- connection = nm_keyfile_connection_new (name, &error);
+ connection = nm_keyfile_connection_new (full_path, NULL, &error);
if (connection) {
- NMSettingConnection *s_con;
- const char *connection_uuid;
NMKeyfileConnection *found = NULL;
+ NMSettingConnection *s_con;
/* Connection renames will show up as different files but with
* the same UUID. Try to find the original connection.