--nextPart8843642.MpNrDVBtGa Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Dawit A. wrote: >Is there any reason why we do a DNS query even when the host is listed in >the /etc/hosts file ? We even do a lookup for "localhost" !!! Why ? This > was really a surprise to me, but tcpdump confirms that it does indeed > happen. Thiago any comments on this ? "localhost" is special-cased. It's handled by our code directly. There=20 should never be queries about it. As for hosts in /etc/hosts, blame your glibc for doing the unnecessary=20 queries. The reason that they are done is because we do IPv6 lookups.=20 Since /etc/hosts contains only IPv4 addresses, libnss_files.so returns an=20 error code of "not found", instead of "found: it doesn't exist". Therefore,= =20 the query is passed along to libnss_dns.so, which sends the DNS query. A test with "kde.org" in Konqueror resulted in the following lookups: =2D query A kde.org =2D query AAAA kde.org =2D response A 80.232.38.131 =2D response (probably for AAAA) =2D AAAA kde.org.local.lan =2D response, No such name =2D query AAAA kde.org.macieira.info =2D response, No such name Then this repeats three more times. Why? Because each ioslave must resolve= =20 the name again. For a solution for this, see bugs #63088 and #68894. As for the unnecessary queries, the blame goes to libnss_files and=20 libnss_dns. As you can see, the query for "AAAA kde.org" returned NOTFOUND= =20 from nss_files, so DNS kicked in. Then, the DNS query returned correctly a= =20 "NOERROR" DNS packet, indicating that the name exists, but has no IPv6=20 address. But, nooo.... nss_dns decided that wasn't good enough and tried appending=20 the domains listed in /etc/resolv.conf's search directive. =2D-=20 Thiago Macieira - Registered Linux user #65028 thiago (AT) macieira (DOT) info ICQ UIN: 1967141 PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 --nextPart8843642.MpNrDVBtGa Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBBapRSM/XwBW70U1gRAg0WAJwOc/mSgR9C/O5XYWdpRRLnaft9/ACfR1Jq SZ2t1CIYb9VQ4UXRC5VNwok= =NmUK -----END PGP SIGNATURE----- --nextPart8843642.MpNrDVBtGa--