DNS responses were limited to 512 bytes back when they were UDP only, but if you have a TCP connection you can get up to 64KiB.
Also use the existing constant for the size of rrname. Also update the help text. Fixes #56. Test: `toybox host value.testing.express` --- toys/pending/host.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
From b0dd2ddea8c66c7c85da2944728a0080f8869cd4 Mon Sep 17 00:00:00 2001 From: Elliott Hughes <[email protected]> Date: Fri, 6 Sep 2019 22:31:48 -0700 Subject: [PATCH] host: cope with large DNS responses. DNS responses were limited to 512 bytes back when they were UDP only, but if you have a TCP connection you can get up to 64KiB. Also use the existing constant for the size of rrname. Also update the help text. Fixes #56. Test: `toybox host value.testing.express` --- toys/pending/host.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toys/pending/host.c b/toys/pending/host.c index fe0f23aa..87688052 100644 --- a/toys/pending/host.c +++ b/toys/pending/host.c @@ -16,8 +16,8 @@ config HOST or an IPv4 dotted or IPv6 colon-separated address to reverse lookup. SERVER (if present) is the DNS server to use. - -a no idea - -t not a clue + -a -v -t ANY + -t TYPE query records of type TYPE -v verbose */ @@ -70,8 +70,8 @@ void host_main(void) int verbose=(toys.optflags & (FLAG_a|FLAG_v)), type, i, j, ret, sec, count, rcode, qlen, alen, pllen = 0; unsigned ttl, pri, v[5]; - unsigned char qbuf[280], abuf[512], *p; - char *name, *nsname, rrname[256], plname[640], ptrbuf[128]; + unsigned char qbuf[280], abuf[65536], *p; + char *name, *nsname, rrname[MAXDNAME], plname[640], ptrbuf[128]; struct addrinfo *ai, iplit_hints = { .ai_flags = AI_NUMERICHOST }; name = *toys.optargs; -- 2.23.0.187.g17f5b7556c-goog
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
