Bug 8456 - Problem with gethostid system call
Problem with gethostid system call
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: netcfg (Show other bugs)
6.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Michael K. Johnson
: Security
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-01-13 17:35 EST by pimper1
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-13 18:52:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description pimper1 2000-01-13 17:35:52 EST
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 18:52:59 EST
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 09:37:48 EST
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.


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