mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 22:50:28 +01:00
ifcfg-rh: fix storing connections in the hash table
We have to copy the UUID (key) because otherwise the pointer can be invalidated when the connection is destroyed and problems will start. The issue showed up as an unability to delete a conenction via D-Bus. Reproducer: $ nmcli con add type eth con-name AAA ifname blah $ nmcli con delete AAA $ nmcli con add type eth con-name AAA ifname blah $ nmcli con delete AAA -- here the connection is not removed from NM (even though ifcfg- file) was removed --
This commit is contained in:
parent
5c705e643a
commit
eea23747ce
1 changed files with 2 additions and 2 deletions
|
|
@ -145,7 +145,7 @@ _internal_new_connection (SCPluginIfcfg *self,
|
|||
g_assert (cid);
|
||||
|
||||
g_hash_table_insert (priv->connections,
|
||||
(gpointer) nm_connection_get_uuid (NM_CONNECTION (connection)),
|
||||
g_strdup (nm_connection_get_uuid (NM_CONNECTION (connection))),
|
||||
connection);
|
||||
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, " read connection '%s'", cid);
|
||||
|
||||
|
|
@ -733,7 +733,7 @@ sc_plugin_ifcfg_init (SCPluginIfcfg *plugin)
|
|||
GFile *file;
|
||||
GFileMonitor *monitor;
|
||||
|
||||
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
|
||||
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
||||
|
||||
/* We watch SC_NETWORK_FILE via NMInotifyHelper (which doesn't track file creation but
|
||||
* *does* track modifications made via other hard links), since we expect it to always
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue