NetworkManager/0060-rh1055099-secondary-co...

53 lines
2.3 KiB
Diff

From e7570b398c6a658732cdc5cc0566beaf2f23e6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 15 Apr 2014 11:51:56 +0200
Subject: [PATCH] policy: check device state before changing it for
secondaries (rh #1055099)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We have to check the previous base device state in process_secondaries() when
making a state change. The device might got disconnected in the meantime and
thus the transition from DISCONNECTED to ACTIVATED or FAILED would have been
incorrect.
https://bugzilla.redhat.com/show_bug.cgi?id=1055099
https://bugzilla.redhat.com/show_bug.cgi?id=1055101
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-policy.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index f454d90..fa31d6c 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1087,7 +1087,8 @@ process_secondaries (NMPolicy *policy,
/* None secondary UUID remained -> remove the secondary data item */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
+ if (nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
return;
}
} else {
@@ -1098,8 +1099,10 @@ process_secondaries (NMPolicy *policy,
/* Secondary connection failed -> do not watch other connections */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
- NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
+ if ( nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES
+ || nm_device_get_state (item_device) == NM_DEVICE_STATE_ACTIVATED)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
+ NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
return;
}
}
--
1.7.11.7