Description of problem:
when I set dns option for ipv4, I have to remove it for both ipv4 and ipv6 to get it removed. This is wrong.
Scenario: nmcli - ipv4 - dns-options - remove
* Add a new connection of type "ethernet" and options "ifname eth10 con-name ethie autoconnect no"
* Execute "nmcli con modify ethie ipv4.dns-options debug ipv4.may-fail no"
* Bring "up" connection "ethie"
* Execute "nmcli con modify ethie ipv4.dns-options ' '"
* Bring "up" connection "ethie"
Then "options debug" is not visible with command "cat /etc/resolv.conf" in "5" seconds
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. see above
dns option debug still there
nmcli con modify ethie ipv4.dns-options ' ' ipv6.dns-options ' '
dns option not thres
affects ipv4/ipv6 in nmcli and also nmtui in: ipv6_dns_search_remove_dns_search
(In reply to Beniamino Galvani from comment #1)
> Branch bg/ifcfg-rh-dns-rh1517794.
network_ifcfg = svOpenFile (network_file, NULL);
- dns_options = svGetValue (network_ifcfg, "RES_OPTIONS", &dns_options_free);
+ dns_options = svGetValue (network_ifcfg, "IPV6_RES_OPTIONS", &dns_options_free);
network_ifcfg is /etc/sysconfig/network which we parse for backward compat.
In fact, merging settings from this file (that we don't write) results in
a difference at re-read. But for legacy, that is fine.
You just don't need to use the new IPV6_RES_OPTIONS for this file.
+ if (NM_IN_STRSET (nm_setting_ip_config_get_method (s_ip),
I don't think you should verify the connection. Either nm_connection_verify() should reject connections as invalid with method=ignore + dns-options, or the writer should just handle them. Same for the reader. Reader/writer should only add additional logic where really necessary (like, converting a string to an enum).
could you rewrite write_res_options() to not use @array?
+ if (!s_ip)
also, write_res_option() should either set or unset the value. Just return is wrong.
How about now?
Merged to master:
Created attachment 1363919 [details]
[PATCH] ifcfg-rh: use separate variables for DNS searches
gs_free char *ip4_domains = NULL;
nm_auto_free_gstring GString *searches = NULL;
- searches = g_string_new (svGetValueStr (ifcfg, "DOMAIN", &ip4_domains));
ip4_domains is now unused.
/* FIXME: currently DNS domains from IPv6 setting are stored in 'DOMAIN' key in ifcfg-file
* However after re-reading they are dropped into IPv4 setting.
* So, in order to comparison succeeded, move DNS domains back to IPv6 setting.
reread_s_ip4 = nm_connection_get_setting_ip4_config (reread);
reread_s_ip6 = nm_connection_get_setting_ip6_config (reread);
- nm_setting_ip_config_add_dns_search (reread_s_ip6, nm_setting_ip_config_get_dns_search (reread_s_ip4, 2));
isn't this FIXME comment obsolete as well?
Created attachment 1364096 [details]
[PATCH v2] ifcfg-rh: use separate variables for DNS searches
(In reply to Thomas Haller from comment #9)
> ip4_domains is now unused.
> isn't this FIXME comment obsolete as well?
(In reply to Beniamino Galvani from comment #10)
> Both fixed.
Applied to master:
works well again
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.