summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-10-09 21:45:23 +0200
committerThomas Haller <thaller@redhat.com>2015-10-09 23:41:34 +0200
commita77a3aa7ddc79695d6b30960826306ab98068e1c (patch)
tree1b9f18dbe433f17f178584048b597c318ad038de
parentb15204d9910702f8912428d4dee873d1d6965cd7 (diff)
downloadNetworkManager-a77a3aa7ddc79695d6b30960826306ab98068e1c.tar.gz
device: fix wrongly managing external-down device due to not setting EXTERNAL_DOWN
The unmanaged-flag NM_UNMANAGED_EXTERNAL_DOWN is initially set during nm_device_finish_init(). But it was only set if the device was down at that point. If due to a race the platform device was not yet initialized, a later initialization in device_link_changed() would clear NM_UNMANAGED_PLATFORM_INIT. If the device is not external-down (because it was already up during nm_device_finish_init()), the device will be managed right away with reason NM_DEVICE_STATE_REASON_NOW_MANAGED. Together with commit e29ab54335c6a5ef1ce6bac525f1f18a8e81b96e, this is a race that causes a failure to assume the external-down device. https://bugzilla.redhat.com/show_bug.cgi?id=1269199 (cherry picked from commit 120847c8a37cdba9116d26891c8dc725ad8d9100)
-rw-r--r--src/devices/nm-device.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 01b0e4f7bf..68d38cfc54 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1144,8 +1144,9 @@ nm_device_finish_init (NMDevice *self)
/* Do not manage externally created software devices until they are IFF_UP */
if ( NM_DEVICE_GET_CLASS (self)->can_unmanaged_external_down (self)
- && !nm_platform_link_is_up (NM_PLATFORM_GET, priv->ifindex)
- && priv->ifindex > 0)
+ && priv->ifindex > 0
+ && ( !priv->up
+ || !priv->platform_link_initialized))
nm_device_set_initial_unmanaged_flag (self, NM_UNMANAGED_EXTERNAL_DOWN, TRUE);
if (priv->master)