Bug 8456

Summary: Problem with gethostid system call
Product: [Retired] Red Hat Linux Reporter: pimper1
Component: netcfgAssignee: Michael K. Johnson <johnsonm>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1Keywords: Security
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-01-13 23:52:44 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:

Description pimper1 2000-01-13 22:35:52 UTC
The gethostid system call returns the wrong host id.  The default 6.1
version of the /etc/hosts file is different from the default version for
6.0 and earlier.  If it is left alone, then the gethostid call returns
the wrong IP address (127.0.0.1).  If it is rewritten to be the same
as version 6.0 and earlier then gethostid returns the correct value.

6.1 version:
127.0.0.0   localhost.localdomain   localhost  myname
www.xxx.yyy.zzz   localhost.localdomain

6.0 version
127.0.0.1   localhost    localhost.localdomain
www.xxx.yyy.zzz   myname.mydomain   myname

Oddly enough if I use the 6.1 format on my 6.0 machine, gethostid works
correctly.

Comment 1 Jeff Johnson 2000-01-13 23:52:59 UTC
Do you mean gethostid or (more likely) gethostbyname? If the latter,
simply edit /etc/hosts and configure it correctly. The installer
has heuristics that, depending on the hardware and how the questions
were answered, will lead to differences in the "default" /etc/hosts.

Gethostid on the other hand is a silly system call that simply returns
whatever was set by sethostid (so I don't think that's what you meant).

Comment 2 Peter Leggett 2001-01-10 14:37:48 UTC
Sorry but  I believe that this is a bug and the resolution provided is not
adequate. One of the primary uses for the gethostid call is to
return a unique id.  The problem with the proposed resolution is that
unless somebody edits the /etc/hosts and changes the layout then
many systems will have the same hostid, i.e. based on 127.0.0.1. 

The gethostid call is very often used for licensing software purposes on 
other OS's such as Solaris. In fact the gethostid call returns the MAC 
address on many OS's rather than the IP address. For vendors providing
software that uses licensing it makes life very difficult if they have to
ask the customer to edit system files to get a unique ID returned so 
they can issue a licence. IMHO gethostid should return a MAC address
and not an IP since MAC addresses are unique (as far as I know) . If
this is not possible then at lease gethostid should return a IP that is not
the local loopback one.