From 3355ba9380df42960989b613b5ec9a2eefd28774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Mon, 15 Sep 2025 14:43:22 +0200 Subject: [PATCH 1/3] core: rename NM_STATE_ASLEEP to NM_STATE_DISABLED When we do `nmcli networking off` it's shown as state "sleeping". This is confusing, and the only reason is that we share internally code to handle both situations in a similar way. Rename the state to the more generic name "disabled", situation that can happen either because of sleeping or networking off. Clients cannot differentiate the exact reason only with the NMState value, but better that they show "network off" as this is the most common reason that they will be able to display. If the system is suspending, there will be only a short period of time that they can show the state, and showing "network off" is not wrong because that's what NM has done as a response to suspend. In the logs, let's make explicit the exact reason why state is changing to DISABLED: sleeping or networking off. Logs before: manager: disable requested (sleeping: no enabled: yes) manager: NetworkManager state is now ASLEEP Logs after: manager: disable requested (sleeping: no enabled: yes) manager: NetworkManager state is now DISABLED (NEWORKING OFF) State before: $ nmcli general STATE ... asleep ... State after: $ nmcli general STATE ... network off ... --- examples/C/glib/monitor-nm-state-gdbus.c | 4 +-- src/core/nm-manager.c | 33 ++++++++++++++--------- src/core/nm-policy.c | 2 +- src/libnm-core-public/nm-dbus-interface.h | 9 ++++--- src/libnmc-setting/nm-meta-setting-desc.h | 3 ++- src/nmcli/general.c | 6 ++--- src/nmcli/nmcli.c | 1 + 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/examples/C/glib/monitor-nm-state-gdbus.c b/examples/C/glib/monitor-nm-state-gdbus.c index 927c966cc8..9ef8757df9 100644 --- a/examples/C/glib/monitor-nm-state-gdbus.c +++ b/examples/C/glib/monitor-nm-state-gdbus.c @@ -23,8 +23,8 @@ static const char * nm_state_to_string(NMState state) { switch (state) { - case NM_STATE_ASLEEP: - return "asleep"; + case NM_STATE_DISABLED: + return "network off"; case NM_STATE_CONNECTING: return "connecting"; case NM_STATE_CONNECTED_LOCAL: diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index 9dc7bc0115..6ebeb086d9 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -1960,7 +1960,7 @@ find_device_by_iface(NMManager *self, } static gboolean -manager_sleeping(NMManager *self) +manager_is_disabled(NMManager *self) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); @@ -1973,8 +1973,8 @@ static const char * _nm_state_to_string(NMState state) { switch (state) { - case NM_STATE_ASLEEP: - return "ASLEEP"; + case NM_STATE_DISABLED: + return "DISABLED"; case NM_STATE_DISCONNECTED: return "DISCONNECTED"; case NM_STATE_DISCONNECTING: @@ -2078,15 +2078,18 @@ nm_manager_update_state(NMManager *self) { NMManagerPrivate *priv; NMState new_state = NM_STATE_DISCONNECTED; + const char *detail = ""; g_return_if_fail(NM_IS_MANAGER(self)); priv = NM_MANAGER_GET_PRIVATE(self); - if (manager_sleeping(self)) - new_state = NM_STATE_ASLEEP; - else + if (manager_is_disabled(self)) { + new_state = NM_STATE_DISABLED; + detail = priv->sleeping ? " (ASLEEP)" : " (NETWORKING OFF)"; + } else { new_state = find_best_device_state(self); + } if (new_state >= NM_STATE_CONNECTED_LOCAL && priv->connectivity_state == NM_CONNECTIVITY_FULL) { new_state = NM_STATE_CONNECTED_GLOBAL; @@ -2097,7 +2100,7 @@ nm_manager_update_state(NMManager *self) priv->state = new_state; - _LOGI(LOGD_CORE, "NetworkManager state is now %s", _nm_state_to_string(new_state)); + _LOGI(LOGD_CORE, "NetworkManager state is now %s%s", _nm_state_to_string(new_state), detail); _notify(self, PROP_STATE); nm_dbus_object_emit_signal(NM_DBUS_OBJECT(self), @@ -2956,7 +2959,7 @@ _rfkill_update_devices(NMManager *self, NMRfkillType rtype, gboolean enabled) _notify(self, _rfkill_type_desc[rtype].prop_id); /* Don't touch devices if asleep/networking disabled */ - if (manager_sleeping(self)) + if (manager_is_disabled(self)) return; /* enable/disable wireless devices as required */ @@ -3120,7 +3123,7 @@ _rfkill_update_from_user(NMManager *self, NMRfkillType rtype, gboolean enabled) gboolean old_enabled, new_enabled; /* Don't touch devices if asleep/networking disabled */ - if (manager_sleeping(self)) + if (manager_is_disabled(self)) return; _LOGD(LOGD_RFKILL, @@ -4079,7 +4082,7 @@ add_device(NMManager *self, NMDevice *device, GError **error) nm_device_set_unmanaged_by_user_settings(device, TRUE); - nm_device_set_unmanaged_flags(device, NM_UNMANAGED_SLEEPING, manager_sleeping(self)); + nm_device_set_unmanaged_flags(device, NM_UNMANAGED_SLEEPING, manager_is_disabled(self)); dbus_path = nm_dbus_object_export(NM_DBUS_OBJECT(device)); _LOG2I(LOGD_DEVICE, device, "new %s device (%s)", type_desc, dbus_path); @@ -7352,8 +7355,10 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) suspending = sleeping_changed && priv->sleeping; waking_from_suspend = sleeping_changed && !priv->sleeping; - if (manager_sleeping(self)) { - _LOGD(LOGD_SUSPEND, "sleep: %s...", suspending ? "sleeping" : "disabling"); + if (manager_is_disabled(self)) { + _LOGD(suspending ? LOGD_SUSPEND : LOGD_CORE, + "%s...", + suspending ? "sleep: sleeping" : "networking: disabling"); /* FIXME: are there still hardware devices that need to be disabled around * suspend/resume? @@ -7379,7 +7384,9 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) _handle_device_takedown(self, device, suspending, FALSE); } } else { - _LOGD(LOGD_SUSPEND, "sleep: %s...", waking_from_suspend ? "waking up" : "re-enabling"); + _LOGD(waking_from_suspend ? LOGD_SUSPEND : LOGD_CORE, + "%s...", + waking_from_suspend ? "sleep: waking up" : "networking: re-enabling"); sleep_devices_clear(self); diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index fbcee40dfb..31d960b511 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -1845,7 +1845,7 @@ nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device priv = NM_POLICY_GET_PRIVATE(self); - if (nm_manager_get_state(priv->manager) == NM_STATE_ASLEEP) + if (nm_manager_get_state(priv->manager) == NM_STATE_DISABLED) return; if (!nm_device_autoconnect_allowed(device)) diff --git a/src/libnm-core-public/nm-dbus-interface.h b/src/libnm-core-public/nm-dbus-interface.h index 78241193a4..5bbe7f98ee 100644 --- a/src/libnm-core-public/nm-dbus-interface.h +++ b/src/libnm-core-public/nm-dbus-interface.h @@ -145,8 +145,10 @@ typedef enum { * and not disable controls that require network access. * The graphical shells may hide the network accessibility indicator altogether * since no meaningful status indication can be provided. - * @NM_STATE_ASLEEP: Networking is not enabled, the system is being suspended or - * resumed from suspend. + * @NM_STATE_ASLEEP: Deprecated: 1.56: Use %NM_STATE_DISABLED instead. + * @NM_STATE_DISABLED: NetworkManager is disabled, either because the user requested + * to disable networking or because the system is suspended or resuming from suspend. + * Since: 1.56. * @NM_STATE_DISCONNECTED: There is no active network connection. * The graphical shell should indicate no network connectivity and the * applications should not attempt to access the network. @@ -170,7 +172,8 @@ typedef enum { **/ typedef enum { NM_STATE_UNKNOWN = 0, - NM_STATE_ASLEEP = 10, + NM_STATE_ASLEEP = 10, /* Deprecated */ + NM_STATE_DISABLED = 10, NM_STATE_DISCONNECTED = 20, NM_STATE_DISCONNECTING = 30, NM_STATE_CONNECTING = 40, diff --git a/src/libnmc-setting/nm-meta-setting-desc.h b/src/libnmc-setting/nm-meta-setting-desc.h index 0294b1f706..9efbd15c58 100644 --- a/src/libnmc-setting/nm-meta-setting-desc.h +++ b/src/libnmc-setting/nm-meta-setting-desc.h @@ -116,7 +116,8 @@ typedef enum { NM_META_COLOR_PERMISSION_UNKNOWN, NM_META_COLOR_PERMISSION_YES, NM_META_COLOR_PROMPT, - NM_META_COLOR_STATE_ASLEEP, + NM_META_COLOR_STATE_DISABLED, + NM_META_COLOR_STATE_ASLEEP = NM_META_COLOR_STATE_DISABLED, /* Deprecated */ NM_META_COLOR_STATE_CONNECTED_GLOBAL, NM_META_COLOR_STATE_CONNECTED_LOCAL, NM_META_COLOR_STATE_CONNECTED_SITE, diff --git a/src/nmcli/general.c b/src/nmcli/general.c index 2e9aad4438..a2772ca32a 100644 --- a/src/nmcli/general.c +++ b/src/nmcli/general.c @@ -28,7 +28,7 @@ static void permission_changed(GObject *gobject, GParamSpec *pspec, NmCli *nmc); static NM_UTILS_LOOKUP_STR_DEFINE(nm_state_to_string, NMState, NM_UTILS_LOOKUP_DEFAULT(N_("unknown")), - NM_UTILS_LOOKUP_ITEM(NM_STATE_ASLEEP, N_("asleep")), + NM_UTILS_LOOKUP_ITEM(NM_STATE_DISABLED, N_("network off")), NM_UTILS_LOOKUP_ITEM(NM_STATE_CONNECTING, N_("connecting")), NM_UTILS_LOOKUP_ITEM(NM_STATE_CONNECTED_LOCAL, N_("connected (local only)")), @@ -53,8 +53,8 @@ state_to_color(NMState state) return NM_META_COLOR_STATE_CONNECTED_GLOBAL; case NM_STATE_DISCONNECTING: return NM_META_COLOR_STATE_DISCONNECTING; - case NM_STATE_ASLEEP: - return NM_META_COLOR_STATE_ASLEEP; + case NM_STATE_DISABLED: + return NM_META_COLOR_STATE_DISABLED; case NM_STATE_DISCONNECTED: return NM_META_COLOR_STATE_DISCONNECTED; default: diff --git a/src/nmcli/nmcli.c b/src/nmcli/nmcli.c index cfe4c5f4a7..09e15db977 100644 --- a/src/nmcli/nmcli.c +++ b/src/nmcli/nmcli.c @@ -581,6 +581,7 @@ static NM_UTILS_STRING_TABLE_LOOKUP_DEFINE( {"permission-unknown", NM_META_COLOR_PERMISSION_UNKNOWN}, {"permission-yes", NM_META_COLOR_PERMISSION_YES}, {"prompt", NM_META_COLOR_PROMPT}, + {"state-disabled", NM_META_COLOR_STATE_DISABLED}, {"state-asleep", NM_META_COLOR_STATE_ASLEEP}, {"state-connected-global", NM_META_COLOR_STATE_CONNECTED_GLOBAL}, {"state-connected-local", NM_META_COLOR_STATE_CONNECTED_LOCAL}, From f6d6a7e2eb924b9b5addebedd8b6ed9b96d44377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Mon, 15 Sep 2025 15:05:36 +0200 Subject: [PATCH 2/3] core, libnm: add the "networking off" reason When we disable networking with `nmcli networking off` the reason that is logged is "sleeping". Explain instead that networking is disabled. Before: device (lo): state change: activated -> deactivating (reason 'sleeping' ... After: device (lo): state change: activated -> deactivating (reason 'networking-off' ... --- src/core/devices/nm-device-utils.c | 3 ++- src/core/nm-manager.c | 18 +++++++++++------- src/libnm-core-public/nm-dbus-interface.h | 3 ++- src/libnmc-base/nm-client-utils.c | 1 + 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/core/devices/nm-device-utils.c b/src/core/devices/nm-device-utils.c index 9fd7ac9dbf..61d8066a61 100644 --- a/src/core/devices/nm-device-utils.c +++ b/src/core/devices/nm-device-utils.c @@ -141,7 +141,8 @@ NM_UTILS_LOOKUP_STR_DEFINE( "unmanaged-user-explicit"), NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_USER_SETTINGS, "unmanaged-user-settings"), - NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_USER_UDEV, "unmanaged-user-udev"), ); + NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_USER_UDEV, "unmanaged-user-udev"), + NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_NETWORKING_OFF, "networking-off"), ); NM_UTILS_LOOKUP_STR_DEFINE(nm_device_mtu_source_to_string, NMDeviceMtuSource, diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index 6ebeb086d9..b614ec6a36 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -7324,24 +7324,26 @@ _handle_device_takedown(NMManager *self, gboolean suspending, gboolean is_shutdown) { + gboolean is_sleep = suspending || is_shutdown; + NMDeviceStateReason reason = + is_sleep ? NM_DEVICE_STATE_REASON_SLEEPING : NM_DEVICE_STATE_REASON_NETWORKING_OFF; + nm_device_notify_sleeping(device); if (nm_device_is_activating(device) || nm_device_get_state(device) == NM_DEVICE_STATE_ACTIVATED) { - _LOGD(LOGD_SUSPEND, + _LOGD(is_sleep ? LOGD_SUSPEND : LOGD_CORE, "%s: wait disconnection of device %s", - is_shutdown ? "shutdown" : "sleep", + is_sleep ? (is_shutdown ? "shutdown" : "sleep") : "networking off", nm_device_get_ip_iface(device)); if (sleep_devices_add(self, device, suspending)) - nm_device_queue_state(device, - NM_DEVICE_STATE_DEACTIVATING, - NM_DEVICE_STATE_REASON_SLEEPING); + nm_device_queue_state(device, NM_DEVICE_STATE_DEACTIVATING, reason); } else { nm_device_set_unmanaged_by_flags(device, NM_UNMANAGED_SLEEPING, NM_UNMAN_FLAG_OP_SET_UNMANAGED, - NM_DEVICE_STATE_REASON_SLEEPING); + reason); } } @@ -7431,7 +7433,9 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) && !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_SLEEPING)) { /* DHCP leases of software devices could have gone stale * so we need to renew them. */ - nm_device_update_dynamic_ip_setup(device, "wake up"); + nm_device_update_dynamic_ip_setup(device, + waking_from_suspend ? "wake up" + : "networking on"); continue; } diff --git a/src/libnm-core-public/nm-dbus-interface.h b/src/libnm-core-public/nm-dbus-interface.h index 5bbe7f98ee..65b007ccf1 100644 --- a/src/libnm-core-public/nm-dbus-interface.h +++ b/src/libnm-core-public/nm-dbus-interface.h @@ -645,7 +645,7 @@ typedef enum { * via settings plugin ('unmanaged-devices' for keyfile or 'NM_CONTROLLED=no' for ifcfg-rh). * Since: 1.48 * @NM_DEVICE_STATE_REASON_UNMANAGED_USER_UDEV: The device is unmanaged via udev rule. Since: 1.48 - + * @NM_DEVICE_STATE_REASON_NETWORKING_OFF: NetworkManager was disabled (networking off). Since: 1.56 * * Device state change reason codes */ @@ -728,6 +728,7 @@ typedef enum { NM_DEVICE_STATE_REASON_UNMANAGED_USER_EXPLICIT = 75, NM_DEVICE_STATE_REASON_UNMANAGED_USER_SETTINGS = 76, NM_DEVICE_STATE_REASON_UNMANAGED_USER_UDEV = 77, + NM_DEVICE_STATE_REASON_NETWORKING_OFF = 78, } NMDeviceStateReason; /** diff --git a/src/libnmc-base/nm-client-utils.c b/src/libnmc-base/nm-client-utils.c index c036c500e9..858b17b28a 100644 --- a/src/libnmc-base/nm-client-utils.c +++ b/src/libnmc-base/nm-client-utils.c @@ -492,6 +492,7 @@ NM_UTILS_LOOKUP_STR_DEFINE( NM_UTILS_LOOKUP_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_EXTERNAL_DOWN, N_("The device is unmanaged because it is an external device and is " "unconfigured (down or without addresses)")), + NM_UTILS_LOOKUP_ITEM(NM_DEVICE_STATE_REASON_NETWORKING_OFF, N_("Networking was disabled")), ); From 48fc40e1ca68724877c931d1add0c47702d3c773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Mon, 15 Sep 2025 15:12:19 +0200 Subject: [PATCH 3/3] core: rename unmanaged flag SLEEPING->MANAGER_DISABLED The flag is used for both sleeping and networking disabled conditions. This is because internally they share logic, but it's not obvious for users and it has caused confusion in the past when investigating why devices didn't become managed. Make it explicit that it can be because of either reason. It would be better to create two separate flags, actually, and it doesn't seem complex, but better not to risk introducing bugs for that little benefit. Logs before: device (enp4s0): state change: disconnected -> unmanaged (reason 'unmanaged-sleeping' ... Logs before: device (enp4s0): state change: disconnected -> unmanaged (reason 'unmanaged-nm-disabled' ... --- src/core/devices/nm-device-utils.c | 3 ++- src/core/devices/nm-device.c | 6 +++--- src/core/devices/nm-device.h | 13 +++++++------ src/core/nm-manager.c | 12 ++++++------ src/libnm-core-public/nm-dbus-interface.h | 9 ++++++--- src/libnmc-base/nm-client-utils.c | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/core/devices/nm-device-utils.c b/src/core/devices/nm-device-utils.c index 61d8066a61..a78499fb22 100644 --- a/src/core/devices/nm-device-utils.c +++ b/src/core/devices/nm-device-utils.c @@ -135,7 +135,8 @@ NM_UTILS_LOOKUP_STR_DEFINE( NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_LINK_NOT_INIT, "unmanaged-link-not-init"), NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_QUITTING, "unmanaged-quitting"), - NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING, "unmanaged-sleeping"), + NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_MANAGER_DISABLED, + "unmanaged-nm-disabled"), NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_USER_CONF, "unmanaged-user-conf"), NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_USER_EXPLICIT, "unmanaged-user-explicit"), diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index d4ca304adf..3cd8e78178 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -15665,7 +15665,7 @@ nm_device_get_firmware_missing(NMDevice *self) NM_UTILS_FLAGS2STR_DEFINE(nm_unmanaged_flags2str, NMUnmanagedFlags, - NM_UTILS_FLAGS2STR(NM_UNMANAGED_SLEEPING, "sleeping"), + NM_UTILS_FLAGS2STR(NM_UNMANAGED_MANAGER_DISABLED, "nm-disabled"), NM_UTILS_FLAGS2STR(NM_UNMANAGED_QUITTING, "quitting"), NM_UTILS_FLAGS2STR(NM_UNMANAGED_PLATFORM_INIT, "platform-init"), NM_UTILS_FLAGS2STR(NM_UNMANAGED_USER_EXPLICIT, "user-explicit"), @@ -15729,8 +15729,8 @@ unmanaged_flags_to_reason(NMUnmanagedFlags flags) /* Even if there are multiple flags, we can only return one reason. * Return the most important reason. */ - if (NM_FLAGS_HAS(flags, NM_UNMANAGED_SLEEPING)) - return NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING; + if (NM_FLAGS_HAS(flags, NM_UNMANAGED_MANAGER_DISABLED)) + return NM_DEVICE_STATE_REASON_UNMANAGED_MANAGER_DISABLED; if (NM_FLAGS_HAS(flags, NM_UNMANAGED_QUITTING)) return NM_DEVICE_STATE_REASON_UNMANAGED_QUITTING; if (NM_FLAGS_HAS(flags, NM_UNMANAGED_USER_SETTINGS)) diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h index 9a663c2a95..820951ea6a 100644 --- a/src/core/devices/nm-device.h +++ b/src/core/devices/nm-device.h @@ -581,7 +581,8 @@ void nm_device_copy_ip6_dns_config(NMDevice *self, NMDevice *from_device); /** * NMUnmanagedFlags: * @NM_UNMANAGED_NONE: placeholder value - * @NM_UNMANAGED_SLEEPING: %TRUE when unmanaged because NM is sleeping. + * @NM_UNMANAGED_MANAGER_DISABLED: %TRUE when unmanaged because NM is disabled. + * Currently, this happens when sleeping or with networking disabled. * @NM_UNMANAGED_QUITTING: %TRUE when unmanaged because NM is shutting down. * @NM_UNMANAGED_PLATFORM_INIT: %TRUE when unmanaged because platform link not * yet initialized. Unrealized device are also unmanaged for this reason. @@ -610,11 +611,11 @@ typedef enum { /* these flags are authoritative. If one of them is set, * the device cannot be managed. */ - NM_UNMANAGED_SLEEPING = (1LL << 0), - NM_UNMANAGED_QUITTING = (1LL << 1), - NM_UNMANAGED_PLATFORM_INIT = (1LL << 2), - NM_UNMANAGED_USER_EXPLICIT = (1LL << 3), - NM_UNMANAGED_USER_SETTINGS = (1LL << 4), + NM_UNMANAGED_MANAGER_DISABLED = (1LL << 0), + NM_UNMANAGED_QUITTING = (1LL << 1), + NM_UNMANAGED_PLATFORM_INIT = (1LL << 2), + NM_UNMANAGED_USER_EXPLICIT = (1LL << 3), + NM_UNMANAGED_USER_SETTINGS = (1LL << 4), /* These flags can be non-effective and be overwritten * by other flags. */ diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index b614ec6a36..060e0c2c7c 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -4082,7 +4082,7 @@ add_device(NMManager *self, NMDevice *device, GError **error) nm_device_set_unmanaged_by_user_settings(device, TRUE); - nm_device_set_unmanaged_flags(device, NM_UNMANAGED_SLEEPING, manager_is_disabled(self)); + nm_device_set_unmanaged_flags(device, NM_UNMANAGED_MANAGER_DISABLED, manager_is_disabled(self)); dbus_path = nm_dbus_object_export(NM_DBUS_OBJECT(device)); _LOG2I(LOGD_DEVICE, device, "new %s device (%s)", type_desc, dbus_path); @@ -7302,7 +7302,7 @@ device_sleep_cb(NMDevice *device, GParamSpec *pspec, NMManager *self) case NM_DEVICE_STATE_DISCONNECTED: _LOGD(LOGD_SUSPEND, "sleep: unmanaging device %s", nm_device_get_ip_iface(device)); nm_device_set_unmanaged_by_flags_queue(device, - NM_UNMANAGED_SLEEPING, + NM_UNMANAGED_MANAGER_DISABLED, NM_UNMAN_FLAG_OP_SET_UNMANAGED, NM_DEVICE_STATE_REASON_SLEEPING); break; @@ -7341,7 +7341,7 @@ _handle_device_takedown(NMManager *self, nm_device_queue_state(device, NM_DEVICE_STATE_DEACTIVATING, reason); } else { nm_device_set_unmanaged_by_flags(device, - NM_UNMANAGED_SLEEPING, + NM_UNMANAGED_MANAGER_DISABLED, NM_UNMAN_FLAG_OP_SET_UNMANAGED, reason); } @@ -7402,7 +7402,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) */ if (device_is_wake_on_lan(priv->platform, device)) nm_device_set_unmanaged_by_flags(device, - NM_UNMANAGED_SLEEPING, + NM_UNMANAGED_MANAGER_DISABLED, NM_UNMAN_FLAG_OP_SET_UNMANAGED, NM_DEVICE_STATE_REASON_SLEEPING); @@ -7430,7 +7430,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) guint i; if (nm_device_is_software(device) - && !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_SLEEPING)) { + && !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_MANAGER_DISABLED)) { /* DHCP leases of software devices could have gone stale * so we need to renew them. */ nm_device_update_dynamic_ip_setup(device, @@ -7466,7 +7466,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed) ? NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED : NM_DEVICE_STATE_REASON_NOW_MANAGED; nm_device_set_unmanaged_by_flags(device, - NM_UNMANAGED_SLEEPING, + NM_UNMANAGED_MANAGER_DISABLED, NM_UNMAN_FLAG_OP_SET_MANAGED, reason); } diff --git a/src/libnm-core-public/nm-dbus-interface.h b/src/libnm-core-public/nm-dbus-interface.h index 65b007ccf1..e62d64e10f 100644 --- a/src/libnm-core-public/nm-dbus-interface.h +++ b/src/libnm-core-public/nm-dbus-interface.h @@ -635,8 +635,10 @@ typedef enum { * not initialized by udev. Since: 1.48 * @NM_DEVICE_STATE_REASON_UNMANAGED_QUITTING: The device is unmanaged because NetworkManager is * quitting. Since: 1.48 - * @NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING: The device is unmanaged because networking is - * disabled or the system is suspended. Since: 1.48 + * @NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING: Since: 1.48. Deprecated: 1.56: Use + * %NM_DEVICE_STATE_REASON_UNMANAGED_MANAGER_DISABLED instead. + * @NM_DEVICE_STATE_REASON_UNMANAGED_MANAGER_DISABLED: The device is unmanaged because networking is + * disabled or the system is suspended. Since: 1.56 * @NM_DEVICE_STATE_REASON_UNMANAGED_USER_CONF: The device is unmanaged by user decision in * NetworkManager.conf ('unmanaged' in a [device*] section). Since: 1.48 * @NM_DEVICE_STATE_REASON_UNMANAGED_USER_EXPLICIT: The device is unmanaged by explicit user @@ -723,7 +725,8 @@ typedef enum { NM_DEVICE_STATE_REASON_UNMANAGED_EXTERNAL_DOWN = 70, NM_DEVICE_STATE_REASON_UNMANAGED_LINK_NOT_INIT = 71, NM_DEVICE_STATE_REASON_UNMANAGED_QUITTING = 72, - NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING = 73, + NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING = 73, /* Deprecated */ + NM_DEVICE_STATE_REASON_UNMANAGED_MANAGER_DISABLED = 73, NM_DEVICE_STATE_REASON_UNMANAGED_USER_CONF = 74, NM_DEVICE_STATE_REASON_UNMANAGED_USER_EXPLICIT = 75, NM_DEVICE_STATE_REASON_UNMANAGED_USER_SETTINGS = 76, diff --git a/src/libnmc-base/nm-client-utils.c b/src/libnmc-base/nm-client-utils.c index 858b17b28a..a24a75b65c 100644 --- a/src/libnmc-base/nm-client-utils.c +++ b/src/libnmc-base/nm-client-utils.c @@ -467,7 +467,7 @@ NM_UTILS_LOOKUP_STR_DEFINE( N_("The Wi-Fi P2P peer could not be found")), NM_UTILS_LOOKUP_ITEM(NM_DEVICE_STATE_REASON_DEVICE_HANDLER_FAILED, N_("The device handler dispatcher returned an error")), - NM_UTILS_LOOKUP_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_SLEEPING, + NM_UTILS_LOOKUP_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_MANAGER_DISABLED, N_("The device is unmanaged because networking is disabled " "or the system is suspended")), NM_UTILS_LOOKUP_ITEM(NM_DEVICE_STATE_REASON_UNMANAGED_QUITTING,