mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-10 03:30:19 +01:00
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' ...
This commit is contained in:
parent
3355ba9380
commit
f6d6a7e2eb
4 changed files with 16 additions and 9 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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")),
|
||||
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue