summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAna Cabral <acabral@redhat.com>2022-10-12 19:26:27 +0200
committerAna Cabral <acabral@redhat.com>2022-10-15 18:29:10 +0200
commit0a280c5a9316af8d04c1c4f0a6be6c4cfae8f928 (patch)
treefe54b47fafaa8947f9d79b07f23f86fac87b8768
parent412c7449b3e7922bf354c759632671cc4fccb3e6 (diff)
device: remove the possibility of inheriting the unmanaged condition from the parent of a deviceac/vlan
This commit is part of a broader change that eliminates inheriting the unmanaged condition from the parent of a device, for all device types: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1418 What motivates this change are the unncessary issues brought by this inheritance. You can see some problems described here: https://bugzilla.redhat.com/show_bug.cgi?id=2110307#c0.
-rw-r--r--src/core/devices/nm-device.c7
-rw-r--r--src/core/devices/nm-device.h22
-rw-r--r--src/core/nm-manager.c10
3 files changed, 17 insertions, 22 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index b5c368ebad..2e23b622c6 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -7667,9 +7667,9 @@ nm_device_unrealize(NMDevice *self, gboolean remove_resources, GError **error)
nm_device_set_unmanaged_flags(self, NM_UNMANAGED_PLATFORM_INIT, TRUE);
nm_device_set_unmanaged_flags(self,
- NM_UNMANAGED_PARENT | NM_UNMANAGED_BY_TYPE
- | NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_USER_EXPLICIT
- | NM_UNMANAGED_EXTERNAL_DOWN | NM_UNMANAGED_IS_SLAVE,
+ NM_UNMANAGED_BY_TYPE | NM_UNMANAGED_USER_UDEV
+ | NM_UNMANAGED_USER_EXPLICIT | NM_UNMANAGED_EXTERNAL_DOWN
+ | NM_UNMANAGED_IS_SLAVE,
NM_UNMAN_FLAG_OP_FORGET);
nm_device_state_changed(self,
@@ -14142,7 +14142,6 @@ NM_UTILS_FLAGS2STR_DEFINE(nm_unmanaged_flags2str,
NMUnmanagedFlags,
NM_UTILS_FLAGS2STR(NM_UNMANAGED_SLEEPING, "sleeping"),
NM_UTILS_FLAGS2STR(NM_UNMANAGED_QUITTING, "quitting"),
- NM_UTILS_FLAGS2STR(NM_UNMANAGED_PARENT, "parent"),
NM_UTILS_FLAGS2STR(NM_UNMANAGED_BY_TYPE, "by-type"),
NM_UTILS_FLAGS2STR(NM_UNMANAGED_PLATFORM_INIT, "platform-init"),
NM_UTILS_FLAGS2STR(NM_UNMANAGED_USER_EXPLICIT, "user-explicit"),
diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h
index fea46bb78c..3dfa572064 100644
--- a/src/core/devices/nm-device.h
+++ b/src/core/devices/nm-device.h
@@ -566,7 +566,6 @@ void nm_device_copy_ip6_dns_config(NMDevice *self, NMDevice *from_device);
* @NM_UNMANAGED_NONE: placeholder value
* @NM_UNMANAGED_SLEEPING: %TRUE when unmanaged because NM is sleeping.
* @NM_UNMANAGED_QUITTING: %TRUE when unmanaged because NM is shutting down.
- * @NM_UNMANAGED_PARENT: %TRUE when unmanaged due to parent device being unmanaged
* @NM_UNMANAGED_BY_TYPE: %TRUE for unmanaging device by type, like loopback.
* @NM_UNMANAGED_PLATFORM_INIT: %TRUE when unmanaged because platform link not
* yet initialized. Unrealized device are also unmanaged for this reason.
@@ -597,21 +596,20 @@ typedef enum {
* the device cannot be managed. */
NM_UNMANAGED_SLEEPING = (1LL << 0),
NM_UNMANAGED_QUITTING = (1LL << 1),
- NM_UNMANAGED_PARENT = (1LL << 2),
- NM_UNMANAGED_BY_TYPE = (1LL << 3),
- NM_UNMANAGED_PLATFORM_INIT = (1LL << 4),
- NM_UNMANAGED_USER_EXPLICIT = (1LL << 5),
- NM_UNMANAGED_USER_SETTINGS = (1LL << 6),
+ NM_UNMANAGED_BY_TYPE = (1LL << 2),
+ NM_UNMANAGED_PLATFORM_INIT = (1LL << 3),
+ NM_UNMANAGED_USER_EXPLICIT = (1LL << 4),
+ NM_UNMANAGED_USER_SETTINGS = (1LL << 5),
/* These flags can be non-effective and be overwritten
* by other flags. */
- NM_UNMANAGED_BY_DEFAULT = (1LL << 7),
- NM_UNMANAGED_USER_CONF = (1LL << 8),
- NM_UNMANAGED_USER_UDEV = (1LL << 9),
- NM_UNMANAGED_EXTERNAL_DOWN = (1LL << 10),
- NM_UNMANAGED_IS_SLAVE = (1LL << 11),
+ NM_UNMANAGED_BY_DEFAULT = (1LL << 6),
+ NM_UNMANAGED_USER_CONF = (1LL << 7),
+ NM_UNMANAGED_USER_UDEV = (1LL << 8),
+ NM_UNMANAGED_EXTERNAL_DOWN = (1LL << 9),
+ NM_UNMANAGED_IS_SLAVE = (1LL << 10),
- NM_UNMANAGED_ALL = ((1LL << 12) - 1),
+ NM_UNMANAGED_ALL = ((1LL << 11) - 1),
} NMUnmanagedFlags;
typedef enum {
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index bf1e57a8c6..7c04e8e4e5 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -3083,10 +3083,9 @@ recheck_assume_connection(NMManager *self, NMDevice *device)
g_return_val_if_fail(NM_IS_DEVICE(device), FALSE);
if (!nm_device_get_managed(device, FALSE)) {
- /* If the device is unmanaged by NM_UNMANAGED_PLATFORM_INIT or NM_UNMANAGED_PARENT,
+ /* If the device is unmanaged by NM_UNMANAGED_PLATFORM_INIT,
* don't reset the state now but wait until it becomes managed. */
- if (nm_device_get_unmanaged_flags(device, NM_UNMANAGED_ALL)
- & ~(NM_UNMANAGED_PLATFORM_INIT | NM_UNMANAGED_PARENT))
+ if (nm_device_get_unmanaged_flags(device, NM_UNMANAGED_ALL) & ~NM_UNMANAGED_PLATFORM_INIT)
nm_device_assume_state_reset(device);
_LOG2D(LOGD_DEVICE, device, "assume: don't assume because device is not managed");
return FALSE;
@@ -3410,10 +3409,9 @@ _device_realize_finish(NMManager *self, NMDevice *device, const NMPlatformLink *
nm_device_realize_finish(device, plink);
if (!nm_device_get_managed(device, FALSE)) {
- /* If the device is unmanaged by NM_UNMANAGED_PLATFORM_INIT or NM_UNMANAGED_PARENT,
+ /* If the device is unmanaged by NM_UNMANAGED_PLATFORM_INIT,
* don't reset the state now but wait until it becomes managed. */
- if (nm_device_get_unmanaged_flags(device, NM_UNMANAGED_ALL)
- & ~(NM_UNMANAGED_PLATFORM_INIT | NM_UNMANAGED_PARENT))
+ if (nm_device_get_unmanaged_flags(device, NM_UNMANAGED_ALL) & ~NM_UNMANAGED_PLATFORM_INIT)
nm_device_assume_state_reset(device);
return;
}