]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix fetchlimit test failure
authorEvan Hunt <each@isc.org>
Tue, 3 Mar 2026 06:29:20 +0000 (22:29 -0800)
committerColin Vidal <colin@isc.org>
Mon, 30 Mar 2026 18:41:13 +0000 (20:41 +0200)
When a referral lookup is triggered by a QMIN query, it should be
exempt from the fetches-per-zone limit just as the QMIN query itself
is.

Also restart the test server between the fetches-per-server and
fetches-per-zone tests so that leftover statistics from the former
do not pollute the latter.

Another fix is because zone spills and general query drops are no longer
in a strict >= relation (on a parent-centric resolver), so check that
both counters are non-zero instead.

bin/tests/system/fetchlimit/tests.sh
lib/dns/resolver.c

index c0910f32b1b12eafd3ce520c1551c13827057e9c..3d8a77397abb93b79d2cf263eeac8b8ac1b44c95 100644 (file)
@@ -167,7 +167,8 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
 cp ns3/named2.conf ns3/named.conf
-rndc_reconfig ns3 10.53.0.3
+stop_server --use-rndc --port ${CONTROLPORT} ns3
+start_server --noclean --restart --port ${PORT} ns3
 
 n=$((n + 1))
 echo_i "checking lame server clients are dropped at the per-domain limit ($n)"
@@ -177,14 +178,17 @@ success=0
 sendcmd 10.53.0.4 send-responses "disable"
 for try in 1 2 3 4 5; do
   burst 10.53.0.3 d $try 300
-  $DIGCMD a ${try}.example >dig.out.ns3.$n.$try
+  $DIGCMD a ${try}.example >dig.out.ns3.$n.$try || true
   grep "status: NOERROR" dig.out.ns3.$n.$try >/dev/null 2>&1 \
     && success=$((success + 1))
   grep "status: SERVFAIL" dig.out.ns3.$n.$try >/dev/null 2>&1 \
     && fail=$(($fail + 1))
   stat 10.53.0.3 40 40 || ret=1
   allowed=$(rndccmd 10.53.0.3 fetchlimit | awk '/lamesub/ { print $6 }')
-  [ "${allowed:-0}" -eq 40 ] || ret=1
+  [ "${allowed:-0}" -eq 40 ] || {
+    echo_i "allowed ${allowed}/40"
+    ret=1
+  }
   [ $ret -eq 1 ] && break
   sleep 1
 done
@@ -202,10 +206,9 @@ for try in 1 2 3 4 5; do
   sleep 1
 done
 zspill=$(grep 'spilled due to zone' ns3/named.stats | sed 's/\([0-9][0-9]*\) spilled.*/\1/')
-[ -z "$zspill" ] && zspill=0
+[ "${zspill:-0}" -ne 0 ] || ret=1
 drops=$(grep 'queries dropped' ns3/named.stats | sed 's/\([0-9][0-9]*\) queries.*/\1/')
-[ -z "$drops" ] && drops=0
-[ "$drops" -ge "$zspill" ] || ret=1
+[ "${drops:-0}" -ne 0 ] || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
index c9e38fc678cafe9fa299264e19efab35f1a934dc..ab4344d74aaae3819dfa0b67749f7f642bb3becd 100644 (file)
@@ -9256,10 +9256,12 @@ rctx_referral(respctx_t *rctx) {
                fctx_minimize_qname(fctx);
        }
 
-       result = fcount_incr(fctx, false);
-       if (result != ISC_R_SUCCESS) {
-               rctx->result = result;
-               return ISC_R_COMPLETE;
+       if ((fctx->options & DNS_FETCHOPT_QMINFETCH) == 0) {
+               result = fcount_incr(fctx, false);
+               if (result != ISC_R_SUCCESS) {
+                       rctx->result = result;
+                       return ISC_R_COMPLETE;
+               }
        }
 
        /*