summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-02-27 09:09:43 -0600
committerDan Williams <dcbw@redhat.com>2014-02-27 12:57:59 -0600
commit39ab68481cf313ba8c2fe1cd92bf562607cd7754 (patch)
treec6191bca1efdf91637c828ae0855b3f9429b2db3
parent16cd4f6892f83d5e79eb1d7a6615bccceed565b2 (diff)
downloadNetworkManager-39ab68481cf313ba8c2fe1cd92bf562607cd7754.tar.gz
core: fix ActiveConnection handling of device disconnected state after e19f48ec (rh #1058843)
e19f48ec was incomplete; it failed to handle device disconnections. NMDevice will clear its internal activation request *before* emitting the state change, which meant that when the NMActRequest processes the DISCONNECTED state change, the: if (NM_ACTIVE_CONNECTION (nm_device_get_act_request (device)) != active) return; statement triggered and the DISCONNECTED state change was not processed. Instead of having NMDevice keep the activation request alive over the entire DISCONNECTED state transition, which may have much greater implications, handle the special-case locally in the NMActRequest code itself.
-rw-r--r--src/nm-activation-request.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c
index 7ffa3dc6f5..41f1cbf63f 100644
--- a/src/nm-activation-request.c
+++ b/src/nm-activation-request.c
@@ -305,11 +305,22 @@ device_state_changed (NMActiveConnection *active,
NMDeviceState new_state,
NMDeviceState old_state)
{
+ NMActiveConnectionState cur_ac_state = nm_active_connection_get_state (active);
NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
- /* Ignore state changes when this activation request is not yet active */
- if (NM_ACTIVE_CONNECTION (nm_device_get_act_request (device)) != active)
- return;
+ /* Ignore state changes when this activation request is not yet active, but
+ * handle the DISCONNECTED state correctly. The device clears the
+ * activation request before sending the state change signal so this
+ * must be special-cased to ensure the activation request is deactivated.
+ */
+ if (NM_ACTIVE_CONNECTION (nm_device_get_act_request (device)) != active) {
+ if (new_state != NM_DEVICE_STATE_DISCONNECTED)
+ return;
+ if (cur_ac_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATING)
+ return;
+
+ /* Catch device disconnections after this request has been active */
+ }
/* Set NMActiveConnection state based on the device's state */
switch (new_state) {