Bug 1260552 - dhclient called with -H when DHCP_HOSTNAME is a FQDN
Summary: dhclient called with -H when DHCP_HOSTNAME is a FQDN
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: initscripts
Version: 7.1
Hardware: All
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: David Kaspar [Dee'Kej]
QA Contact: Leos Pol
Filip Hanzelka
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 1298243 1393867 1400961
TreeView+ depends on / blocked
 
Reported: 2015-09-07 08:51 UTC by Beniamino Galvani
Modified: 2017-08-01 07:29 UTC (History)
8 users (show)

(edit)
"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.
Clone Of:
(edit)
Last Closed: 2017-08-01 07:29:01 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2286 normal SHIPPED_LIVE initscripts bug fix and enhancement update 2017-08-01 11:26:43 UTC

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


Note You need to log in before you can comment on or make changes to this bug.