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 738125 - NetworkManager parses /etc/dhcp/dhclient.conf including commented lines
NetworkManager parses /etc/dhcp/dhclient.conf including commented lines
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
0.9.x
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-10-08 01:41 UTC by Mike Auty
Modified: 2014-10-08 21:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
/etc/dhcp/dhclient.conf (914 bytes, text/plain)
2014-10-08 08:33 UTC, Mike Auty
  Details
/var/lib/NetworkManager/dhclient-eth0.conf (1.42 KB, text/plain)
2014-10-08 08:36 UTC, Mike Auty
  Details
ifnet: fix parsing dhcp configuration (5.61 KB, patch)
2014-10-08 09:50 UTC, Thomas Haller
accepted-commit_now Details | Review
Freshly generated dhclient-eth0.conf after applying the patch (1.34 KB, text/plain)
2014-10-08 13:16 UTC, Mike Auty
  Details

Description Mike Auty 2014-10-08 01:41:22 UTC
I just spent a long time diagnosing why NetworkManager was sending a client-identifier and how to turn it off.  All the bugs I could find mentioned wanting to turn it on, and said that the value needed to be placed in /etc/dhclient.conf (or presumably now /etc/dhcp/dhclient.conf on my system).  I checked in there, but there were no uncommented lines.  Sure enough though, removing the line "#send dhcp-client-identifier ..." caused NetworkManager to stop sending the information.

Please fix the dhclient.conf parser so that it treats them the same way as dhclient would, and ignores lines starting with # as being comments.
Comment 1 Mike Auty 2014-10-08 01:41:51 UTC
Making the title a bit clearer.
Comment 2 Thomas Haller 2014-10-08 06:26:02 UTC
Can you show the entire content of your /etc/*.config and the one that NM creates?



Probably something like /var/lib/NetworkManager/dhclient-em1.conf

(to find the file, try:)

# ps aux | grep dhclient
root      3864  0.0  0.1 102196 19140 ?        S    08:24   0:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-em1.pid -lf /var/lib/NetworkManager/dhclient-ca058ec5-8a47-4e1e-b38e-962b71c4699e-em1.lease -cf /var/lib/NetworkManager/dhclient-em1.conf em1
Comment 3 Mike Auty 2014-10-08 08:33:24 UTC
Created attachment 288032 [details]
/etc/dhcp/dhclient.conf

Sure, here's the /etc/dhcp/dhclient.conf, which is the stock one installed with dhcp (under Gentoo).
Comment 4 Mike Auty 2014-10-08 08:36:12 UTC
Created attachment 288033 [details]
/var/lib/NetworkManager/dhclient-eth0.conf

And here's the one generated by NetworkManager.  The client-identifier command matches exactly the commented out one, and when I remove the line from dhclient.conf, NetworkManager's generated one no longer contains the client-identifier line that says generated by NetworkManager (nor the one that was commented out).
Comment 5 Thomas Haller 2014-10-08 09:50:41 UTC
Created attachment 288035 [details] [review]
ifnet: fix parsing dhcp configuration

- fix memleaks if the script contains duplicate lines
- only accept either dhclient or dhcpcd syntax, depending
  on the file
- be more strikt in parsing:
  - don't use strstr() when parsing dhcpcd.conf. It wrongly
    accepts "# send dhcp-client-identifier".
  - enfore that keyword are terminated by space. Would no longer
    accept "hostnameHOSTNAME"
- be less strict in parsing:
  - accept any number of spaces between "send" and "host-name"/
    "dhcp-client-identifier"

https://bugzilla.gnome.org/show_bug.cgi?id=738125

Signed-off-by: Thomas Haller <thaller@redhat.com>



Beware: I don't have Gentoo, so I did not actually test it.
Comment 6 Mike Auty 2014-10-08 13:16:23 UTC
Created attachment 288039 [details]
Freshly generated dhclient-eth0.conf after applying the patch

Thanks very much!  That's a very fast turn around for a patch.  5:)  I've tested it locally and it does indeed solve the problem (and produces the attached dhclient-eth0.conf file).
Comment 7 Dan Williams 2014-10-08 20:53:53 UTC
Review of attachment 288035 [details] [review]:

looks good to me