Topic: nslookup ignores server setting

I'm trying to write a health check script that will verify connectivity by speaking to some nameservers.

When I try to use the server feature of the nslookup command, nslookup appears to just ignore it. First the command appears to state that it supports the server option:

root@OpenWrt:~/scripts# nslookup
BusyBox v1.00 (2007.01.30-11:42+0000) multi-call binary

Usage: nslookup [HOST] [SERVER]

Queries the nameserver for the IP address of the given HOST
optionally using a specified DNS server

So now we'll query b.root-servers.net (192.228.79.201), to get the address of a.root-servers.net:

root@OpenWrt:~/scripts# nslookup a.root-servers.net 192.228.79.201
Server:     b.root-servers.net
Address:    192.228.79.201

Name:       a.root-servers.net
Address:    198.41.0.4

Everything appears to be in order, however a tcpdump capture on the upstream router / default DNS server shows that it looked up the PTR for the specified server, then it looked up the requested host, however both queries were executed against the nameserver specified in resolv.conf.

08:33:24.840377 IP 172.29.1.101.2056 > 172.29.1.1.53:  2+ PTR? 201.79.228.192.in-addr.arpa. (45)
08:33:24.867944 IP 172.29.1.1.53 > 172.29.1.101.2056:  2 1/3/4 (231)
08:33:24.870948 IP 172.29.1.101.2056 > 172.29.1.1.53:  3+ A? a.root-servers.net. (36)
08:33:24.892028 IP 172.29.1.1.53 > 172.29.1.101.2056:  3 1/4/3 A a.root-servers.net (162)

Anyone have any ideas as to what's going on? Is there somehow something wrong with my command, is the upstream busybox nslookup just broken? Any and all advice will be appreciated.

Re: nslookup ignores server setting

same on kamikaze

3 (edited by johnf 2007-12-29 15:22:03)

Re: nslookup ignores server setting

Another important note, the package bind-dig, at least on kamikaze, is broken:

dig: can't load library 'liblwres.so.30'

I downloaded bind-dig onto my install (there isn't enough flash to install it, but I can run it out of /tmp). It does have proper resolver behavior, but the package is 1.2M, way larger than what I can fit into my install.

EDIT: Spelling.

Re: nslookup ignores server setting

I've confirmed that this bug appears to be upstream, in the busybox source itself [1]. And in particular this call:

rc = getaddrinfo(hostname, NULL /*service*/, &hint, &result);

Which completely ignores the whole server setting.

I'm going to try to put together a patch, we'll see how that goes.

[1] http://www.busybox.net/cgi-bin/viewcvs. … iew=markup

Re: nslookup ignores server setting

I opened a ticket on this back in July that unfortunately hasn't been touched.
http://bugs.busybox.net/view.php?id=4024

Can anyone confirm if this is still an issue in BusyBox v1.11.2?