mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-17 00:00:30 +01:00
device: fix releasing slaves
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 (cherry picked from commit57e3734b6c) (cherry picked from commitec1b5fb019) (cherry picked from commitf6a90b899a)
This commit is contained in:
parent
33309f7c9f
commit
af2a126dc0
4 changed files with 19 additions and 6 deletions
|
|
@ -415,6 +415,12 @@ release_slave (NMDevice *device,
|
|||
NMDeviceBond *self = NM_DEVICE_BOND (device);
|
||||
gboolean success;
|
||||
gs_free char *address = NULL;
|
||||
int ifindex;
|
||||
|
||||
ifindex = nm_device_get_ifindex (device);
|
||||
if ( ifindex <= 0
|
||||
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
|
||||
configure = FALSE;
|
||||
|
||||
if (configure) {
|
||||
/* When the last slave is released the bond MAC will be set to a random
|
||||
|
|
|
|||
|
|
@ -481,6 +481,12 @@ release_slave (NMDevice *device,
|
|||
{
|
||||
NMDeviceBridge *self = NM_DEVICE_BRIDGE (device);
|
||||
gboolean success;
|
||||
int ifindex;
|
||||
|
||||
ifindex = nm_device_get_ifindex (device);
|
||||
if ( ifindex <= 0
|
||||
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
|
||||
configure = FALSE;
|
||||
|
||||
if (configure) {
|
||||
success = nm_platform_link_release (nm_device_get_platform (device),
|
||||
|
|
|
|||
|
|
@ -4844,7 +4844,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. */
|
||||
|
|
@ -4855,14 +4854,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -774,6 +774,12 @@ release_slave (NMDevice *device,
|
|||
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
|
||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
|
||||
gboolean success;
|
||||
int ifindex;
|
||||
|
||||
ifindex = nm_device_get_ifindex (device);
|
||||
if ( ifindex <= 0
|
||||
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
|
||||
configure = FALSE;
|
||||
|
||||
if (configure) {
|
||||
success = nm_platform_link_release (nm_device_get_platform (device),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue