# versions just get it completely wrong.
if ($qname eq "truncated.no-questions") {
- # QR, AA, TC
+ # QR, AA, TC: forces TCP retry
return (pack("nnnnnn", $id, 0x8600, 0, 0, 0, 0));
+ } elsif ($qname eq "tcpalso.no-questions") {
+ # QR, REFUSED: forces TCP retry
+ return (pack("nnnnnn", $id, 0x8205, 0, 0, 0, 0));
}
# QR, AA
return (pack("nnnnnn", $id, 0x8400, 0, 0, 0, 0));
$response->header->qr(1);
$response->header->aa(1);
$response->header->id($id);
-
$response->push("answer", new Net::DNS::RR("$qname 300 A 1.2.3.4"));
- push(@results, $response->data);
+
+ if ($qname eq "tcpalso.no-questions") {
+ # for this qname we also return a bad reply over TCP
+ # QR, REFUSED, no question section
+ push (@results, pack("nnnnnn", $id, 0x8005, 0, 0, 0, 0));
+ } else {
+ push(@results, $response->data);
+ }
return \@results;
}
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+n=`expr $n + 1`
+echo_i "check that SERVFAIL is returned for an empty question section via TCP ($n)"
+ret=0
+nextpart ns5/named.run > /dev/null
+# bind to local address so that addresses in log messages are consistent
+# between platforms; use tcp to get SERVFAIL rather than timeout on slow
+# machines
+$DIG $DIGOPTS @10.53.0.5 -b 10.53.0.5 +tcp tcpalso.no-questions. a +tries=3 +time=4 > dig.ns5.out.${n} || ret=1
+grep "status: SERVFAIL" dig.ns5.out.${n} > /dev/null || ret=1
+check_namedrun() {
+nextpartpeek ns5/named.run > nextpart.out.${n}
+grep 'resolving tcpalso.no-questions/A for [^:]*: empty question section, accepting it anyway as TC=1' nextpart.out.${n} > /dev/null || return 1
+grep '(tcpalso.no-questions/A): connecting via TCP' nextpart.out.${n} > /dev/null || return 1
+grep 'resolving tcpalso.no-questions/A for [^:]*: empty question section$' nextpart.out.${n} > /dev/null || return 1
+grep '(tcpalso.no-questions/A): nextitem' nextpart.out.${n} > /dev/null || return 1
+return 0
+}
+retry_quiet 12 check_namedrun || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
n=`expr $n + 1`
echo_i "checking SERVFAIL is returned when all authoritative servers return FORMERR ($n)"
ret=0