Commit 033a5909 authored by Mark Andrews's avatar Mark Andrews

4586. [func] dig, host and nslookup now use TCP for ANY queries.

                        [RT #44687]
parent 3742338a
4586. [func] dig, host and nslookup now use TCP for ANY queries.
[RT #44687]
4585. [port] win32: Set CompileAS value. [RT #42474]
4584. [bug] A number of memory usage statistics were not properly
......
......@@ -1744,6 +1744,9 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
if (rdtype == dns_rdatatype_axfr) {
(*lookup)->section_question = plusquest;
(*lookup)->comments = pluscomm;
} else if (rdtype == dns_rdatatype_any) {
if (!(*lookup)->tcp_mode_set)
(*lookup)->tcp_mode = ISC_TRUE;
}
(*lookup)->ixfr_serial = ISC_FALSE;
}
......@@ -2054,6 +2057,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
plusquest;
lookup->comments = pluscomm;
}
if (rdtype ==
dns_rdatatype_any &&
!lookup->tcp_mode_set)
lookup->tcp_mode = ISC_TRUE;
lookup->ixfr_serial = ISC_FALSE;
}
continue;
......
......@@ -1067,10 +1067,10 @@
<listitem>
<para>
Use [do not use] TCP when querying name servers. The
default behavior is to use UDP unless an
<literal>ixfr=N</literal> query is requested, in which
case the default is TCP. AXFR queries always use
TCP.
default behavior is to use UDP unless a type
<literal>any</literal> or <literal>ixfr=N</literal>
query is requested, in which case the default is TCP.
AXFR queries always use TCP.
</para>
</listitem>
</varlistentry>
......
......@@ -602,7 +602,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
return (result);
}
static const char * optstring = "46aAc:dilnm:rst:vVwCDN:R:TW:";
static const char * optstring = "46aAc:dilnm:rst:vVwCDN:R:TUW:";
/*% version */
static void
......@@ -743,6 +743,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->ixfr_serial = serial;
lookup->tcp_mode = ISC_TRUE;
list_type = rdtype;
} else if (rdtype == dns_rdatatype_any) {
if (!lookup->tcp_mode_set)
lookup->tcp_mode = ISC_TRUE;
#ifdef WITH_IDN
} else if (rdtype == dns_rdatatype_a ||
rdtype == dns_rdatatype_aaaa ||
......@@ -815,6 +818,11 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
break;
case 'T':
lookup->tcp_mode = ISC_TRUE;
lookup->tcp_mode_set = ISC_TRUE;
break;
case 'U':
lookup->tcp_mode = ISC_FALSE;
lookup->tcp_mode_set = ISC_TRUE;
break;
case 'C':
debug("showing all SOAs");
......
......@@ -50,7 +50,7 @@
<refsynopsisdiv>
<cmdsynopsis sepchar=" ">
<command>host</command>
<arg choice="opt" rep="norepeat"><option>-aACdlnrsTwv</option></arg>
<arg choice="opt" rep="norepeat"><option>-aACdlnrsTUwv</option></arg>
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-N <replaceable class="parameter">ndots</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-R <replaceable class="parameter">number</replaceable></option></arg>
......@@ -291,14 +291,16 @@
<varlistentry>
<term>-T</term>
<term>-U</term>
<listitem>
<para>
TCP:
TCP/UDP:
By default, <command>host</command> uses UDP when making
queries. The <option>-T</option> option makes it use a TCP
connection when querying the name server. TCP will be
automatically selected for queries that require it, such
as zone transfer (AXFR) requests.
as zone transfer (AXFR) requests. Type ANY queries default
to TCP but can be forced to UDP initially using <option>-U</option>.
</para>
</listitem>
</varlistentry>
......
......@@ -51,7 +51,7 @@
#endif
static isc_boolean_t short_form = ISC_TRUE,
tcpmode = ISC_FALSE,
tcpmode = ISC_FALSE, tcpmode_set = ISC_FALSE,
identify = ISC_FALSE, stats = ISC_TRUE,
comments = ISC_TRUE, section_question = ISC_TRUE,
section_answer = ISC_TRUE, section_authority = ISC_TRUE,
......@@ -718,8 +718,10 @@ setoption(char *opt) {
usesearch = ISC_FALSE;
} else if (strncasecmp(opt, "vc", 3) == 0) {
tcpmode = ISC_TRUE;
tcpmode_set = ISC_TRUE;
} else if (strncasecmp(opt, "novc", 5) == 0) {
tcpmode = ISC_FALSE;
tcpmode_set = ISC_TRUE;
} else if (strncasecmp(opt, "deb", 3) == 0) {
short_form = ISC_FALSE;
showsearch = ISC_TRUE;
......@@ -796,7 +798,10 @@ addlookup(char *opt) {
lookup->retries = tries;
lookup->udpsize = 0;
lookup->comments = comments;
lookup->tcp_mode = tcpmode;
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
lookup->tcp_mode = ISC_TRUE;
else
lookup->tcp_mode = tcpmode;
lookup->stats = stats;
lookup->section_question = section_question;
lookup->section_answer = section_answer;
......
......@@ -308,8 +308,7 @@ nslookup -query=hinfo -timeout=10
</varlistentry>
<varlistentry>
<term><constant>
<replaceable><optional>no</optional></replaceable>debug</constant></term>
<term><constant><replaceable><optional>no</optional></replaceable>debug</constant></term>
<listitem>
<para>
Turn on or off the display of the full response packet and
......@@ -322,8 +321,7 @@ nslookup -query=hinfo -timeout=10
</varlistentry>
<varlistentry>
<term><constant>
<replaceable><optional>no</optional></replaceable>d2</constant></term>
<term><constant><replaceable><optional>no</optional></replaceable>d2</constant></term>
<listitem>
<para>
Turn debugging mode on or off. This displays more about
......@@ -345,8 +343,7 @@ nslookup -query=hinfo -timeout=10
</varlistentry>
<varlistentry>
<term><constant>
<replaceable><optional>no</optional></replaceable>search</constant></term>
<term><constant><replaceable><optional>no</optional></replaceable>search</constant></term>
<listitem>
<para>
If the lookup request contains at least one period but
......@@ -392,8 +389,7 @@ nslookup -query=hinfo -timeout=10
</varlistentry>
<varlistentry>
<term><constant>
<replaceable><optional>no</optional></replaceable>recurse</constant></term>
<term><constant><replaceable><optional>no</optional></replaceable>recurse</constant></term>
<listitem>
<para>
Tell the name server to query other servers if it does not
......@@ -437,8 +433,7 @@ nslookup -query=hinfo -timeout=10
</varlistentry>
<varlistentry>
<term><constant>
<replaceable><optional>no</optional></replaceable>vc</constant></term>
<term><constant><replaceable><optional>no</optional></replaceable>vc</constant></term>
<listitem>
<para>
Always use a virtual circuit when sending requests to the
......@@ -451,8 +446,7 @@ nslookup -query=hinfo -timeout=10
</varlistentry>
<varlistentry>
<term><constant>
<replaceable><optional>no</optional></replaceable>fail</constant></term>
<term><constant><replaceable><optional>no</optional></replaceable>fail</constant></term>
<listitem>
<para>
Try the next nameserver if a nameserver responds with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment