diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-06-27 01:09:51 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-06-27 01:09:51 +0200 |
| commit | d66eb9042dcc6ee274949fb83612cecbbde44a4a (patch) | |
| tree | 32d9598a9539304d3f5028c4aea3c61cff275b3d | |
| parent | 1f5e81f8f83087082108cf9449068ec4c2a3125e (diff) | |
| download | busybox-w32-d66eb9042dcc6ee274949fb83612cecbbde44a4a.tar.gz busybox-w32-d66eb9042dcc6ee274949fb83612cecbbde44a4a.tar.bz2 busybox-w32-d66eb9042dcc6ee274949fb83612cecbbde44a4a.zip | |
nslookup: set default DNS server again. Hopefully helps with 675
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | networking/nslookup.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c index f4fd407dd..dd4b1ffed 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c | |||
| @@ -138,6 +138,9 @@ static void set_default_dns(const char *server) | |||
| 138 | { | 138 | { |
| 139 | len_and_sockaddr *lsa; | 139 | len_and_sockaddr *lsa; |
| 140 | 140 | ||
| 141 | if (!server) | ||
| 142 | return; | ||
| 143 | |||
| 141 | /* NB: this works even with, say, "[::1]:5353"! :) */ | 144 | /* NB: this works even with, say, "[::1]:5353"! :) */ |
| 142 | lsa = xhost2sockaddr(server, 53); | 145 | lsa = xhost2sockaddr(server, 53); |
| 143 | 146 | ||
| @@ -181,9 +184,17 @@ int nslookup_main(int argc, char **argv) | |||
| 181 | /* (but it also says "may be enabled in /etc/resolv.conf") */ | 184 | /* (but it also says "may be enabled in /etc/resolv.conf") */ |
| 182 | /*_res.options |= RES_USE_INET6;*/ | 185 | /*_res.options |= RES_USE_INET6;*/ |
| 183 | 186 | ||
| 184 | if (argv[2]) | 187 | set_default_dns(argv[2]); |
| 185 | set_default_dns(argv[2]); | ||
| 186 | 188 | ||
| 187 | server_print(); | 189 | server_print(); |
| 190 | |||
| 191 | /* getaddrinfo and friends are free to request a resolver | ||
| 192 | * reinitialization. Just in case, set_default_dns() again | ||
| 193 | * after getaddrinfo (in server_print). This reportedly helps | ||
| 194 | * with bug 675 "nslookup does not properly use second argument" | ||
| 195 | * at least on Debian Wheezy and Openwrt AA (eglibc based). | ||
| 196 | */ | ||
| 197 | set_default_dns(argv[2]); | ||
| 198 | |||
| 188 | return print_host(argv[1], "Name:"); | 199 | return print_host(argv[1], "Name:"); |
| 189 | } | 200 | } |
