Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1260552

Summary: dhclient called with -H when DHCP_HOSTNAME is a FQDN
Product: Red Hat Enterprise Linux 7 Reporter: Beniamino Galvani <bgalvani>
Component: initscriptsAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED ERRATA QA Contact: Leos Pol <lpol>
Severity: high Docs Contact: Filip Hanzelka <fhanzelk>
Priority: unspecified    
Version: 7.1CC: dcbw, deekej, fhanzelk, jhunt, jscotka, lnykryn, mazzystr, ptalbert
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: initscripts-9.49.39-1.el7 Doc Type: Enhancement
Doc Text:
"DHCP_FQDN" allows specifying a fully qualified domain name of the system Previously, the `ifcfg` interface configuration files required that the "DHCP_HOSTNAME" directive was used to specify the hostname of the system. The new initscripts "DHCP_FQDN" directive now also allows specifying the fully qualified domain name of the system. This is a complement to the "DHCP_HOSTNAME" directive. In case both "DHCP_HOSTNAME" and "DHCP_FQDN" are specified, only "DHCP_FQDN" is used.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 07:29:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1298243, 1393867, 1400961    

Description Beniamino Galvani 2015-09-07 08:51:30 UTC
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.

Comment 2 Lukáš Nykrýn 2015-09-16 13:43:45 UTC
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.

Comment 3 Beniamino Galvani 2015-10-06 14:32:12 UTC
(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.

Comment 4 Beniamino Galvani 2015-11-23 21:26:54 UTC
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.

Comment 5 Chris C 2016-03-14 18:16:15 UTC
Can we expect this update to be added to Red Hat Enterprise Linux 7.3?

/Chris Callegari

Comment 9 David Kaspar // Dee'Kej 2017-05-03 09:41:16 UTC
Pull request accepted:
https://github.com/fedora-sysv/initscripts/pull/92

Comment 10 David Kaspar // Dee'Kej 2017-05-03 10:24:32 UTC
This is now part of RHEL-7 branch:
https://github.com/fedora-sysv/initscripts/pull/95

Comment 17 Leos Pol 2017-06-19 17:55:36 UTC
initscripts-9.49.39-1.el7 verified by TC

Comment 19 errata-xmlrpc 2017-08-01 07:29:01 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-2017:2286