device: forget unmanaged-flag "user-explicit" for unrealized devices
When a software device unrealizes, we want to forget about the "user-explict" unmanaged state. It means, that after a software device is deleted, the "user-explict" managed flag will be cleared for that device. It might be nice to preserve the managed-state after deletion of the device. However, the unrealized-device only exists as long as we have a connection for the device. That means, before this patch whether the unmanaged flag was forgotten depends on whether the user had some connections that keep the device alive as unrealized. That behavior was complicated, just don't do that.
This commit is contained in:
@@ -2526,6 +2526,7 @@ nm_device_unrealize (NMDevice *self, gboolean remove_resources, GError **error)
|
||||
NM_UNMANAGED_PARENT |
|
||||
NM_UNMANAGED_LOOPBACK |
|
||||
NM_UNMANAGED_USER_UDEV |
|
||||
NM_UNMANAGED_USER_EXPLICIT |
|
||||
NM_UNMANAGED_EXTERNAL_DOWN |
|
||||
NM_UNMANAGED_IS_SLAVE,
|
||||
NM_UNMAN_FLAG_OP_FORGET);
|
||||
@@ -12350,21 +12351,22 @@ set_property (GObject *object, guint prop_id,
|
||||
case PROP_IP4_ADDRESS:
|
||||
priv->ip4_address = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_MANAGED: {
|
||||
gboolean managed;
|
||||
NMDeviceStateReason reason;
|
||||
case PROP_MANAGED:
|
||||
if (nm_device_is_real (self)) {
|
||||
gboolean managed;
|
||||
NMDeviceStateReason reason;
|
||||
|
||||
managed = g_value_get_boolean (value);
|
||||
if (managed)
|
||||
reason = NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED;
|
||||
else
|
||||
reason = NM_DEVICE_STATE_REASON_REMOVED;
|
||||
nm_device_set_unmanaged_by_flags (self,
|
||||
NM_UNMANAGED_USER_EXPLICIT,
|
||||
!managed,
|
||||
reason);
|
||||
managed = g_value_get_boolean (value);
|
||||
if (managed)
|
||||
reason = NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED;
|
||||
else
|
||||
reason = NM_DEVICE_STATE_REASON_REMOVED;
|
||||
nm_device_set_unmanaged_by_flags (self,
|
||||
NM_UNMANAGED_USER_EXPLICIT,
|
||||
!managed,
|
||||
reason);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PROP_AUTOCONNECT:
|
||||
nm_device_set_autoconnect (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
Reference in New Issue
Block a user