Web lists-archives.com

Re: resolv.conf (was i386 version for chrome)


On Sun, Oct 28, 2018 at 04:17:17PM +0300, Reco wrote:
> 	Hi.
> On Sun, Oct 28, 2018 at 02:13:30PM +0100, Pierre Frenkiel wrote:
> > On Sun, 28 Oct 2018, Reco wrote:
> > 
> > > strace getent hosts bad.solutions
> > 
> >   thanks for your answer, but the output is rather obscure for a non-guru user,
> >   except a lot of "no such file or directory"
> >   In particular, I don't see how to explain the difference of behaviour on
> >   my 2 computers.
> Not pretending to be a guru, but can you post the results somewhere?

I don't repost those two strace outputs, archives will be better without

The result is somewhat unexpected (to me at least):

Judging from multiple:

stat("/etc/resolv.conf", 0x7ffbffffae40) = -1 ENOENT 

The host's resolver is configured for conventional DNS resolution.

/etc/resolv.conf is not present, so resolver tries to find DNS at udp:53:

connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("")}, 16) = 0

Which it does (zero return code), and sends DNS query there:

sendto(3, "\307N\1\0\0\1\0\0\0\0\0\0\3bad\tsolutions\0\0\34\0\1", 31, MSG_NOSIGNAL, NULL, 0) = 31

And something that's listening udp:53 on your laptop replies:

recvfrom(3, "\307N\201\200\0\1\0\0\0\1\0\0\3bad\tsolutions\0\0\34\0\1\300"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("")}, [28->16]) = 91

The fact that libc's resolver have a hardcoded fallback to localhost in
the absense of resolv.conf was not known to me until now, but it's
documented at resolv.conf(5):

If  this  file  does  not exist, only the name server on the local
machine will be queried

So, answering your original question, you have working name resolution
because you have a caching nameserver on your laptop. My money's on