devices: "deactivate" devices when going from UNMANAGED->UNAVAILABLE

We used to call nm_device_deactivate() when moving a device from
UNMANAGED to UNAVAILABLE (unless we were assuming the existing
connection), but this got lost when default-unmanaged was added. Fix
it to do this again, so the device will be in a known-clean state when
it is activated.
This commit is contained in:
Dan Winship 2013-10-24 12:36:22 -04:00
parent 7bc7da83ec
commit 46295e8fa1

View file

@ -6185,9 +6185,11 @@ nm_device_state_changed (NMDevice *device,
* carrier changes or rfkill. But don't deactivate devices that are
* about to assume a connection since that defeats the purpose of
* assuming the device's existing connection.
*
* Note that we "deactivate" the device even when coming from
* UNMANAGED, to ensure that it's in a clean state.
*/
if (reason != NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED &&
old_state != NM_DEVICE_STATE_UNMANAGED)
if (reason != NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED)
nm_device_deactivate (device, reason);
break;
case NM_DEVICE_STATE_DISCONNECTED: