Commit ae4535ba authored by Thomas Haller's avatar Thomas Haller

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.
parent f84b8f7a
......@@ -2266,10 +2266,24 @@ platform_link_added (NMManager *self,
if (device) {
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,
plink,
NM_UNMAN_FLAG_OP_FORGET,
unmanaged_user_explicit,
NULL,
&error)) {
add_device (self, device, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment