gethostbyname(my_name) and IL2-Sturmovik
patrol at sinus.cz
Tue Dec 13 11:58:39 CST 2005
> I think you are wrong. POSIX does not say that it's wrong to have the
> computer name associated with 127.0.0.1 in /etc/hosts, and it doesn't say
> that gethostbyname(my_name) should return a "real" IP.
OK, but it also doesn't explicitly state that gethostbyname(my_name) may
return 127.0.0.1, so it's just neutral :-).
> If I remember
> correctly, though, Microsoft, specifies that gethostbyname(my_name)
> *should* return real IP.
I don't know M$ standards, sorry, cannot comment on this.
> This subtle difference means that Wine must take extra care. Fetching a
> real IP on a UNIX host is not trivial, but doable.
Yes, it is.
man 5 hosts tells that:
"The Berkeley Internet Name Domain (BIND) Server implements the Internet name server for UNIX systems. It aug
ments or replaces the /etc/hosts file or host name lookup, and frees a host from relying on /etc/hosts being up
to date and complete."
So it seems to imply that the DNS info is currently an authoritative source
for host name queries. Of course everybody knows it, I'm just making note of
it to support my following question:
Did you ever see in the real world that a DNS server would return 127.0.0.1
as a response to a regular host name query ? I think not.
And on the other side, try to query a DNS server for "localhost". Every DNS
server should immediately return 127.0.0.1, it's RFC compliance requirement.
Isn't it logical to keep the host table coherent with DNS ? Or are you happy
that in case your DNS server fails you get totally different results ?
Of course I cannot argue more. It's just about the administrator's personal
style and knowledge. I'm maintaining and administering Unix systems from 1985,
long before Linux was born, and I would never allow such a thing in my host
table. But if the current distro maintainers are of another view, I will not
do anything against it. It's just about Open Source freedom: I will remove that
patch from wine for me, and that's it :-).
With regards, Pavel Troller
More information about the wine-devel