Commit 05816676 authored by Mark Andrews's avatar Mark Andrews
Browse files

3846. [bug] "dig +notcp ixfr=<serial>" should result in a UDP

                        ixfr query. [RT #35980]
parent 5cef2421
3846. [bug] "dig +notcp ixfr=<serial>" should result in a UDP
ixfr query. [RT #35980]
3845. [placeholder]
3844. [bug] Use the x64 version of the Microsoft Visual C++
......
......@@ -1231,8 +1231,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
switch (cmd[1]) {
case 'c': /* tcp */
FULLCHECK("tcp");
if (!is_batchfile)
if (!is_batchfile) {
lookup->tcp_mode = state;
lookup->tcp_mode_set = ISC_TRUE;
}
break;
case 'i': /* timeout */
FULLCHECK("timeout");
......@@ -1330,8 +1332,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
break;
case 'v':
FULLCHECK("vc");
if (!is_batchfile)
if (!is_batchfile) {
lookup->tcp_mode = state;
lookup->tcp_mode_set = ISC_TRUE;
}
break;
default:
invalid_option:
......@@ -1549,7 +1553,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
(*lookup)->ixfr_serial = serial;
(*lookup)->section_question = plusquest;
(*lookup)->comments = pluscomm;
(*lookup)->tcp_mode = ISC_TRUE;
if (!(*lookup)->tcp_mode_set)
(*lookup)->tcp_mode = ISC_TRUE;
} else {
(*lookup)->rdtype = rdtype;
(*lookup)->rdtypeset = ISC_TRUE;
......@@ -1815,7 +1820,8 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
lookup->section_question =
plusquest;
lookup->comments = pluscomm;
lookup->tcp_mode = ISC_TRUE;
if (!lookup->tcp_mode_set)
lookup->tcp_mode = ISC_TRUE;
} else {
lookup->rdtype = rdtype;
lookup->rdtypeset = ISC_TRUE;
......
......@@ -366,10 +366,11 @@
<term><option>+[no]tcp</option></term>
<listitem>
<para>
Use [do not use] TCP when querying name servers. The default
behavior is to use UDP unless an AXFR or IXFR query is
requested, in
which case a TCP connection is used.
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.
</para>
</listitem>
</varlistentry>
......
......@@ -796,6 +796,7 @@ make_empty_lookup(void) {
looknew->retries = tries;
looknew->nsfound = 0;
looknew->tcp_mode = ISC_FALSE;
looknew->tcp_mode_set = ISC_FALSE;
looknew->ip6_int = ISC_FALSE;
looknew->comments = ISC_TRUE;
looknew->stats = ISC_TRUE;
......@@ -886,6 +887,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->cdflag = lookold->cdflag;
looknew->ns_search_only = lookold->ns_search_only;
looknew->tcp_mode = lookold->tcp_mode;
looknew->tcp_mode_set = lookold->tcp_mode_set;
looknew->comments = lookold->comments;
looknew->stats = lookold->stats;
looknew->section_question = lookold->section_question;
......
......@@ -117,6 +117,7 @@ struct dig_lookup {
trace, /*% dig +trace */
trace_root, /*% initial query for either +trace or +nssearch */
tcp_mode,
tcp_mode_set,
ip6_int,
comments,
stats,
......
......@@ -21,5 +21,5 @@ rm -f ns1/named.conf ns1/myftp.db
rm -f ns3/*.jnl ns3/mytest.db ns3/subtest.db
rm -f ns4/*.jnl ns4/*.db
rm -f */named.memstats
rm -f dig.out
rm -f dig.out dig.out1 dig.out2 dig.out3
rm -f ns3/large.db
......@@ -249,5 +249,21 @@ test ${lines:-0} -eq 2 || { echo "I:failed"; status=1; }
messages=`sed -n 's/^;;.*messages \([0-9]*\),.*/\1/p' dig.out`
test ${messages:-0} -gt 1 || { echo "I:failed"; status=1; }
echo "I:test 'dig +notcp ixfr=<value>' vs 'dig ixfr=<value> +notcp' vs 'dig ixfr=<value>'"
ret=0
# Should be "switch to TCP" response
$DIG +notcp ixfr=1 test -p 5300 @10.53.0.4 > dig.out1 || ret=1
$DIG ixfr=1 +notcp test -p 5300 @10.53.0.4 > dig.out2 || ret=1
$PERL ../digcomp.pl dig.out1 dig.out2 || ret=1
awk '$4 == "SOA" { soacnt++} END {exit(soacnt == 1 ? 0 : 1);}' dig.out1 || ret=1
awk '$4 == "SOA" { exit($7 == 4 ? 0 : 1);}' dig.out1 || ret=1
# Should be incremental transfer.
$DIG ixfr=1 test -p 5300 @10.53.0.4 > dig.out3 || ret=1
awk '$4 == "SOA" { soacnt++} END {exit(soacnt == 6 ? 0 : 1);}' dig.out3 || ret=1
if [ ${ret} != 0 ]; then
echo "I:failed";
status=1;
fi
echo "I:exit status: $status"
exit $status
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