Commit df814c400c for bind
commit df814c400c80575733cc970436457307d7587c82
Author: Petr Špaček <pspacek@isc.org>
Date: Thu Oct 8 11:43:16 2026 +0000
Fix dead max-query-restarts check in chain test
It was broken since commit 104f3b82fb7c7cd03edc36507b167cfc6e11d17c.
Botched rebase of !9281 re-introduced stale assumptions in test code and
at the same time removed return code evaluation, causing the test to
silently do nothing.
On top of that, it could not have worked anyway: the authoritative
server cuts the loop at its own limit and the resolver never reaches
max-query-restarts.
Spread a new loop across two servers so authoritative server
does not follow it and only the resolver's limit cuts the chain.
Related: #4449
Assisted-by: Claude:claude-opus-5-5
diff --git a/bin/tests/system/chain/ns2/example.db b/bin/tests/system/chain/ns2/example.db
index d4c0fea611..88c8487ef4 100644
--- a/bin/tests/system/chain/ns2/example.db
+++ b/bin/tests/system/chain/ns2/example.db
@@ -59,3 +59,16 @@ hank CNAME bank
bank CNAME wank
wank CNAME woop
woop CNAME loop
+
+; long CNAME loop alternating between example (ns2) and sub5.example (ns5),
+; so that neither authoritative server follows it and only the resolver's
+; max-query-restarts limit cuts it
+xloop0 CNAME xloop1.sub5.example.
+xloop2 CNAME xloop3.sub5.example.
+xloop4 CNAME xloop5.sub5.example.
+xloop6 CNAME xloop7.sub5.example.
+xloop8 CNAME xloop9.sub5.example.
+xloop10 CNAME xloop11.sub5.example.
+xloop12 CNAME xloop13.sub5.example.
+xloop14 CNAME xloop15.sub5.example.
+xloop16 CNAME xloop17.sub5.example.
diff --git a/bin/tests/system/chain/ns5/sub.db b/bin/tests/system/chain/ns5/sub.db
index cc37e4b657..7544d4c5bd 100644
--- a/bin/tests/system/chain/ns5/sub.db
+++ b/bin/tests/system/chain/ns5/sub.db
@@ -13,3 +13,14 @@ a A 10.0.0.1
b A 10.0.0.2
c A 10.0.0.3
d A 10.0.0.4
+
+; see the xloop comment in ns2/example.db
+xloop1 CNAME xloop2.example.
+xloop3 CNAME xloop4.example.
+xloop5 CNAME xloop6.example.
+xloop7 CNAME xloop8.example.
+xloop9 CNAME xloop10.example.
+xloop11 CNAME xloop12.example.
+xloop13 CNAME xloop14.example.
+xloop15 CNAME xloop16.example.
+xloop17 CNAME xloop0.example.
diff --git a/bin/tests/system/chain/tests.sh b/bin/tests/system/chain/tests.sh
index 71cd600587..1c5b5a6967 100644
--- a/bin/tests/system/chain/tests.sh
+++ b/bin/tests/system/chain/tests.sh
@@ -442,16 +442,20 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
-echo_i "checking CNAME loops are detected (resolver) ($n)"
+echo_i "checking max-query-restarts cuts long CNAME chain (resolver) ($n)"
ret=0
$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i
-$DIG $DIGOPTS @10.53.0.7 loop.example >dig.out.1.test$n
-grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.7 xloop0.example >dig.out.1.test$n
+grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1
+grep "max. restarts reached" dig.out.1.test$n >/dev/null || ret=1
grep "ANSWER: 12" dig.out.1.test$n >/dev/null || ret=1
# also check with max-query-restarts 16:
-$DIG $DIGOPTS @10.53.0.7 -y "${DEFAULT_HMAC}:restart16:1234abcd8765" loop.example >dig.out.2.test$n
-grep "status: NOERROR" dig.out.2.test$n >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.7 -y "${DEFAULT_HMAC}:restart16:1234abcd8765" xloop0.example >dig.out.2.test$n
+grep "status: SERVFAIL" dig.out.2.test$n >/dev/null || ret=1
+grep "max. restarts reached" dig.out.2.test$n >/dev/null || ret=1
grep "ANSWER: 17" dig.out.2.test$n >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
n=$((n + 1))
echo_i "checking CNAME loops are detected (auth) ($n)"