core: ensure newly-created master interfaces are ready for activation

Reverts part of

2226a00cc2
core: add a "default-unmanaged" setting for devices

Newly-created master interfaces are in the UNAVAILABLE state, but if
they were created in response to a slave connection being activated,
the master must be activated immediately too.  But a device cannot
be activated unless it's in the DISCONNECTED state, so restore that
state change.
This commit is contained in:
Dan Williams 2013-05-15 14:56:36 -05:00
parent 4ca885f5e3
commit 8bab0c8203

View file

@ -2858,6 +2858,18 @@ nm_manager_activate_connection (NMManager *manager,
"Failed to create virtual interface");
return NULL;
}
/* A newly created device, if allowed to be managed by NM, will be
* in the UNAVAILABLE state here. To ensure it can be activated
* immediately, we transition it to DISCONNECTED so it passes the
* nm_device_can_activate() check below.
*/
if ( nm_device_is_available (device)
&& (nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE)) {
nm_device_state_changed (device,
NM_DEVICE_STATE_DISCONNECTED,
NM_DEVICE_STATE_REASON_NONE);
}
}
}