device: set user-explicit unmanaged flag based on loaded device-state
On restart, the device state may be stored in /var/run. Reuse it to set the managed flag.
This commit is contained in:
@@ -2266,10 +2266,24 @@ platform_link_added (NMManager *self,
|
|||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
|
NMUnmanFlagOp unmanaged_user_explicit = NM_UNMAN_FLAG_OP_FORGET;
|
||||||
|
|
||||||
|
if (dev_state) {
|
||||||
|
switch (dev_state->managed) {
|
||||||
|
case NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_MANAGED:
|
||||||
|
unmanaged_user_explicit = NM_UNMAN_FLAG_OP_SET_MANAGED;
|
||||||
|
break;
|
||||||
|
case NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNMANAGED:
|
||||||
|
unmanaged_user_explicit = NM_UNMAN_FLAG_OP_SET_UNMANAGED;
|
||||||
|
break;
|
||||||
|
case NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNKNOWN:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (nm_device_realize_start (device,
|
if (nm_device_realize_start (device,
|
||||||
plink,
|
plink,
|
||||||
NM_UNMAN_FLAG_OP_FORGET,
|
unmanaged_user_explicit,
|
||||||
NULL,
|
NULL,
|
||||||
&error)) {
|
&error)) {
|
||||||
add_device (self, device, NULL);
|
add_device (self, device, NULL);
|
||||||
|
Reference in New Issue
Block a user