mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 15:40:22 +01:00
libnm-core: allow empty slave-type with a NMSettingBondPort
It is allowed to have a connection with empty connection.slave-type and a NMSettingBondPort; the property will be set automatically during normalization if a master is set, otherwise the setting will be removed. With this change, it becomes possible to remove a port from a bond from nmcli, turning it into a non-slave connection. Before, this used to fail with: $ nmcli connection add type ethernet ifname test con-name test+ connection.master bond0 connection.slave-type bond $ nmcli connection modify test+ connection.master '' connection.slave-type '' Error: Failed to modify connection 'test+': connection.slave-type: A connection with a 'bond-port' setting must have the slave-type set to 'bond' https://bugzilla.redhat.com/show_bug.cgi?id=2126262 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1382 Fixes:9958510f28('bond: add support of queue_id of bond port') (cherry picked from commit23ce9cff99)
This commit is contained in:
parent
d23c6040f8
commit
30366e5b3a
1 changed files with 5 additions and 3 deletions
|
|
@ -85,13 +85,15 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
slave_type = nm_setting_connection_get_slave_type(s_con);
|
||||
if (!nm_streq0(slave_type, NM_SETTING_BOND_SETTING_NAME)) {
|
||||
if (slave_type && !nm_streq(slave_type, NM_SETTING_BOND_SETTING_NAME)) {
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("A connection with a '%s' setting must have the slave-type set to '%s'"),
|
||||
_("A connection with a '%s' setting must have the slave-type set to '%s'. "
|
||||
"Instead it is '%s'"),
|
||||
NM_SETTING_BOND_PORT_SETTING_NAME,
|
||||
NM_SETTING_BOND_SETTING_NAME);
|
||||
NM_SETTING_BOND_SETTING_NAME,
|
||||
slave_type);
|
||||
g_prefix_error(error,
|
||||
"%s.%s: ",
|
||||
NM_SETTING_CONNECTION_SETTING_NAME,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue