mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 02:10:17 +01:00
ifcfg-rh: handle change from one unmanaged-spec to another
If an ifcfg file changed from one non-NULL unmanaged-spec to another (eg, if it previously had an interface-name: unmanaged-spec, and then you add a HWADDR line, switching it to a mac: unmanaged-spec), we were not updating the connection's unmanaged property, or emitting unmanaged-specs-changed. Also, remove the notify::unmanaged handler, since only plugin.c ever changes an existing NMIfcfgConnection's unmanaged property, and it always emits the signal itself afterward (and it needs to manually emit the signal in other cases anyway, like when a connection is removed).
This commit is contained in:
parent
8ec031fb0e
commit
84672c73e3
1 changed files with 5 additions and 23 deletions
|
|
@ -95,14 +95,6 @@ typedef struct {
|
|||
} SCPluginIfcfgPrivate;
|
||||
|
||||
|
||||
static void
|
||||
connection_unmanaged_changed (NMIfcfgConnection *connection,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_signal_emit_by_name (SC_PLUGIN_IFCFG (user_data), NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_ifcfg_changed (NMIfcfgConnection *connection, gpointer user_data)
|
||||
{
|
||||
|
|
@ -171,12 +163,6 @@ _internal_new_connection (SCPluginIfcfg *self,
|
|||
device_id = spec;
|
||||
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "Ignoring connection '%s' / device '%s' "
|
||||
"due to NM_CONTROLLED=no.", cid, device_id);
|
||||
} else {
|
||||
/* Wait for the connection to become unmanaged once it knows the
|
||||
* hardware IDs of its device, if/when the device gets plugged in.
|
||||
*/
|
||||
g_signal_connect (G_OBJECT (connection), "notify::" NM_IFCFG_CONNECTION_UNMANAGED,
|
||||
G_CALLBACK (connection_unmanaged_changed), self);
|
||||
}
|
||||
|
||||
/* watch changes of ifcfg hardlinks */
|
||||
|
|
@ -317,21 +303,18 @@ connection_new_or_changed (SCPluginIfcfg *self,
|
|||
}
|
||||
|
||||
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "updating %s", path);
|
||||
g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL);
|
||||
|
||||
if (new_unmanaged) {
|
||||
if (!old_unmanaged) {
|
||||
g_object_ref (existing);
|
||||
/* Unexport the connection by telling the settings service it's
|
||||
* been removed, and notify the settings service by signalling that
|
||||
* unmanaged specs have changed.
|
||||
* been removed.
|
||||
*/
|
||||
nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (existing));
|
||||
/* Remove the path so that claim_connection() doesn't complain later when
|
||||
* interface gets managed and connection is re-added. */
|
||||
nm_connection_set_path (NM_CONNECTION (existing), NULL);
|
||||
|
||||
g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL);
|
||||
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
|
||||
g_object_unref (existing);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -350,12 +333,11 @@ connection_new_or_changed (SCPluginIfcfg *self,
|
|||
/* Shouldn't ever get here as 'new' was verified by the reader already */
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
/* Update unmanaged status */
|
||||
g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL);
|
||||
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
|
||||
}
|
||||
g_object_unref (new);
|
||||
|
||||
if (g_strcmp0 (old_unmanaged, new_unmanaged))
|
||||
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue