mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 15:50:26 +01:00
core: don't realize unmanaged software devices
Currently, if user configuration or settings specify that a software device is unmanaged, for example: [device-bond-unmanaged] match-device=interface-name:bond* managed=0 or [keyfile] unmanaged-devices=interface-name:bond* and there is a connection for the device with autoconnect=yes, NM creates the platform link and a realized device in unmanaged state. Fix this, the device should not be realized if it is unmanaged. https://bugzilla.redhat.com/show_bug.cgi?id=1679230
This commit is contained in:
parent
adbf368511
commit
c0d5b58332
3 changed files with 37 additions and 1 deletions
|
|
@ -5315,7 +5315,8 @@ nm_device_autoconnect_allowed (NMDevice *self)
|
|||
if (priv->state < NM_DEVICE_STATE_DISCONNECTED)
|
||||
return FALSE;
|
||||
} else {
|
||||
/* Unrealized devices can always autoconnect. */
|
||||
if (!nm_device_check_unrealized_device_managed (self))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* The 'autoconnect-allowed' signal is emitted on a device to allow
|
||||
|
|
@ -13517,6 +13518,32 @@ nm_device_set_unmanaged_by_flags_queue (NMDevice *self,
|
|||
_set_unmanaged_flags (self, flags, set_op, TRUE, FALSE, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_check_unrealized_device_managed:
|
||||
*
|
||||
* Checks if a unrealized device is managed from user settings
|
||||
* or user configuration.
|
||||
*/
|
||||
gboolean
|
||||
nm_device_check_unrealized_device_managed (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
nm_assert (!nm_device_is_real (self));
|
||||
|
||||
if (!nm_config_data_get_device_config_boolean (NM_CONFIG_GET_DATA,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED,
|
||||
self,
|
||||
TRUE,
|
||||
TRUE))
|
||||
return FALSE;
|
||||
|
||||
if (nm_device_spec_match_list (self, nm_settings_get_unmanaged_specs (priv->settings)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_set_unmanaged_by_user_settings (NMDevice *self)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -691,6 +691,8 @@ void nm_device_set_unmanaged_by_user_udev (NMDevice *self);
|
|||
void nm_device_set_unmanaged_by_user_conf (NMDevice *self);
|
||||
void nm_device_set_unmanaged_by_quitting (NMDevice *device);
|
||||
|
||||
gboolean nm_device_check_unrealized_device_managed (NMDevice *self);
|
||||
|
||||
gboolean nm_device_is_nm_owned (NMDevice *device);
|
||||
|
||||
gboolean nm_device_has_capability (NMDevice *self, NMDeviceCapabilities caps);
|
||||
|
|
|
|||
|
|
@ -1995,6 +1995,13 @@ system_create_virtual_device (NMManager *self, NMConnection *connection)
|
|||
g_object_unref (device);
|
||||
}
|
||||
|
||||
if (!nm_device_check_unrealized_device_managed (device)) {
|
||||
_LOG3D (LOGD_DEVICE, connection,
|
||||
"skip activation because virtual device '%s' is unmanaged",
|
||||
nm_device_get_iface (device));
|
||||
return device;
|
||||
}
|
||||
|
||||
/* Create backing resources if the device has any autoconnect connections */
|
||||
connections = nm_settings_get_connections_clone (priv->settings, NULL,
|
||||
NULL, NULL,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue