Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1517794

Summary: [NMCI] resolv.conf options are not removed properly
Product: Red Hat Enterprise Linux 7 Reporter: Vladimir Benes <vbenes>
Component: NetworkManagerAssignee: Beniamino Galvani <bgalvani>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: atragler, bgalvani, fgiudici, lmiksik, lrintel, rkhan, sukulkar, thaller
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 13:34:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[PATCH] ifcfg-rh: use separate variables for DNS searches
none
[PATCH v2] ifcfg-rh: use separate variables for DNS searches none

Description Vladimir Benes 2017-11-27 13:32:57 UTC
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.

    @ipv4_remove_dns_options
    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):
NetworkManager-1.10.0-1.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. see above

Actual results:
dns option debug still there
workaround:
nmcli con modify ethie ipv4.dns-options ' ' ipv6.dns-options ' '

Expected results:
dns option not thres

Additional info:
affects ipv4/ipv6 in nmcli and also nmtui in: ipv6_dns_search_remove_dns_search

Comment 1 Beniamino Galvani 2017-11-28 14:56:53 UTC
Branch bg/ifcfg-rh-dns-rh1517794.

Comment 2 Thomas Haller 2017-11-28 15:44:05 UTC
(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),
+                      NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+                      NM_SETTING_IP6_CONFIG_METHOD_IGNORE))
+         return;
+

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)
+         return;

also, write_res_option() should either set or unset the value. Just return is wrong.

Comment 3 Beniamino Galvani 2017-11-29 10:02:59 UTC
How about now?

Comment 4 Thomas Haller 2017-11-29 11:31:32 UTC
lgtm

Comment 8 Beniamino Galvani 2017-12-06 21:14:56 UTC
Created attachment 1363919 [details]
[PATCH] ifcfg-rh: use separate variables for DNS searches

Comment 9 Thomas Haller 2017-12-07 06:07:10 UTC
          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?

Comment 10 Beniamino Galvani 2017-12-07 08:30:24 UTC
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?

Both fixed.

Comment 11 Thomas Haller 2017-12-07 08:47:02 UTC
(In reply to Beniamino Galvani from comment #10)
> Both fixed.

lgtm

Comment 14 Vladimir Benes 2018-01-10 13:44:42 UTC
works well again

Comment 17 errata-xmlrpc 2018-04-10 13:34:16 UTC
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.

https://access.redhat.com/errata/RHBA-2018:0778