Hide Forgot
Description of problem: If DHCP_HOSTNAME contains a FQDN, dhclient is invoked with the -H option passing the full FQDN. This seems to be wrong according to the dhclient man page, which states that the argument of -H should be the hostname prefix: -H <host-name> Specify the host-name option to send to the DHCP server. The host-name string only contains the client's hostname prefix, to which the server will append the ddns-domainname or domain-name options, if any, to derive the fully qualified domain name of the client. The -H option cannot be used with the -F option. -F <fqdn.fqdn> Specify the fqdn.fqdn option to send to the DHCP server. This option cannot be used with the -H option. The fqdn.fqdn option must specify the complete domain name of the client host, which the server may use for dynamic DNS updates. Version-Release number of selected component (if applicable): initscripts-9.49.24-1.el7.x86_64 Steps to Reproduce: # grep DHCP_HOSTNAME /etc/sysconfig/network-scripts/ifcfg-eth0-dhcp DHCP_HOSTNAME=foo.bar.com # ifup eth0-dhcp Determining IP information for eth0... done. # ps ax | grep [d]hclient 6197 ? Ss 0:00 /sbin/dhclient -H foo.bar.com -1 -q [...] Expected results: dhclient should not be invoked with -H and a FQDN. Additional info: I think this was introduce with commit https://git.fedorahosted.org/cgit/initscripts.git/commit/?id=60ddb21fcdfb0594a35978aa0b04af4527c46d6e with the intention of stripping both HOSTNAME and DHCP_HOSTNAME, but since expand_config() is not called with DHCP, the result is that only HOSTNAME gets stripped. I noticed this behavior while analyzing NetworkManager's bug 1255507. The reporter asks for a way to send the FQDN as hostname, while in NetworkManager currently we strip both system hostname and DHCP_HOSTNAME and then use the -H option of dhclient. In my opinion the correct behavior for both NetworkManager and initscripts would be to avoid stripping HOSTNAME and DHCP_HOSTNAME and to use the -F dhclient option when the hostname we are going to send is a fully-qualified one. What do you think about it? Please see bug 1255507 for more details.
DHCP_HOSTNAME should not be FQDN, it was always supposed to be short hostname, which should be fine for the -H. The intention of the patch you mentioned was to guarantee that, but it was messed up. The second part should be in source_config function, not in expand_config. > In my opinion the correct behavior for both NetworkManager and > initscripts would be to avoid stripping HOSTNAME and DHCP_HOSTNAME and > to use the -F dhclient option when the hostname we are going to send > is a fully-qualified one. That would break for those who are specifying here a short hostname. I think that correct solution here is to add a new DHCP_FQDN_HOSTNAME variable.
(In reply to Lukáš Nykrýn from comment #2) > > In my opinion the correct behavior for both NetworkManager and > > initscripts would be to avoid stripping HOSTNAME and DHCP_HOSTNAME and > > to use the -F dhclient option when the hostname we are going to send > > is a fully-qualified one. > > That would break for those who are specifying here a short hostname. When the hostname is short the -H option would be used, as it is now. But yeah, for those using a FQDN there would be a change in behavior since dhclient would start to send -F instead of -H. > I think that correct solution here is to add a new DHCP_FQDN_HOSTNAME > variable. Sounds good to me. And since -F and -H are mutually exclusive, when both DHCP_HOSTNAME and DHCP_FQDN_HOSTNAME are present the latter should be used. If none is present the system hostname probably should be always sent with -H (to preserve backwards compatibility). Since the variables are shared between IPv4 and IPv6, it is not possible to use different options for the two, but probably this is not a big limitation.
FYI, in NetworkManager 1.2 a new DHCP_FQDN ifcfg-rh variable will be supported for setting the qualified domain name to send to DHCP server. See bug 1255507 for reference.
Can we expect this update to be added to Red Hat Enterprise Linux 7.3? /Chris Callegari
Pull request accepted: https://github.com/fedora-sysv/initscripts/pull/92
This is now part of RHEL-7 branch: https://github.com/fedora-sysv/initscripts/pull/95
initscripts-9.49.39-1.el7 verified by TC
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-2017:2286