Bug 165785

Summary: diskless clients cannot cope with no DNS PTR record for their IP address
Product: Red Hat Enterprise Linux 3 Reporter: Jason Vas Dias <jvdias>
Component: redhat-config-netbootAssignee: Jason Vas Dias <jvdias>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-486 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-28 19:39:10 UTC Type: ---
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: 165735    
Bug Blocks: 156320    

Description Jason Vas Dias 2005-08-12 03:04:55 UTC
+++ This bug was initially created as a clone of Bug #165735 +++

Description of problem:

If no DNS PTR record exists for the IP address that is assigned to a 
diskless boot client, disklessrc will set the hostname to '3(NXDOMAIN' ,
which becomes the name of the snapshot directory that the client will
attempt to mount .

Any hostname that may have been set by the DHCP server is ignored.

This is a latent problem with all previous releases of 
{system,redhat}-config-netboot , and stems from this code in disklessrc:

--- disklessrc, @line 220:
#
#  Mount the snapshot directory from the server and then mount files
#  in the snapshot/files file over the the shared ones
#
IP=`/sbin/ifconfig $ETHERNET|grep inet|cut -f 2 -d ':'|cut -f 1 -d ' '`

#
# Setup the hostname for the diskless client.
#
hostname `host $IP |  sed 's/.* \(.*\)./\1/'` 2> /dev/null

if [ -z "${SNAPSHOT}" ]; then
SNAPSHOT=`hostname`
fi
---

To fix this, I propose :

1. Check if any host name was set by the dhclient session - if so, use that
   hostname.

2. If no hostname was set by the dhclient session, and the 'host $IP' lookup
   fails, and $SNAPSHOT is not null, set the hostname to $SNAPSHOT .

3. If no hostname was set by the dhclient session, and the 'host $IP' lookup
   fails, and $SNAPSHOT is null, then set the hostname to the IP address,
   because pxeboot will create a default snapshot directory named with whatever
   IP address was given as the host configuration file name, and there is a 
   chance that this will be a 32 bit IP address.  This is better than multiple
   clients using the '3(NXDOMAIN' snapshot directory.

Version-Release number of selected component (if applicable):
ALL

How reproducible:
100%

Steps to Reproduce:
Set up a boot client with no 'SNAPSHOT=' setting, to obtain an IP address 
via DHCP for which there is no DNS PTR record
  
Actual results:
Client will boot with hostname '3(NXDOMAIN' and create the snapshot
directory ${NFSSERVER}:/${CLIENT_ROOT}/snapshot/3\(NXDOMAIN

Expected results:
Client should ensure it sets its hostname and snapshot directory name to a 
unique value regardless of whether its IP address is in the DNS.
It should be possible to set the hostname for the client in the DHCP server
configuration.


Additional info:

Comment 1 Jason Vas Dias 2005-08-12 17:27:05 UTC
See comments in Bug 165735 .
Fixed in redhat-config-netboot-0.1.24-1_EL3, available from:
  http://people.redhat.com/~jvdias/redhat-config-netboot


Comment 4 Red Hat Bugzilla 2005-09-28 19:39:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-486.html