diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-15 12:49:11 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-15 12:50:28 +0200 |
commit | 6cdc3195a6d174363a813d58b8372f0f5cd546b1 (patch) | |
tree | 360d653239f5e6bbcc539599b46e239b07c6c083 | |
parent | 296381ff4f69715ed880adcce7d5ce608153e767 (diff) | |
download | busybox-w32-6cdc3195a6d174363a813d58b8372f0f5cd546b1.tar.gz busybox-w32-6cdc3195a6d174363a813d58b8372f0f5cd546b1.tar.bz2 busybox-w32-6cdc3195a6d174363a813d58b8372f0f5cd546b1.zip |
nslookup: change -stats to -debug (it's a bug in bind that it accepts -s)
function old new delta
packed_usage 32211 32189 -22
nslookup_main 2754 2692 -62
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-84) Total: -84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/nslookup.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c index 112e8763c..63bb46b55 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c | |||
@@ -21,7 +21,7 @@ | |||
21 | //kbuild:lib-$(CONFIG_NSLOOKUP) += nslookup.o | 21 | //kbuild:lib-$(CONFIG_NSLOOKUP) += nslookup.o |
22 | 22 | ||
23 | //usage:#define nslookup_trivial_usage | 23 | //usage:#define nslookup_trivial_usage |
24 | //usage: IF_FEATURE_NSLOOKUP_BIG("[-type=QUERY_TYPE] ") "HOST [DNS_SERVER]" | 24 | //usage: IF_FEATURE_NSLOOKUP_BIG("[-type=QUERY_TYPE] [-debug] ") "HOST [DNS_SERVER]" |
25 | //usage:#define nslookup_full_usage "\n\n" | 25 | //usage:#define nslookup_full_usage "\n\n" |
26 | //usage: "Query DNS about HOST" | 26 | //usage: "Query DNS about HOST" |
27 | //usage: | 27 | //usage: |
@@ -306,7 +306,7 @@ static const char *const rcodes[] = { | |||
306 | }; | 306 | }; |
307 | 307 | ||
308 | #if ENABLE_FEATURE_IPV6 | 308 | #if ENABLE_FEATURE_IPV6 |
309 | static const char v4_mapped[] = { 0,0,0,0,0,0,0,0,0,0,0xff,0xff }; | 309 | static const char v4_mapped[12] = { 0,0,0,0, 0,0,0,0, 0,0,0xff,0xff }; |
310 | #endif | 310 | #endif |
311 | 311 | ||
312 | struct globals { | 312 | struct globals { |
@@ -325,7 +325,7 @@ struct globals { | |||
325 | } while (0) | 325 | } while (0) |
326 | 326 | ||
327 | enum { | 327 | enum { |
328 | OPT_stats = (1 << 0), | 328 | OPT_debug = (1 << 0), |
329 | }; | 329 | }; |
330 | 330 | ||
331 | static int parse_reply(const unsigned char *msg, size_t len) | 331 | static int parse_reply(const unsigned char *msg, size_t len) |
@@ -634,7 +634,7 @@ static int send_queries(struct ns *ns, struct query *query, int n_queries) | |||
634 | query[qn].rlen = recvlen; | 634 | query[qn].rlen = recvlen; |
635 | tcur = monotonic_ms(); | 635 | tcur = monotonic_ms(); |
636 | #if 1 | 636 | #if 1 |
637 | if (option_mask32 & OPT_stats) { | 637 | if (option_mask32 & OPT_debug) { |
638 | printf("Query #%d completed in %ums:\n", qn, tcur - tstart); | 638 | printf("Query #%d completed in %ums:\n", qn, tcur - tstart); |
639 | } | 639 | } |
640 | if (rcode != 0) { | 640 | if (rcode != 0) { |
@@ -788,7 +788,7 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv) | |||
788 | "querytype\0" /* 1 */ | 788 | "querytype\0" /* 1 */ |
789 | "port\0" /* 2 */ | 789 | "port\0" /* 2 */ |
790 | "retry\0" /* 3 */ | 790 | "retry\0" /* 3 */ |
791 | "stats\0" /* 4 */ | 791 | "debug\0" /* 4 */ |
792 | "t\0" /* disambiguate with "type": else -t=2 fails */ | 792 | "t\0" /* disambiguate with "type": else -t=2 fails */ |
793 | "timeout\0" /* 6 */ | 793 | "timeout\0" /* 6 */ |
794 | ""; | 794 | ""; |
@@ -829,7 +829,7 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv) | |||
829 | G.default_retry = xatou_range(val, 1, INT_MAX); | 829 | G.default_retry = xatou_range(val, 1, INT_MAX); |
830 | } | 830 | } |
831 | if (i == 4) { | 831 | if (i == 4) { |
832 | option_mask32 |= OPT_stats; | 832 | option_mask32 |= OPT_debug; |
833 | } | 833 | } |
834 | if (i > 4) { | 834 | if (i > 4) { |
835 | G.default_timeout = xatou_range(val, 1, INT_MAX / 1000); | 835 | G.default_timeout = xatou_range(val, 1, INT_MAX / 1000); |
@@ -883,10 +883,12 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv) | |||
883 | c = send_queries(&G.server[rc], queries, n_queries); | 883 | c = send_queries(&G.server[rc], queries, n_queries); |
884 | if (c > 0) { | 884 | if (c > 0) { |
885 | /* more than zero replies received */ | 885 | /* more than zero replies received */ |
886 | if (option_mask32 & OPT_stats) { | 886 | #if 0 /* which version does this? */ |
887 | if (option_mask32 & OPT_debug) { | ||
887 | printf("Replies:\t%d\n", G.server[rc].replies); | 888 | printf("Replies:\t%d\n", G.server[rc].replies); |
888 | printf("Failures:\t%d\n\n", G.server[rc].failures); | 889 | printf("Failures:\t%d\n\n", G.server[rc].failures); |
889 | } | 890 | } |
891 | #endif | ||
890 | break; | 892 | break; |
891 | //FIXME: we "break" even though some queries may still be not answered, and other servers may know them? | 893 | //FIXME: we "break" even though some queries may still be not answered, and other servers may know them? |
892 | } | 894 | } |
@@ -900,7 +902,8 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv) | |||
900 | // $ nslookup gmail.com 8.8.8.8 | 902 | // $ nslookup gmail.com 8.8.8.8 |
901 | // ;; connection timed out; no servers could be reached | 903 | // ;; connection timed out; no servers could be reached |
902 | // | 904 | // |
903 | // $ nslookup -s gmail.com 8.8.8.8; echo EXITCODE:$? | 905 | // Using TCP mode: |
906 | // $ nslookup -vc gmail.com 8.8.8.8; echo EXITCODE:$? | ||
904 | // <~10 sec> | 907 | // <~10 sec> |
905 | // ;; Connection to 8.8.8.8#53(8.8.8.8) for gmail.com failed: timed out. | 908 | // ;; Connection to 8.8.8.8#53(8.8.8.8) for gmail.com failed: timed out. |
906 | // <~10 sec> | 909 | // <~10 sec> |