mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-06 16:20:32 +01:00
fixup! core: device: allow to reset the managed property
This commit is contained in:
parent
a0733b936e
commit
a03d4f35cd
2 changed files with 17 additions and 6 deletions
|
|
@ -396,7 +396,7 @@
|
|||
|
||||
<!--
|
||||
SetManaged:
|
||||
@managed:(<link linkend="NMDeviceState">NMDeviceManaged</link>) Whether the device is managed. Possible values are "no" (0), "yes" (1) and "reset" (2).
|
||||
@managed:(<link linkend="NMDeviceManaged">NMDeviceManaged</link>) Whether the device is managed. Possible values are "no" (0), "yes" (1) and "reset" (2).
|
||||
@flags: (<link linkend="NMDeviceManagedFlags">NMDeviceManagedFlags</link>) flags.
|
||||
@since: 1.58
|
||||
|
||||
|
|
|
|||
|
|
@ -14962,6 +14962,8 @@ set_managed(NMDevice *self, NMDeviceManaged managed, NMDeviceManagedFlags flags,
|
|||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
NMTernary managed_to_disk, old = NM_TERNARY_DEFAULT;
|
||||
|
||||
nm_assert(
|
||||
NM_IN_SET(managed, NM_DEVICE_MANAGED_NO, NM_DEVICE_MANAGED_YES, NM_DEVICE_MANAGED_RESET));
|
||||
nm_assert((flags & ~NM_DEVICE_MANAGED_FLAGS_ALL) == 0);
|
||||
|
||||
if (!NM_FLAGS_ANY(flags, NM_DEVICE_MANAGED_FLAGS_PERMANENT | NM_DEVICE_MANAGED_FLAGS_RUNTIME)) {
|
||||
|
|
@ -15037,11 +15039,20 @@ set_managed_cb(NMDevice *self,
|
|||
flags = set_managed_data->managed_flags;
|
||||
nm_g_slice_free(set_managed_data);
|
||||
|
||||
if (!error && (flags & ~NM_DEVICE_MANAGED_FLAGS_ALL) != 0) {
|
||||
g_set_error_literal(&error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid flags");
|
||||
if (!error) {
|
||||
if (!NM_IN_SET(managed,
|
||||
NM_DEVICE_MANAGED_NO,
|
||||
NM_DEVICE_MANAGED_YES,
|
||||
NM_DEVICE_MANAGED_RESET))
|
||||
g_set_error_literal(&error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid managed value");
|
||||
else if ((flags & ~NM_DEVICE_MANAGED_FLAGS_ALL) != 0)
|
||||
g_set_error_literal(&error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid flags");
|
||||
}
|
||||
|
||||
if (error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue