aboutsummaryrefslogtreecommitdiff
path: root/networking/nslookup.c
AgeCommit message (Collapse)Author
2020-11-30decrease padding: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko
text data bss dec hex filename 1021236 559 5052 1026847 fab1f busybox_old 1021120 559 5052 1026731 faaab busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-06avoid using strok - eliminates use of hidden global variableDenys Vlasenko
function old new delta udhcp_str2optset 616 650 +34 setpriv_main 950 975 +25 switch_root_main 688 706 +18 parse 958 970 +12 getopt_main 622 628 +6 parse_resolvconf 302 306 +4 mpstat_main 1139 1142 +3 static.p 4 - -4 cdcmd 717 702 -15 strtok 148 - -148 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 7/1 up/down: 102/-167) Total: -65 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27nslookup: implement support for SRV recordsJo-Philipp Wich
Add support for querying and parsing SRV DNS records. function old new delta send_queries 1711 1865 +154 qtypes 72 80 +8 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27nslookup: handle replies without RRsJo-Philipp Wich
Under some circumstances, a DNS reply might contain no resource records, e.g. when a valid domain is queried that does not have records of the requested type. Example with nslookup from BIND dnsutils: $ nslookup -q=SRV example.org Server: 10.11.12.13 Address: 10.11.12.13#53 Non-authoritative answer: *** Can't find example.org: No answer Currently the busybox nslookup applet simply prints nothing after the "Non-authoritative answer:" line in the same situation. This change modifies nslookup to either print "Parse error" or "No answer" diagnostics, depending on the parse_reply() return value. function old new delta send_queries 1676 1711 +35 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-09nslookup: return exitcode 1 on resolution errorsDenys Vlasenko
function old new delta nslookup_main 757 760 +3 send_queries 1690 1677 -13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-08-01nslookup: add support for search domains, closes 11161Denys Vlasenko
function old new delta parse_resolvconf - 311 +311 add_query_with_search - 105 +105 nslookup_main 873 757 -116 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/1 up/down: 416/-116) Total: 300 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27nslookup: placate "warning: unused variable i"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: simplify make_ptrDenys Vlasenko
function old new delta nslookup_main 2644 2611 -33 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: get rid of query::rlen fieldDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: move array of queries to "globals"Denys Vlasenko
function old new delta add_query 95 89 -6 nslookup_main 2692 2641 -51 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-57) Total: -57 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: accept lowercase -type=soa, document query typesDenys Vlasenko
Usage: nslookup [-type=QUERY_TYPE] [-debug] HOST [DNS_SERVER] Query DNS about HOST QUERY_TYPE: soa,ns,a,aaaa,cname,mx,txt,ptr,any function old new delta packed_usage 32189 32258 +69 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: change -stats to -debug (it's a bug in bind that it accepts -s)Denys Vlasenko
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>
2018-04-15nslookup: rework option parsingDenys Vlasenko
function old new delta nslookup_main 2715 2754 +39 packed_usage 32179 32211 +32 add_ns 65 66 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 72/0) Total: 72 bytes text data bss dec hex filename 926262 555 5740 932557 e3acd busybox_old 926239 555 5740 932534 e3ab6 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: smaller qtypes[] arrayDenys Vlasenko
function old new delta nslookup_main 2708 2715 +7 qtypes 80 72 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-8) Total: -1 bytes text data bss dec hex filename 926277 555 5740 932572 e3adc busybox_old 926262 555 5740 932557 e3acd busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-15nslookup: process replies immediately, do not store themDenys Vlasenko
function old new delta nslookup_main 1837 2708 +871 parse_reply 852 - -852 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 871/-852) Total: 19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14nslookup: fix output corruption for "nslookup 1.2.3.4"Denys Vlasenko
function old new delta nslookup_main 1832 1837 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14nslookup: more closely resemble output format of bind-utils-9.11.3Denys Vlasenko
function old new delta nslookup_main 1880 1832 -48 parse_reply 1022 852 -170 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-218) Total: -218 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14nslookup: shrink send_queries()Denys Vlasenko
function old new delta rcodes 68 64 -4 nslookup_main 2007 1880 -127 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-131) Total: -131 bytes text data bss dec hex filename 926735 555 5740 933030 e3ca6 busybox_old 926525 555 5740 932820 e3bd4 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14nslookup: use xmalloc_sockaddr2dotted() instead of homegrown functionDenys Vlasenko
function old new delta nslookup_main 2091 2007 -84 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14nslookup: usee bbox network functions instead of opne-coded messDenys Vlasenko
function old new delta nslookup_main 2363 2091 -272 add_ns 663 65 -598 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-870) Total: -870 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14nslookup: add openwrt / lede versionDenys Vlasenko
Needs work on size reduction function old new delta nslookup_main 114 2363 +2249 parse_reply - 1022 +1022 add_ns - 663 +663 ns_parserr - 486 +486 ns_initparse - 184 +184 ns_skiprr - 117 +117 add_query - 95 +95 qtypes - 80 +80 rcodes - 68 +68 dn_skipname - 58 +58 ns_name_uncompress - 56 +56 ns_get16 - 13 +13 v4_mapped - 12 +12 ns_get32 - 9 +9 res_init 3 - -3 __res_state 6 - -6 xmalloc_sockaddr2hostonly_noport 10 - -10 gai_strerror 47 - -47 set_default_dns 95 - -95 print_host 199 - -199 static.res 512 - -512 ------------------------------------------------------------------------------ (add/remove: 15/10 grow/shrink: 1/0 up/down: 5112/-872) Total: 4240 bytes text data bss dec hex filename 921944 555 6252 928751 e2bef busybox_old 927375 555 5740 933670 e3f26 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-19Update remaining menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23Convert all networking/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27nslookup: set default DNS server again. Hopefully helps with 675Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11move remaining help text from include/usage.src.hPere Orga
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-22don't call freeaddinfo(NULL)Vitaly Magerya
Signed-off-by: Vitaly Magerya <vmagerya@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-11-17nslookup: glibc + IPv6 address of DNS server don't mix (yet)Denis Vlasenko
2008-11-16nslookup: allow usage of IPv6 addresses or hostnamesDenis Vlasenko
for DNS server name; allow for port specification. Tested to work: "nslookup google.com [::1]:5353"
2008-11-04nslookup: tiny shrink (-5 bytes); add comment about res_initDenis Vlasenko
inet_common: cosmetics, no code changes
2007-10-11add -fvisibility=hidden to CC flags, mark XXX_main functionsDenis Vlasenko
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-01printf("%s\n") -> puts()Denis Vlasenko
2007-09-27introduce bb_putchar(). saves ~1800 on uclibc (less on glibc).Denis Vlasenko
2007-08-18introduce and use xdup2(int, int)Denis Vlasenko
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is) remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions sockaddr2str 142 156 +14 collect_blk 467 474 +7 xdup2 28 33 +5 singlemount 4456 4454 -2 print_host 214 212 -2 nslookup_main 139 137 -2 ftpgetput_main 414 412 -2 udhcpd_main 1258 1255 -3 udhcpc_main 2405 2402 -3 traceroute_main 4125 4122 -3 nc_main 1072 1069 -3 buffer_fill_and_print 76 73 -3 xmalloc_sockaddr2hostonly_noport 18 14 -4 xmalloc_sockaddr2host_noport 18 14 -4 xmalloc_sockaddr2host 15 11 -4 xmalloc_sockaddr2dotted_noport 18 14 -4 xmalloc_sockaddr2dotted 18 14 -4 wget_main 2618 2614 -4 ping_main 393 389 -4 ip_port_str 120 115 -5 dhcprelay_main 1146 1141 -5 dnsd_main 1531 1525 -6 passwd_main 1110 1102 -8 udhcp_kernel_packet 206 197 -9 udhcp_listen_socket 154 144 -10 getty_main 2576 2566 -10 setup 655 640 -15 xmove_fd 51 34 -17 dolisten 759 742 -17 tcpudpsvd_main 1866 1836 -30 startservice 339 299 -40
2007-05-26usage.c: remove reference to busybox.hDenis Vlasenko
*: s/include "busybox.h"/include "libbb.h"
2007-04-12style fixes. No code changesDenis Vlasenko
2007-02-04add x to IPv6 functions which can dieDenis Vlasenko
2007-02-03suppress warnings about easch <applet>_main() havingDenis Vlasenko
no preceding prototype
2007-01-22clean up commented out old codeDenis Vlasenko
2007-01-22nslookup: full circle. Here we started IPv6 work. Use "new API"Denis Vlasenko
and thus save a few bytes.
2007-01-22- sed -i -e "/\$Id:/d;"Bernhard Reutner-Fischer
2007-01-11Trailing whitespace removal over entire treeDenis Vlasenko
2006-11-10wget: fix error message.Denis Vlasenko
Bad: wget http://127.0.0.1:81/fgdg/Makefile Connecting to 127.0.0.1[127.0.0.1]:81 : HTTP/1.0 404 Not Foundror 404 Not Found Good: wget http://127.0.0.1:81/fgdg/Makefile Connecting to 127.0.0.1[127.0.0.1]:81 get: server returned error: HTTP/1.0 404 Not Found nslookup: fix my mistake applets: make Bernhard Fischer <rep.nop@aon.at> happy :)
2006-11-07small ipv6 doc changes; nslookup a tiny bit smallerDenis Vlasenko
2006-10-26nslookup: make it more IPv6 friendlyDenis Vlasenko
2006-10-26silly size savings and capitalization fixesDenis Vlasenko
2006-07-11Add one-line GPL boilerplate to these source files."Robert P. J. Day"