mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 03:00:13 +01:00
bond: release slaves prior to changing mode
Bonds need to release all enslaved devices when the bond mode is to be changed. Also release slaves when they're external interfaces as it means the master it's now managed by NetworkManager. https://bugzilla.redhat.com/show_bug.cgi?id=1870691 Signed-off-by: Antonio Cardace <acardace@redhat.com>
This commit is contained in:
parent
a4d37612c8
commit
d2d74f99a9
2 changed files with 9 additions and 1 deletions
|
|
@ -331,6 +331,7 @@ apply_bonding_config(NMDeviceBond *self)
|
|||
NMSettingBond *s_bond;
|
||||
NMBondMode mode;
|
||||
const char * mode_str;
|
||||
gs_free char * device_bond_mode = NULL;
|
||||
|
||||
s_bond = nm_device_get_applied_setting(device, NM_TYPE_SETTING_BOND);
|
||||
g_return_val_if_fail(s_bond, FALSE);
|
||||
|
|
@ -342,6 +343,13 @@ apply_bonding_config(NMDeviceBond *self)
|
|||
/* Set mode first, as some other options (e.g. arp_interval) are valid
|
||||
* only for certain modes.
|
||||
*/
|
||||
device_bond_mode = nm_platform_sysctl_master_get_option(nm_device_get_platform(device),
|
||||
nm_device_get_ifindex(device),
|
||||
NM_SETTING_BOND_OPTION_MODE);
|
||||
/* Need to release all slaves before we can change bond mode */
|
||||
if (!nm_streq0(device_bond_mode, mode_str))
|
||||
nm_device_master_release_slaves(device);
|
||||
|
||||
set_bond_attr_or_default(device, s_bond, NM_SETTING_BOND_OPTION_MODE);
|
||||
|
||||
set_bond_arp_ip_targets(device, s_bond);
|
||||
|
|
|
|||
|
|
@ -4769,7 +4769,7 @@ nm_device_master_release_one_slave(NMDevice * self,
|
|||
nm_assert(slave == info->slave);
|
||||
|
||||
/* first, let subclasses handle the release ... */
|
||||
if (info->slave_is_enslaved || force)
|
||||
if (info->slave_is_enslaved || nm_device_sys_iface_state_is_external(slave) || force)
|
||||
NM_DEVICE_GET_CLASS(self)->release_slave(self, slave, configure);
|
||||
|
||||
/* raise notifications about the release, including clearing is_enslaved. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue