Bug 8456 - Problem with gethostid system call
Summary: Problem with gethostid system call
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: netcfg
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-01-13 22:35 UTC by pimper1
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-01-13 23:52:44 UTC

Attachments (Terms of Use)

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 (  If it is rewritten to be the same
as version 6.0 and earlier then gethostid returns the correct value.

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

6.0 version   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

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 

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.