After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766191 - Internal DHCP client can not parse "Domain Name" list (option 15)
Internal DHCP client can not parse "Domain Name" list (option 15)
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: IP and DNS config
1.2.x
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-05-09 18:12 UTC by David Strobach
Modified: 2016-05-11 09:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sd/dhcp: workaround multiple "Domain Name" (option 15) entries (1.17 KB, patch)
2016-05-09 19:46 UTC, Thomas Haller
none Details | Review

Description David Strobach 2016-05-09 18:12:23 UTC
The "Domain Name" DHCP option 15 is sometimes used to carry a list of domains instead of just one. In such a case it seems to be a common practice to use the list verbatim as a "search" list (e.g., in resolv.conf). While the NetworkManager seems to try to do it's best to cope with the situation in nm-dhcp-systemd.c/lease_to_ip4_config(...):

[...]
        /* Domain Name */
        r = sd_dhcp_lease_get_domainname (lease, &str);
        if (r == 0) {
                /* Multiple domains sometimes stuffed into the option */
                char **domains = g_strsplit (str, " ", 0);
                char **s;
                 
                for (s = domains; *s; s++) {
[...]

, systemd counters by doing it's best to break the things down by returning an "escaped" string out of the sd_dhcp_lease_get_domainname(...). So if you happen to have your DHCP set up to return "mycompany.de mycompany.cz mycompany.com" in the Domain Name field, systemd turns it into "mycompany.de\032mycompany.cz\032mycompany.com" which obviously passes the parser logic intact and gets later used as a domain name.
Comment 1 Thomas Haller 2016-05-09 19:46:15 UTC
Created attachment 327538 [details] [review]
sd/dhcp: workaround multiple "Domain Name" (option 15) entries

https://mail.gnome.org/archives/networkmanager-list/2005-April/msg00022.html
https://tools.ietf.org/html/rfc2132#section-3.17
Comment 2 Thomas Haller 2016-05-09 19:47:03 UTC
(In reply to Thomas Haller from comment #1)
> Created attachment 327538 [details] [review] [review]
> sd/dhcp: workaround multiple "Domain Name" (option 15) entries
> 
> https://mail.gnome.org/archives/networkmanager-list/2005-April/msg00022.html
> https://tools.ietf.org/html/rfc2132#section-3.17

(untested) :)
Comment 3 David Strobach 2016-05-10 11:39:56 UTC
I would rather use dns_label_unescape(...) to keep consistent with whatever systemd fabricates next time.
Comment 4 David Strobach 2016-05-10 13:10:53 UTC
Please disregard my previous comment. It's not that easy.
The proposed fix works just fine. Tested with NetworkManager 1.2.0.
Comment 5 Francesco Giudici 2016-05-11 09:01:33 UTC
patch lgtm