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 1648009 - NetworkManager limits the search field of resolv.conf to 6 entries in _collect_resolv_conf_data()
Summary: NetworkManager limits the search field of resolv.conf to 6 entries in _collec...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.6
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Thomas Haller
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 1649704
TreeView+ depends on / blocked
 
Reported: 2018-11-08 17:47 UTC by Kyle Walker
Modified: 2019-08-06 13:16 UTC (History)
10 users (show)

Fixed In Version: NetworkManager-1.18.0-0.3.20190408git43d9187c14.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1649704 (view as bug list)
Environment:
Last Closed: 2019-08-06 13:16:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 677316 0 low CLOSED glibc: Increase number of search domains supported by /etc/resolv.conf 2023-03-24 13:25:57 UTC
Red Hat Product Errata RHBA-2019:2302 0 None None None 2019-08-06 13:16:51 UTC

Internal Links: 677316

Description Kyle Walker 2018-11-08 17:47:52 UTC
Description of problem:
 The _collect_resolv_conf_data() function limits the number of search entries to 6 within the following code snippet. Taken from the 1.10.2-16 source revision:

        /* Per 'man resolv.conf', the search list is limited to 6 domains
         * totalling 256 characters.
         */
        num = MIN (rc.searches->len, 6u);
        for (i = 0, len = 0; i < num; i++) {
                len += strlen (rc.searches->pdata[i]) + 1; /* +1 for spaces */
                if (len > 256)
                        break;
        }
        g_ptr_array_set_size (rc.searches, i);

This is no longer the limit for later RHEL releases. The limit was removed with the efforts in RHBZ677316 [^1] and released in upstream glibc-2.26 [^2].

Version-Release number of selected component (if applicable):
 # rpm -q NetworkManager
 NetworkManager-1.10.2-16.el7_5.x86_64

How reproducible:
 Easily

Steps to Reproduce:
1. Set an interface to a ipv4.dns-search entry greater than 6
    # nmcli con modify System\ eth0 ipv4.dns-search $(echo {a..g}.redhat.com, | sed -e 's/ //g' -e 's/,$//g')
    
2. Verify the ipv4.dns-search field includes more than 6 entries

    # nmcli con show System\ eth0 | grep ipv4.dns-search
    ipv4.dns-search:                        a.redhat.com,b.redhat.com,c.redhat.com,d.redhat.com,e.redhat.com,f.redhat.com,g.redhat.com

3. Issue an "nmcli con up <interface>" and verify that the /etc/resolv.conf has more than 6 entries

    # nmcli con up System\ eth0
    # grep search /etc/resolv.conf

Actual results:
    search a.redhat.com b.redhat.com c.redhat.com d.redhat.com e.redhat.com f.redhat.com


Expected results:
    search a.redhat.com b.redhat.com c.redhat.com d.redhat.com e.redhat.com f.redhat.com g.redhat.com


Additional info:
 The problem is not seen when disabling NetworkManager and falling back to the underlying network initscripts.

    # systemctl stop NetworkManager && systemctl restart network && grep search 
    /etc/resolv.conf
search a.redhat.com b.redhat.com c.redhat.com d.redhat.com e.redhat.com f.redhat.com g.redhat.com

 The problem is also present with the latest available upstream NetworkManager revision [^3].

[^1]: https://bugzilla.redhat.com/show_bug.cgi?id=677316
[^2]: https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html
[^3]: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/blob/master/src/dns/nm-dns-manager.c#L1132

Comment 2 Kyle Walker 2018-11-08 19:50:35 UTC
Filed an upstream issue as well:

    https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/80

- Kyle Walker

Comment 3 Kyle Walker 2018-11-13 15:13:06 UTC
Patch suggestion accepted upstream:

    https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/80

Additional patch added to avoid search entry being truncated on legacy systems. Full patch set upstream is:

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/commit/49c11a44e4e901752a81e3942efca64448fa7c53
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/commit/3f2cc579e7627f45a77f835ba2f402e1b5c600b5

- Kyle Walker

Comment 4 Thomas Haller 2018-11-13 15:30:34 UTC
fixed upstream.

Comment 6 Juan Gamba 2019-07-18 20:41:36 UTC
As a workaround the NetworkManager global-dns 'searches=' option is not limited to 6 search domains.

WORKAROUND
==========

Create a file in /etc/NetworkManager/conf.d/*.conf and add these entries:

[main]
dns=default

[global-dns]
searches=one.example.com two.example.com three.example.com four.example.com five.example.com six.example.com seven.example.com eight.example.com

[global-dns-domain-*]
servers=xxx.xxx.xxx.xxx

Comment 8 errata-xmlrpc 2019-08-06 13:16:25 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-2019:2302


Note You need to log in before you can comment on or make changes to this bug.