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

Re: Needless DNS queries



On Tue, 7 Jun 2022, Greg Wooledge wrote:

On Tue, Jun 07, 2022 at 11:22:34AM -0400, Dan Ritter wrote:

search		Search list for host-name lookup.  By default, the search
 [...]
	This may be changed by listing the desired domain search
path following the search keyword with spaces or tabs separating the
names.  Resolver queries having fewer than ndots dots (default is
1) in them will be attempted using each component of the search path in
turn until a match is found.

I've read this paragraph a few times, and as far as I can tell, it's
simply wrong.

Seems right to me:

$ cat /etc/resolv.conf
search home.woodall.me.uk
options ndots:3
nameserver 2001:8b0:bfcd:100:216:3eff:fee0:7102
nameserver 2001:8b0:bfcd:8100:216:3eff:fee1:7102

$ host ipv4.wlan.dirac
ipv4.wlan.dirac.home.woodall.me.uk has address 192.168.3.16
ipv4.wlan.dirac.home.woodall.me.uk has address 192.168.4.16

Change that 3 to a 2 and:

$ host ipv4.wlan.dirac
Host ipv4.wlan.dirac not found: 3(NXDOMAIN)


If you go down farther in the page and look at:

             ndots:n
                    Sets a threshold for the number of dots which must appear
                    in a name given to res_query(3) (see resolver(3))  before
                    an  initial absolute query will be made.  The default for
                    n is 1, meaning that if there are any dots in a name, the
                    name  will  be tried first as an absolute name before any
                    search list elements are appended to it.  The  value  for
                    this option is silently capped to 15.

This one says that it simply determines whether the name will be tried
as is *before* appending the search domain(s) to it, or whether it just
skips straight to appending the search domains.


Doesn't that say that, in my second example it will try ipv4.wlan.dirac.,
get NXDOMAIN, and pass that up the stack.

My experience, and the OP's experience, suggests that the description in
the ndots paragraph is correct, and the description in the search paragraph
is not.

To the best of my knowledge, there isn't any setting to *prevent* the
appending of search domains to a name, no matter how many dots you put
in the name.




Reply to: