]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Added tests for tries=1 and retry=0 on TCP EOF
authorDiego Fronza <diego@isc.org>
Tue, 16 Feb 2021 16:13:07 +0000 (13:13 -0300)
committerDiego Fronza <diego@isc.org>
Thu, 25 Mar 2021 17:08:40 +0000 (14:08 -0300)
Added tests to ensure that dig won't retry sending a query over tcp
(+tcp) when a TCP connection is closed prematurely (EOF is read) if
either +tries=1 or retry=0 is specified on the command line.

bin/tests/system/digdelv/tests.sh

index f0f1f4fa2e31bc89f01f1d53ff25811fe9b4f808..a30577139a8bd89717506abc25ba1531a5d351ce 100644 (file)
@@ -857,6 +857,25 @@ if [ -x "$DIG" ] ; then
   if [ $ret -ne 0 ]; then echo_i "failed"; fi
   status=$((status+ret))
 
+  n=$((n+1))
+  echo_i "checking +tries=1 won't retry twice upon TCP EOF ($n)"
+  ret=0
+  echo "no_response no_response" | sendcmd 10.53.0.5
+  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1
+  # Sanity check: ensure ans5 behaves as expected.
+  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status+ret))
+
+  n=$((n+1))
+  echo_i "checking +retry=0 won't retry twice upon TCP EOF ($n)"
+  ret=0
+  dig_with_opts @10.53.0.5 example AXFR +retry=0 > dig.out.test$n 2>&1 && ret=1
+  # Sanity check: ensure ans5 behaves as expected.
+  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status+ret))
+
   n=$((n+1))
   echo_i "check that dig +expandaaaa works ($n)"
   ret=0