summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-10-16 15:01:16 -0500
committerDan Williams <dcbw@redhat.com>2015-05-06 16:14:24 -0500
commitfb1d04099f445eda974cbf0dfb334b3718031cc7 (patch)
tree05c624dd091b87b884f6947636cf6f7ed6788340
parent8203ae8093f59ce2d14b8257c386a024f735bbe3 (diff)
downloadNetworkManager-fb1d04099f445eda974cbf0dfb334b3718031cc7.tar.gz
core: don't activate failed queued activation requests
If the queued activation request failed before the device is finished deactiving the old request, don't start activating the failed queued request.
-rw-r--r--src/devices/nm-device.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f0ef6572e3..9e6d6d00e9 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5891,14 +5891,20 @@ impl_device_delete (NMDevice *self, DBusGMethodInvocation *context)
NULL);
}
-static void
+static gboolean
_device_activate (NMDevice *self, NMActRequest *req)
{
NMDevicePrivate *priv;
NMConnection *connection;
- g_return_if_fail (NM_IS_DEVICE (self));
- g_return_if_fail (NM_IS_ACT_REQUEST (req));
+ g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
+ g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
+
+ /* Ensure the activation request is still valid; the master may have
+ * already failed in which case activation of this device should not proceed.
+ */
+ if (nm_active_connection_get_state (NM_ACTIVE_CONNECTION (req)) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING)
+ return FALSE;
priv = NM_DEVICE_GET_PRIVATE (self);
@@ -5924,6 +5930,7 @@ _device_activate (NMDevice *self, NMActRequest *req)
priv->act_request = g_object_ref (req);
nm_device_activate_schedule_stage1_device_prepare (self);
+ return TRUE;
}
static void
@@ -6019,7 +6026,8 @@ nm_device_queue_activation (NMDevice *self, NMActRequest *req)
if (!priv->act_request && !must_queue) {
/* Just activate immediately */
- _device_activate (self, req);
+ if (!_device_activate (self, req))
+ g_assert_not_reached ();
return;
}
@@ -8110,13 +8118,18 @@ _set_state_full (NMDevice *self,
if ( priv->queued_act_request
&& !priv->queued_act_request_is_waiting_for_carrier) {
NMActRequest *queued_req;
+ gboolean success;
queued_req = priv->queued_act_request;
priv->queued_act_request = NULL;
- _device_activate (self, queued_req);
+ success = _device_activate (self, queued_req);
g_object_unref (queued_req);
- } else if ( old_state > NM_DEVICE_STATE_DISCONNECTED
- && nm_device_get_default_unmanaged (self))
+ if (success)
+ break;
+ /* fall through */
+ }
+ if ( old_state > NM_DEVICE_STATE_DISCONNECTED
+ && nm_device_get_default_unmanaged (self))
nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
break;
case NM_DEVICE_STATE_ACTIVATED: