summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-01-12 10:23:30 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2019-01-12 10:23:30 +0100
commit586a0e619249bfe993648e370aa7bf4efa62ec50 (patch)
tree4fbd12ac3d5d673f3c71a024aa1bcb16b3d44222
parent6f82657c53cb140f834155efc3855319d46c87e0 (diff)
downloadNetworkManager-bg/cli-dns-options-rh1665649.tar.gz
clients: remove the same dns-option before adding itbg/cli-dns-options-rh1665649
nmcli connection modify t ipv4.dns-options ndots:2 nmcli connection modify t +ipv4.dns-options ndots:4 should set dns-options to 'ndots:4', so we must remove other occurences of the same option before adding it, otherwise the setting refuses to set the same option again.
-rw-r--r--clients/common/nm-meta-setting-desc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index b2622750a5..4befce259a 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -3392,14 +3392,18 @@ static gboolean
_set_fcn_ip_config_dns_options (ARGS_SET_FCN)
{
gs_free const char **strv = NULL;
+ NMSettingIPConfig *s_ip;
gsize i;
nm_assert (!error || !*error);
+ s_ip = NM_SETTING_IP_CONFIG (setting);
strv = nm_utils_strsplit_set (value, " \t,", FALSE);
if (strv) {
- for (i = 0; strv[i]; i++)
- nm_setting_ip_config_add_dns_option (NM_SETTING_IP_CONFIG (setting), strv[i]);
+ for (i = 0; strv[i]; i++) {
+ nm_setting_ip_config_remove_dns_option_by_value (s_ip, strv[i]);
+ nm_setting_ip_config_add_dns_option (s_ip, strv[i]);
+ }
}
return TRUE;
}