diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-07-31 11:40:35 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-08-01 09:03:59 +0200 |
commit | 8089af90de8295b9e14390ed262e1028264d11f3 (patch) | |
tree | bc89632e295da8ab2a0fc014d5ccc7529aaeff76 | |
parent | 47642a2657bf721a915f453d081f44fe654cb719 (diff) | |
download | NetworkManager-bg/ovs-restart-part2-rh1733709.tar.gz |
device: fix releasing slavesbg/ovs-restart-part2-rh1733709
Not all masters type have a platform link and so it's wrong to check
for it to decide whether the slave should be really released. Move the
check to master devices that need it (bond, bridge and team).
OVS ports don't need the check because they don't call to platform to
remove a slave.
https://bugzilla.redhat.com/show_bug.cgi?id=1733709
-rw-r--r-- | src/devices/nm-device-bond.c | 6 | ||||
-rw-r--r-- | src/devices/nm-device-bridge.c | 6 | ||||
-rw-r--r-- | src/devices/nm-device.c | 7 | ||||
-rw-r--r-- | src/devices/team/nm-device-team.c | 6 |
4 files changed, 19 insertions, 6 deletions
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index fd79348d2c..50494526a9 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -414,6 +414,12 @@ release_slave (NMDevice *device, gboolean success; gs_free char *address = NULL; int ifindex_slave; + int ifindex; + + ifindex = nm_device_get_ifindex (device); + if ( ifindex <= 0 + || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) + configure = FALSE; ifindex_slave = nm_device_get_ip_ifindex (slave); diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index ade9eb0d8f..91d824b35b 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -626,6 +626,12 @@ release_slave (NMDevice *device, NMDeviceBridge *self = NM_DEVICE_BRIDGE (device); gboolean success; int ifindex_slave; + int ifindex; + + ifindex = nm_device_get_ifindex (device); + if ( ifindex <= 0 + || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) + configure = FALSE; ifindex_slave = nm_device_get_ip_ifindex (slave); diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 16490ea046..b72d20754f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4975,7 +4975,6 @@ nm_device_master_release_slaves (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDeviceStateReason reason; - gboolean configure = TRUE; CList *iter, *safe; /* Don't release the slaves if this connection doesn't belong to NM. */ @@ -4986,14 +4985,10 @@ nm_device_master_release_slaves (NMDevice *self) if (priv->state == NM_DEVICE_STATE_FAILED) reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; - if ( priv->ifindex <= 0 - || !nm_platform_link_get (nm_device_get_platform (self), priv->ifindex)) - configure = FALSE; - c_list_for_each_safe (iter, safe, &priv->slaves) { SlaveInfo *info = c_list_entry (iter, SlaveInfo, lst_slave); - nm_device_master_release_one_slave (self, info->slave, configure, reason); + nm_device_master_release_one_slave (self, info->slave, TRUE, reason); } } diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index a60a9fda5d..4661a84034 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -775,6 +775,12 @@ release_slave (NMDevice *device, NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self); gboolean success; int ifindex_slave; + int ifindex; + + ifindex = nm_device_get_ifindex (device); + if ( ifindex <= 0 + || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) + configure = FALSE; ifindex_slave = nm_device_get_ip_ifindex (slave); |