mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-16 04:54:02 -04:00
Merge branch '3407-dighost-udp-fail-over-other-nameservers' into 'main'
Fix DiG query retry and fail-over issues Closes #3407 See merge request isc-projects/bind9!6462
This commit is contained in:
commit
25f8570709
9 changed files with 137 additions and 128 deletions
7
CHANGES
7
CHANGES
|
|
@ -1,3 +1,10 @@
|
|||
5930. [bug] Fix DiG query retry and fail-over bug in UDP mode.
|
||||
Also simplify the overall retry and fail-over logic to
|
||||
make it behave predictably, and always respect the
|
||||
documented +retry/+tries count set by a command-line
|
||||
option (or use the default values of 2 or 3
|
||||
respectively). [GL #3407]
|
||||
|
||||
5929. [func] The use of the "max-zone-ttl" option in "zone" and
|
||||
"options" blocks is now deprecated; this should
|
||||
now be configured as part of "dnssec-policy"
|
||||
|
|
|
|||
|
|
@ -809,7 +809,6 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
|
|||
looknew->done_as_is = lookold->done_as_is;
|
||||
looknew->dscp = lookold->dscp;
|
||||
looknew->rrcomments = lookold->rrcomments;
|
||||
looknew->eoferr = lookold->eoferr;
|
||||
|
||||
if (lookold->ecs_addr != NULL) {
|
||||
size_t len = sizeof(isc_sockaddr_t);
|
||||
|
|
@ -2695,7 +2694,6 @@ send_done(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
|||
return;
|
||||
} else if (eresult != ISC_R_SUCCESS) {
|
||||
debug("send failed: %s", isc_result_totext(eresult));
|
||||
cancel_lookup(l);
|
||||
query_detach(&query);
|
||||
lookup_detach(&l);
|
||||
UNLOCK_LOOKUP;
|
||||
|
|
@ -3103,6 +3101,9 @@ send_udp(dig_query_t *query) {
|
|||
static void
|
||||
udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
||||
dig_query_t *query = (dig_query_t *)arg;
|
||||
dig_query_t *next = NULL;
|
||||
char sockstr[ISC_SOCKADDR_FORMATSIZE];
|
||||
dig_lookup_t *l = NULL;
|
||||
dig_query_t *readquery = NULL;
|
||||
int local_timeout = timeout * 1000;
|
||||
|
||||
|
|
@ -3123,30 +3124,63 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
|||
debug("udp_ready(%p, %s, %p)", handle, isc_result_totext(eresult),
|
||||
query);
|
||||
|
||||
if (eresult == ISC_R_CANCELED || query->canceled) {
|
||||
dig_lookup_t *l = query->lookup;
|
||||
LOCK_LOOKUP;
|
||||
lookup_attach(query->lookup, &l);
|
||||
|
||||
if (eresult == ISC_R_CANCELED || query->canceled) {
|
||||
debug("in cancel handler");
|
||||
if (!query->canceled) {
|
||||
cancel_lookup(l);
|
||||
}
|
||||
query_detach(&query);
|
||||
lookup_detach(&l);
|
||||
clear_current_lookup();
|
||||
UNLOCK_LOOKUP;
|
||||
return;
|
||||
} else if (eresult != ISC_R_SUCCESS) {
|
||||
dig_lookup_t *l = query->lookup;
|
||||
|
||||
debug("udp setup failed: %s", isc_result_totext(eresult));
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr, sizeof(sockstr));
|
||||
dighost_warning("UDP setup with %s(%s) for %s failed: %s.",
|
||||
sockstr, query->servname, l->textname,
|
||||
isc_result_totext(eresult));
|
||||
|
||||
if (exitcode < 9) {
|
||||
exitcode = 9;
|
||||
}
|
||||
|
||||
if (l->retries > 1) {
|
||||
l->retries--;
|
||||
debug("making new UDP request, %d tries left",
|
||||
l->retries);
|
||||
requeue_lookup(l, true);
|
||||
next = NULL;
|
||||
} else if ((l->current_query != NULL) &&
|
||||
(ISC_LINK_LINKED(l->current_query, link)))
|
||||
{
|
||||
next = ISC_LIST_NEXT(l->current_query, link);
|
||||
} else {
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
query_detach(&query);
|
||||
cancel_lookup(l);
|
||||
if (next == NULL) {
|
||||
cancel_lookup(l);
|
||||
}
|
||||
lookup_detach(&l);
|
||||
|
||||
if (next != NULL) {
|
||||
start_udp(next);
|
||||
} else {
|
||||
clear_current_lookup();
|
||||
}
|
||||
|
||||
check_if_done();
|
||||
UNLOCK_LOOKUP;
|
||||
return;
|
||||
}
|
||||
|
||||
exitcode = 0;
|
||||
|
||||
query_attach(query, &readquery);
|
||||
|
||||
debug("recving with lookup=%p, query=%p, handle=%p", query->lookup,
|
||||
|
|
@ -3168,6 +3202,8 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
|||
send_udp(readquery);
|
||||
|
||||
query_detach(&query);
|
||||
lookup_detach(&l);
|
||||
UNLOCK_LOOKUP;
|
||||
}
|
||||
|
||||
/*%
|
||||
|
|
@ -3321,8 +3357,7 @@ force_next(dig_query_t *query) {
|
|||
dighost_error("no response from %s\n", buf);
|
||||
} else {
|
||||
printf("%s", l->cmdline);
|
||||
dighost_error("connection timed out; "
|
||||
"no servers could be reached\n");
|
||||
dighost_error("no servers could be reached\n");
|
||||
}
|
||||
|
||||
if (exitcode < 9) {
|
||||
|
|
@ -3336,28 +3371,6 @@ force_next(dig_query_t *query) {
|
|||
UNLOCK_LOOKUP;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Called when a peer closes a TCP socket prematurely.
|
||||
*/
|
||||
static void
|
||||
requeue_or_update_exitcode(dig_lookup_t *lookup) {
|
||||
if (lookup->eoferr == 0U && lookup->retries > 1) {
|
||||
--lookup->retries;
|
||||
/*
|
||||
* Peer closed the connection prematurely for the first time
|
||||
* for this lookup. Try again, keeping track of this failure.
|
||||
*/
|
||||
dig_lookup_t *requeued_lookup = requeue_lookup(lookup, true);
|
||||
requeued_lookup->eoferr++;
|
||||
} else {
|
||||
/*
|
||||
* Peer closed the connection prematurely and it happened
|
||||
* previously for this lookup. Indicate an error.
|
||||
*/
|
||||
exitcode = 9;
|
||||
}
|
||||
}
|
||||
|
||||
/*%
|
||||
* For transfers that involve multiple recvs (XFR's in particular),
|
||||
* launch the next recv.
|
||||
|
|
@ -3922,7 +3935,13 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
|||
}
|
||||
}
|
||||
|
||||
if (eresult == ISC_R_TIMEDOUT) {
|
||||
if (eresult != ISC_R_SUCCESS) {
|
||||
char sockstr[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr, sizeof(sockstr));
|
||||
dighost_warning("communications error to %s: %s", sockstr,
|
||||
isc_result_totext(eresult));
|
||||
|
||||
if (l->retries > 1 && !l->tcp_mode) {
|
||||
dig_query_t *newq = NULL;
|
||||
|
||||
|
|
@ -3993,8 +4012,8 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
|||
* and cancel the lookup.
|
||||
*/
|
||||
printf("%s", l->cmdline);
|
||||
dighost_error("connection timed out; "
|
||||
"no servers could be reached\n");
|
||||
dighost_error("no servers could be reached\n");
|
||||
|
||||
if (exitcode < 9) {
|
||||
exitcode = 9;
|
||||
}
|
||||
|
|
@ -4005,52 +4024,6 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
|||
|
||||
goto cancel_lookup;
|
||||
}
|
||||
} else if (eresult != ISC_R_SUCCESS) {
|
||||
dig_query_t *next = ISC_LIST_NEXT(query, link);
|
||||
char sockstr[ISC_SOCKADDR_FORMATSIZE];
|
||||
isc_sockaddr_format(&query->sockaddr, sockstr, sizeof(sockstr));
|
||||
|
||||
/*
|
||||
* There was a communication error with the current query,
|
||||
* go to the next query, if there is one.
|
||||
*/
|
||||
if (next != NULL) {
|
||||
if (l->current_query == query) {
|
||||
query_detach(&l->current_query);
|
||||
}
|
||||
if (l->current_query == NULL) {
|
||||
debug("starting next query %p", next);
|
||||
if (l->tcp_mode) {
|
||||
start_tcp(next);
|
||||
} else {
|
||||
start_udp(next);
|
||||
}
|
||||
}
|
||||
if (check_if_queries_done(l, query)) {
|
||||
goto cancel_lookup;
|
||||
}
|
||||
|
||||
goto detach_query;
|
||||
}
|
||||
|
||||
/*
|
||||
* Otherwise, print an error message and cancel the
|
||||
* lookup.
|
||||
*/
|
||||
dighost_error("communications error to %s: %s\n", sockstr,
|
||||
isc_result_totext(eresult));
|
||||
|
||||
if (keep != NULL) {
|
||||
isc_nmhandle_detach(&keep);
|
||||
}
|
||||
|
||||
if (eresult == ISC_R_EOF) {
|
||||
requeue_or_update_exitcode(l);
|
||||
} else if (exitcode < 9) {
|
||||
exitcode = 9;
|
||||
}
|
||||
|
||||
goto cancel_lookup;
|
||||
}
|
||||
|
||||
isc_buffer_init(&b, region->base, region->length);
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@ struct dig_lookup {
|
|||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
uint16_t qid;
|
||||
struct {
|
||||
bool http_plain;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,8 @@ grep "status: NOERROR" dig.out.3.${t} > /dev/null 2>&1 || ret=1
|
|||
$DIG -p ${PORT} soa example. \
|
||||
@10.53.0.2 -b 10.53.0.8 > dig.out.4.${t}
|
||||
grep "status: NOERROR" dig.out.4.${t} > /dev/null 2>&1 && ret=1
|
||||
grep "connection timed out" dig.out.4.${t} > /dev/null 2>&1 || ret=1
|
||||
grep "timed out" dig.out.4.${t} > /dev/null 2>&1 || ret=1
|
||||
grep ";; no servers could be reached" dig.out.4.${t} > /dev/null 2>&1 || ret=1
|
||||
[ $ret -eq 0 ] || echo_i "failed"
|
||||
status=`expr $status + $ret`
|
||||
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,7 @@ if [ -x "$DIG" ] ; then
|
|||
echo "unstable" | sendcmd 10.53.0.8
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 +nofail @10.53.0.8 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1015,7 +1015,25 @@ if [ -x "$DIG" ] ; then
|
|||
echo "unstable" | sendcmd 10.53.0.8
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 +nofail +tcp @10.53.0.8 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "check that dig tries the next server after a UDP socket network unreachable error ($n)"
|
||||
ret=0
|
||||
dig_with_opts @192.0.2.128 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
test $(grep -F -e "connection refused" -e "timed out" -e "network unreachable" dig.out.test$n | wc -l) -eq 3 || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "check that dig tries the next server after a TCP socket network unreachable error ($n)"
|
||||
ret=0
|
||||
dig_with_opts +tcp @192.0.2.128 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
test $(grep -F -e "connection refused" -e "timed out" -e "network unreachable" dig.out.test$n | wc -l) -eq 3 || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1023,7 +1041,7 @@ if [ -x "$DIG" ] ; then
|
|||
echo_i "check that dig tries the next server after a UDP socket read error ($n)"
|
||||
ret=0
|
||||
dig_with_opts @10.53.0.99 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1033,7 +1051,7 @@ if [ -x "$DIG" ] ; then
|
|||
echo "close" | sendcmd 10.53.0.8
|
||||
ret=0
|
||||
dig_with_opts +tcp @10.53.0.8 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1048,7 +1066,7 @@ if [ -x "$DIG" ] ; then
|
|||
ret=0
|
||||
dig_with_opts +tcp @10.53.0.99 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
test $(grep -F -e "connection refused" -e "timed out" -e "network unreachable" dig.out.test$n | wc -l) -eq 3 || ret=1
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1058,7 +1076,7 @@ if [ -x "$DIG" ] ; then
|
|||
echo "silent" | sendcmd 10.53.0.8
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 @10.53.0.8 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1068,7 +1086,7 @@ if [ -x "$DIG" ] ; then
|
|||
echo "silent" | sendcmd 10.53.0.8
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 +tcp @10.53.0.8 @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ n=`expr $n + 1`
|
|||
echo_i "checking drop edns server setup ($n)"
|
||||
ret=0
|
||||
$DIG $DIGOPTS +edns @10.53.0.2 dropedns soa > dig.out.1.test$n && ret=1
|
||||
grep "connection timed out; no servers could be reached" dig.out.1.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.1.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.1.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +noedns @10.53.0.2 dropedns soa > dig.out.2.test$n || ret=1
|
||||
grep "status: NOERROR" dig.out.2.test$n > /dev/null || ret=1
|
||||
grep "EDNS: version:" dig.out.2.test$n > /dev/null && ret=1
|
||||
|
|
@ -114,7 +115,8 @@ $DIG $DIGOPTS +noedns +tcp @10.53.0.2 dropedns soa > dig.out.3.test$n || ret=1
|
|||
grep "status: NOERROR" dig.out.3.test$n > /dev/null || ret=1
|
||||
grep "EDNS: version:" dig.out.3.test$n > /dev/null && ret=1
|
||||
$DIG $DIGOPTS +edns +tcp @10.53.0.2 dropedns soa > dig.out.4.test$n && ret=1
|
||||
grep "connection timed out; no servers could be reached" dig.out.4.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.4.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.4.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
|
|
@ -129,7 +131,8 @@ n=`expr $n + 1`
|
|||
echo_i "checking drop edns + no tcp server setup ($n)"
|
||||
ret=0
|
||||
$DIG $DIGOPTS +edns @10.53.0.3 dropedns-notcp soa > dig.out.1.test$n && ret=1
|
||||
grep "connection timed out; no servers could be reached" dig.out.1.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.1.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.1.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +noedns +tcp @10.53.0.3 dropedns-notcp soa > dig.out.2.test$n && ret=1
|
||||
grep "connection refused" dig.out.2.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +noedns @10.53.0.3 dropedns-notcp soa > dig.out.3.test$n || ret=1
|
||||
|
|
@ -192,7 +195,8 @@ $DIG $DIGOPTS +edns +tcp @10.53.0.6 edns512 txt > dig.out.2.test$n || ret=1
|
|||
grep "status: NOERROR" dig.out.2.test$n > /dev/null || ret=1
|
||||
grep "EDNS: version:" dig.out.2.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +edns +dnssec @10.53.0.6 edns512 txt > dig.out.3.test$n && ret=1
|
||||
grep "connection timed out; no servers could be reached" dig.out.3.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.3.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.3.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +edns +dnssec +bufsize=512 +ignore @10.53.0.6 edns512 soa > dig.out.4.test$n || ret=1
|
||||
grep "status: NOERROR" dig.out.4.test$n > /dev/null || ret=1
|
||||
grep "EDNS: version:" dig.out.4.test$n > /dev/null || ret=1
|
||||
|
|
@ -216,7 +220,8 @@ grep "EDNS: version:" dig.out.1.test$n > /dev/null || ret=1
|
|||
$DIG $DIGOPTS +edns +tcp @10.53.0.7 edns512-notcp soa > dig.out.2.test$n && ret=1
|
||||
grep "connection refused" dig.out.2.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +edns +dnssec @10.53.0.7 edns512-notcp soa > dig.out.3.test$n && ret=1
|
||||
grep "connection timed out; no servers could be reached" dig.out.3.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.3.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.3.test$n > /dev/null || ret=1
|
||||
$DIG $DIGOPTS +edns +dnssec +bufsize=512 +ignore @10.53.0.7 edns512-notcp soa > dig.out.4.test$n || ret=1
|
||||
grep "status: NOERROR" dig.out.4.test$n > /dev/null || ret=1
|
||||
grep "EDNS: version:" dig.out.4.test$n > /dev/null || ret=1
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ here () {
|
|||
}
|
||||
|
||||
# check dropped response
|
||||
DROPPED='^;; connection timed out; no servers could be reached'
|
||||
DROPPED='^;; no servers could be reached'
|
||||
drop () {
|
||||
make_dignm
|
||||
digcmd $* >$DIGNM
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@
|
|||
. ../conf.sh
|
||||
|
||||
DIGOPTS="+nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short +nocookie"
|
||||
DIGCMD="$DIG $DIGOPTS -p ${PORT}"
|
||||
|
||||
dig_cmd() {
|
||||
# shellcheck disable=SC2086
|
||||
"$DIG" $DIGOPTS -p "${PORT}" "$@" | grep -v '^;'
|
||||
}
|
||||
|
||||
status=0
|
||||
|
||||
|
|
@ -36,7 +40,7 @@ if $test_fixed; then
|
|||
ret=0
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||
do
|
||||
$DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1
|
||||
dig_cmd @10.53.0.1 fixed.example > dig.out.fixed || ret=1
|
||||
diff dig.out.fixed dig.out.fixed.good >/dev/null || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -48,7 +52,7 @@ else
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.1 fixed.example > dig.out.fixed || ret=1
|
||||
dig_cmd @10.53.0.1 fixed.example > dig.out.fixed || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.fixed dig.out.$j
|
||||
else
|
||||
|
|
@ -75,7 +79,7 @@ matches=0
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
|
||||
dig_cmd @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic dig.out.$j
|
||||
else
|
||||
|
|
@ -101,7 +105,7 @@ matches=0
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
dig_cmd @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic2 dig.out.$j
|
||||
else
|
||||
|
|
@ -125,7 +129,7 @@ do
|
|||
done
|
||||
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
|
||||
do
|
||||
$DIGCMD @10.53.0.1 random.example > dig.out.random || ret=1
|
||||
dig_cmd @10.53.0.1 random.example > dig.out.random || ret=1
|
||||
match=0
|
||||
for j in $GOOD_RANDOM
|
||||
do
|
||||
|
|
@ -147,13 +151,13 @@ status=$((status + ret))
|
|||
echo_i "Checking order none (primary)"
|
||||
ret=0
|
||||
# Fetch the "reference" response and ensure it contains the expected records.
|
||||
$DIGCMD @10.53.0.1 none.example > dig.out.none || ret=1
|
||||
dig_cmd @10.53.0.1 none.example > dig.out.none || ret=1
|
||||
for i in 1 2 3 4; do
|
||||
grep -F -q 1.2.3.$i dig.out.none || ret=1
|
||||
done
|
||||
# Ensure 20 further queries result in the same response as the "reference" one.
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||
$DIGCMD @10.53.0.1 none.example > dig.out.test$i || ret=1
|
||||
dig_cmd @10.53.0.1 none.example > dig.out.test$i || ret=1
|
||||
diff dig.out.none dig.out.test$i >/dev/null || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -167,7 +171,7 @@ if $test_fixed; then
|
|||
ret=0
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||
do
|
||||
$DIGCMD @10.53.0.2 fixed.example > dig.out.fixed || ret=1
|
||||
dig_cmd @10.53.0.2 fixed.example > dig.out.fixed || ret=1
|
||||
diff dig.out.fixed dig.out.fixed.good || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -183,7 +187,7 @@ matches=0
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
|
||||
dig_cmd @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic dig.out.$j
|
||||
else
|
||||
|
|
@ -209,7 +213,7 @@ matches=0
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
dig_cmd @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic2 dig.out.$j
|
||||
else
|
||||
|
|
@ -234,7 +238,7 @@ do
|
|||
done
|
||||
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
|
||||
do
|
||||
$DIGCMD @10.53.0.2 random.example > dig.out.random || ret=1
|
||||
dig_cmd @10.53.0.2 random.example > dig.out.random || ret=1
|
||||
match=0
|
||||
for j in $GOOD_RANDOM
|
||||
do
|
||||
|
|
@ -256,13 +260,13 @@ status=$((status + ret))
|
|||
echo_i "Checking order none (secondary)"
|
||||
ret=0
|
||||
# Fetch the "reference" response and ensure it contains the expected records.
|
||||
$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
|
||||
dig_cmd @10.53.0.2 none.example > dig.out.none || ret=1
|
||||
for i in 1 2 3 4; do
|
||||
grep -F -q 1.2.3.$i dig.out.none || ret=1
|
||||
done
|
||||
# Ensure 20 further queries result in the same response as the "reference" one.
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||
$DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
|
||||
dig_cmd @10.53.0.2 none.example > dig.out.test$i || ret=1
|
||||
diff dig.out.none dig.out.test$i >/dev/null || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -292,7 +296,7 @@ if $test_fixed; then
|
|||
ret=0
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||
do
|
||||
$DIGCMD @10.53.0.2 fixed.example > dig.out.fixed || ret=1
|
||||
dig_cmd @10.53.0.2 fixed.example > dig.out.fixed || ret=1
|
||||
diff dig.out.fixed dig.out.fixed.good || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -308,7 +312,7 @@ matches=0
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
|
||||
dig_cmd @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic dig.out.$j
|
||||
else
|
||||
|
|
@ -334,7 +338,7 @@ matches=0
|
|||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
dig_cmd @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic2 dig.out.$j
|
||||
else
|
||||
|
|
@ -359,7 +363,7 @@ do
|
|||
done
|
||||
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
|
||||
do
|
||||
$DIGCMD @10.53.0.2 random.example > dig.out.random || ret=1
|
||||
dig_cmd @10.53.0.2 random.example > dig.out.random || ret=1
|
||||
match=0
|
||||
for j in $GOOD_RANDOM
|
||||
do
|
||||
|
|
@ -381,13 +385,13 @@ status=$((status + ret))
|
|||
echo_i "Checking order none (secondary loaded from disk)"
|
||||
ret=0
|
||||
# Fetch the "reference" response and ensure it contains the expected records.
|
||||
$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
|
||||
dig_cmd @10.53.0.2 none.example > dig.out.none || ret=1
|
||||
for i in 1 2 3 4; do
|
||||
grep -F -q 1.2.3.$i dig.out.none || ret=1
|
||||
done
|
||||
# Ensure 20 further queries result in the same response as the "reference" one.
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||
$DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
|
||||
dig_cmd @10.53.0.2 none.example > dig.out.test$i || ret=1
|
||||
diff dig.out.none dig.out.test$i >/dev/null || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -401,7 +405,7 @@ if $test_fixed; then
|
|||
ret=0
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||
do
|
||||
$DIGCMD @10.53.0.3 fixed.example > dig.out.fixed || ret=1
|
||||
dig_cmd @10.53.0.3 fixed.example > dig.out.fixed || ret=1
|
||||
diff dig.out.fixed dig.out.fixed.good || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -414,12 +418,12 @@ fi
|
|||
echo_i "Checking order cyclic (cache + additional)"
|
||||
ret=0
|
||||
# prime acache
|
||||
$DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
|
||||
dig_cmd @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
|
||||
matches=0
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
|
||||
dig_cmd @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic dig.out.$j
|
||||
else
|
||||
|
|
@ -442,12 +446,12 @@ status=$((status + ret))
|
|||
echo_i "Checking order cyclic (cache)"
|
||||
ret=0
|
||||
# prime acache
|
||||
$DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
dig_cmd @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
matches=0
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
j=$((i % 4))
|
||||
$DIGCMD @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
dig_cmd @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
|
||||
if [ $i -le 4 ]; then
|
||||
cp dig.out.cyclic2 dig.out.$j
|
||||
else
|
||||
|
|
@ -472,7 +476,7 @@ do
|
|||
done
|
||||
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
|
||||
do
|
||||
$DIGCMD @10.53.0.3 random.example > dig.out.random || ret=1
|
||||
dig_cmd @10.53.0.3 random.example > dig.out.random || ret=1
|
||||
match=0
|
||||
for j in $GOOD_RANDOM
|
||||
do
|
||||
|
|
@ -494,13 +498,13 @@ status=$((status + ret))
|
|||
echo_i "Checking order none (cache)"
|
||||
ret=0
|
||||
# Fetch the "reference" response and ensure it contains the expected records.
|
||||
$DIGCMD @10.53.0.3 none.example > dig.out.none || ret=1
|
||||
dig_cmd @10.53.0.3 none.example > dig.out.none || ret=1
|
||||
for i in 1 2 3 4; do
|
||||
grep -F -q 1.2.3.$i dig.out.none || ret=1
|
||||
done
|
||||
# Ensure 20 further queries result in the same response as the "reference" one.
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||
$DIGCMD @10.53.0.3 none.example > dig.out.test$i || ret=1
|
||||
dig_cmd @10.53.0.3 none.example > dig.out.test$i || ret=1
|
||||
diff dig.out.none dig.out.test$i >/dev/null || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
@ -514,7 +518,7 @@ do
|
|||
done
|
||||
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
|
||||
do
|
||||
$DIGCMD @10.53.0.5 random.example > dig.out.random || ret=1
|
||||
dig_cmd @10.53.0.5 random.example > dig.out.random || ret=1
|
||||
match=0
|
||||
for j in $GOOD_RANDOM
|
||||
do
|
||||
|
|
@ -536,13 +540,13 @@ status=$((status + ret))
|
|||
echo_i "Checking default order no match in rrset-order (cache)"
|
||||
ret=0
|
||||
# Fetch the "reference" response and ensure it contains the expected records.
|
||||
$DIGCMD @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1
|
||||
dig_cmd @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1
|
||||
for i in 1 2 3 4; do
|
||||
grep -F -q 1.2.3.$i dig.out.nomatch || ret=1
|
||||
done
|
||||
# Ensure 20 further queries result in the same response as the "reference" one.
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||
$DIGCMD @10.53.0.4 nomatch.example > dig.out.test$i || ret=1
|
||||
dig_cmd @10.53.0.4 nomatch.example > dig.out.test$i || ret=1
|
||||
diff dig.out.nomatch dig.out.test$i >/dev/null || ret=1
|
||||
done
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
|
|
|||
|
|
@ -1135,7 +1135,8 @@ n=$((n+1))
|
|||
echo_i "check notincache.example times out (max-stale-ttl default) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} +tries=1 +timeout=3 @10.53.0.3 notfound.example TXT > dig.out.test$n 2>&1
|
||||
grep "connection timed out" dig.out.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
@ -1764,7 +1765,8 @@ n=$((n+1))
|
|||
echo_i "check not in cache longttl.example times out (stale-answer-client-timeout 1.8) ($n)"
|
||||
ret=0
|
||||
wait_for_log 4 "longttl.example client timeout, stale answer unavailable" ns3/named.run || ret=1
|
||||
grep "connection timed out" dig.out.test$n > /dev/null || ret=1
|
||||
grep "timed out" dig.out.test$n > /dev/null || ret=1
|
||||
grep ";; no servers could be reached" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue