From e65d4989a138c7a4c196a8137524453a7fedae20 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 14 May 2019 11:38:13 +1000 Subject: [PATCH] Recurse to find the root server list with 'dig +trace'. --- CHANGES | 3 +++ bin/dig/dig.c | 2 +- bin/dig/dig.docbook | 6 ++++-- bin/dig/dighost.c | 8 +++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 535669948b..53bf0b65f4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5237. [bug] Recurse to find the root server list with 'dig +trace'. + [GL #1028] + 5236. [func] Add SipHash 2-4 implementation in lib/isc/siphash.c and switch isc_hash_function() to use SipHash 2-4. [GL #605] diff --git a/bin/dig/dig.c b/bin/dig/dig.c index afaf3e76d3..8b11e035b6 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -1462,7 +1462,7 @@ plus_option(char *option, bool is_batchfile, lookup->trace = state; lookup->trace_root = state; if (state) { - lookup->recurse = false; + lookup->recurse = true; lookup->identify = true; lookup->comments = false; lookup->rrcomments = 0; diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook index e401442716..0e5e374a0d 100644 --- a/bin/dig/dig.docbook +++ b/bin/dig/dig.docbook @@ -1010,8 +1010,10 @@ in the query. This bit is set by default, which means dig normally sends recursive queries. Recursion is automatically disabled when - the +nssearch or - +trace query options are used. + using the +nssearch option, and + when using +trace except for + an initial recursive query to get the list of root + servers. diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index a7ea342670..c3e553b7ab 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -2191,12 +2191,14 @@ setup_lookup(dig_lookup_t *lookup) { lookup->sendmsg->id = (dns_messageid_t)isc_random16(); lookup->sendmsg->opcode = lookup->opcode; lookup->msgcounter = 0; + /* - * If this is a trace request, completely disallow recursion, since - * it's meaningless for traces. + * If this is a trace request, completely disallow recursion after + * looking up the root name servers, since it's meaningless for traces. */ - if (lookup->trace || (lookup->ns_search_only && !lookup->trace_root)) + if ((lookup->trace || lookup->ns_search_only) && !lookup->trace_root) { lookup->recurse = false; + } if (lookup->recurse && lookup->rdtype != dns_rdatatype_axfr &&