Hello Raf, [email protected] (Raf Czlonka), 2016.06.08 (Wed) 12:15 (CEST): > On Wed, Jun 08, 2016 at 10:59:00AM BST, Marcus MERIGHI wrote: > > I would not expect getent(1) ("get entries from administrative > > database") to do network DNS lookups. > > Yes, it even says so in the man page > man 1 getent > > The order in which entries are looked up > is defined by the specific database (for example, the lookup order for > the ???hosts??? database is determined by resolv.conf(5)).
*blushes* Thanks for the clue stick! I did read getent(1) but not enough it seems. > I do understand where the confusion comes from though - it's the naming: > > getent hosts database != /etc/hosts file > > However, the same goes for: > > getent passwd database != /etc/passwd file > > as the former will also include YP accounts if configured. I always understood getent(1) as a canonical way to query _local_ databases without cat(1), set(1), awk(1) etc. With the additional advantage of not changing interface when the underlying files change format. So there is no way of knowning whether the result comes from hosts(5) or the resolver if you use getent(1) hosts. Bye + thanks, Marcus > > Usual sendbug(1) machine info omitted because it applies to all machines > > I have access to - though these are all amd64. > > > > Reproduce: > > > > have a default hosts(5): > > 127.0.0.1 localhost > > ::1 localhost > > > > have a working nameserver in resolv.conf(5). > > > > then run the following commands: > > > > $ getent hosts 8.8.8.7 > > 8.8.8.7 8.8.8.7 > > > > $ getent hosts 8.8.8.8 > > 8.8.8.8 google-public-dns-a.google.com > > > > $ getent hosts www.openbsd.org > > 129.128.5.194 www.openbsd.org > > > > To me this looks like getent(1) does network dns resolution instead of > > returning "no result" if there is no matching entry in hosts(5). > > > > I can see the lookups in unbound(8)s logs in case of local resolving via > > resolv.conf(5). > > > > Bye, Marcus
