Test shorter resolver-query-timeout configuration
Add two new checks which test the shorter than usual resolver-query-timeout configuration.
This commit is contained in:
committed by
Arаm Sаrgsyаn
parent
5f47c2b567
commit
d6a79cce53
@@ -74,6 +74,10 @@ sub handleQuery {
|
||||
$packet->push("answer", new Net::DNS::RR($qname . " 300 A 10.53.0.3"));
|
||||
} elsif ($qname eq "nodata.example.net") {
|
||||
# Do not add a SOA RRset.
|
||||
} elsif ($qname eq "noresponse.example.net") {
|
||||
# Do not response.
|
||||
print "RESPONSE:\n";
|
||||
return "";
|
||||
} elsif ($qname eq "nxdomain.example.net") {
|
||||
# Do not add a SOA RRset.
|
||||
$packet->header->rcode(NXDOMAIN);
|
||||
@@ -217,8 +221,12 @@ for (;;) {
|
||||
print "TCP request\n";
|
||||
my $result = handleQuery($buf);
|
||||
$len = length($result);
|
||||
$conn->syswrite(pack("n", $len), 2);
|
||||
$n = $conn->syswrite($result, $len);
|
||||
if ($len != 0) {
|
||||
$conn->syswrite(pack("n", $len), 2);
|
||||
$n = $conn->syswrite($result, $len);
|
||||
} else {
|
||||
$n = 0;
|
||||
}
|
||||
print " Sent: $n chars via TCP\n";
|
||||
}
|
||||
$conn->close;
|
||||
|
||||
@@ -28,6 +28,7 @@ options {
|
||||
"gooddname.example.net"; };
|
||||
allow-query {!10.53.0.8; any; };
|
||||
max-zone-ttl unlimited;
|
||||
resolver-query-timeout 5000; # 5 seconds
|
||||
attach-cache "globalcache";
|
||||
};
|
||||
|
||||
|
||||
@@ -43,6 +43,28 @@ grep "status: NOERROR" dig.out.ns1.test${n} >/dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
||||
# 'resolver-query-timeout' is set to 5 seconds in ns1, so dig with a lower
|
||||
# timeout value should give up earlier than that.
|
||||
n=$((n + 1))
|
||||
echo_i "checking no response handling with a shorter than resolver-query-timeout timeout ($n)"
|
||||
ret=0
|
||||
dig_with_opts +tcp +tries=1 +timeout=3 noresponse.example.net @10.53.0.1 a >dig.out.ns1.test${n} && ret=1
|
||||
grep -F "no servers could be reached" dig.out.ns1.test${n} >/dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
||||
# 'resolver-query-timeout' is set to 5 seconds in ns1, which is lower than the
|
||||
# current single query timeout value MAX_SINGLE_QUERY_TIMEOUT of 9 seconds, so
|
||||
# the "hung fetch" timer should kick in, interrupt the non-responsive query and
|
||||
# send a SERVFAIL answer.
|
||||
n=$((n + 1))
|
||||
echo_i "checking no response handling with a longer than resolver-query-timeout timeout ($n)"
|
||||
ret=0
|
||||
dig_with_opts +tcp +tries=1 +timeout=7 noresponse.example.net @10.53.0.1 a >dig.out.ns1.test${n} || ret=1
|
||||
grep -F "status: SERVFAIL" dig.out.ns1.test${n} >/dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
||||
n=$((n + 1))
|
||||
echo_i "checking handling of bogus referrals ($n)"
|
||||
# If the server has the "INSIST(!external)" bug, this query will kill it.
|
||||
|
||||
Reference in New Issue
Block a user