[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: localhost.localdomain

Gabor Gombas <gombasg@sztaki.hu> writes:
> On Fri, Oct 07, 2005 at 11:18:57AM -0700, Russ Allbery wrote:

>>  * Obtain the system host name with gethostname().
>>  * Look up an IP address for that host with gethostbyname().

> The bug is here. This is completely wrong but sadly very common
> practice. It is common because it is portable and works with some simple
> configurations (namely, single-homed machines with static IP address).

Well, I don't really agree with the statement that it's completely wrong,
but I do understand what you're saying about the semantic mismatch at work

>>  * Look up the names associated with that address with gethostbyaddr().
>>  * Walk the alias list of the result and find the first name containing
>>    a period.

> The proper fix would be to enumerate all IP addresses of all network
> interfaces and select one that has an appropriate name. Unfortunately
> this is non-trivial and highly OS-dependent, although the libdumbnet1
> package provides a platform-independent API for this (among other
> things).

You've pretty much covered in that paragraph the reasons why INN can't
take that approach.  :)  I know how hard this is from watching MIT
Kerberos try to solve this problem and don't want to touch this
portability nightmare with a ten-foot pole.

Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Reply to: