Fix fetchlimit test failure

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.
This commit is contained in:
Evan Hunt 2026-03-02 22:29:20 -08:00 committed by Colin Vidal
parent d1ea49cef9
commit cd4a7a2d72
2 changed files with 15 additions and 10 deletions

View 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))

View 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;
}
}
/*