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:02:44 -0600
commit9103073fe70e14d00f0e50e84e007dc33fd07f0f (patch)
treec53d104b08e6b64f76827bb67fe78001457e298e
parentf0a8b3a76d2e374baf8751885973def451bc2049 (diff)
downloadNetworkManager-dcbw/acon-remove-fix.tar.gz
core: fix ActiveConnection handling of device disconnected state after e19f48ec (rh #1058843)dcbw/acon-remove-fix
e19f48ec was incomplete; it failed to handle device disconnections. NMDevice will clear it's 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) {