merge: branch 'ih/conn_timestamp'

manager: save timestamps when shutting down

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1946
This commit is contained in:
Íñigo Huguet
2024-05-23 05:54:31 +00:00

View File

@@ -7960,6 +7960,7 @@ nm_manager_write_device_state_all(NMManager *self)
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self);
gs_unref_hashtable GHashTable *preserve_ifindexes = NULL;
NMDevice *device;
NMActiveConnection *ac;
preserve_ifindexes = g_hash_table_new(nm_direct_hash, NULL);
@@ -7971,6 +7972,14 @@ nm_manager_write_device_state_all(NMManager *self)
}
}
/* Save to disk the timestamps of active connections as if we were bringing them down.
* Otherwise they will be wrong on next start and affect the activation order.
*/
c_list_for_each_entry (ac, &priv->active_connections_lst_head, active_connections_lst) {
NMSettingsConnection *sett = nm_active_connection_get_settings_connection(ac);
nm_settings_connection_update_timestamp(sett, (guint64) time(NULL));
}
nm_config_device_state_prune_stale(preserve_ifindexes, NULL);
}