mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 19:28:04 +02:00
nmcli/connections: do not remove a bond option unless reset is allowed
If we're setting an option with no value given and no reset allowed, let's just set the default value.
This commit is contained in:
parent
0cb971d1d6
commit
d51140d2ab
1 changed files with 15 additions and 17 deletions
|
|
@ -4651,7 +4651,6 @@ set_bond_option(NmCli *nmc,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
NMSettingBond *s_bond;
|
NMSettingBond *s_bond;
|
||||||
gboolean success;
|
|
||||||
gs_free char *name = NULL;
|
gs_free char *name = NULL;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
|
@ -4665,26 +4664,25 @@ set_bond_option(NmCli *nmc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_str_is_empty(value)) {
|
if (nm_str_is_empty(value)) {
|
||||||
nm_setting_bond_remove_option(s_bond, name);
|
if (allow_reset) {
|
||||||
success = TRUE;
|
nm_setting_bond_remove_option(s_bond, name);
|
||||||
} else
|
return TRUE;
|
||||||
success = _nm_meta_setting_bond_add_option(NM_SETTING(s_bond), name, value, error);
|
}
|
||||||
|
} else {
|
||||||
|
if (!_nm_meta_setting_bond_add_option(NM_SETTING(s_bond), name, value, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!success)
|
if (nm_streq(name, NM_SETTING_BOND_OPTION_MODE)) {
|
||||||
return FALSE;
|
value = nm_setting_bond_get_option_by_name(s_bond, name);
|
||||||
|
if (nm_streq(value, "active-backup")) {
|
||||||
if (success) {
|
enable_options(NM_SETTING_BOND_SETTING_NAME,
|
||||||
if (nm_streq(name, NM_SETTING_BOND_OPTION_MODE)) {
|
NM_SETTING_BOND_OPTIONS,
|
||||||
value = nmc_bond_validate_mode(value, error);
|
NM_MAKE_STRV("primary"));
|
||||||
if (nm_streq(value, "active-backup")) {
|
|
||||||
enable_options(NM_SETTING_BOND_SETTING_NAME,
|
|
||||||
NM_SETTING_BOND_OPTIONS,
|
|
||||||
NM_MAKE_STRV("primary"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue