GNOME Bugzilla – Bug 738125
NetworkManager parses /etc/dhcp/dhclient.conf including commented lines
Last modified: 2014-10-08 21:09:38 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.
Making the title a bit clearer.
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
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).
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).
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.
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).
Review of attachment 288035 [details] [review]: looks good to me
merged upstream: master: http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=f77297ec85ad40d3df9a6a1ce7aee4823f63bc7c nm-0-9-10: http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=f1d899b062aba61ab1219e41898394cf30b936d5