return 0
}
+# Succeed once the lame domain reaches the fetches-per-zone limit (40),
+# checking both recursive clients (stat) and active fetches (rndc fetchlimit
+# field 3). Used with retry_quiet to wait out transient low readings.
+perdomain_at_limit() {
+ stat 10.53.0.3 40 40 || return 1
+ active=$(rndccmd 10.53.0.3 fetchlimit | awk '/lamesub/ { print $3 }')
+ [ "${active:-0}" -eq 40 ]
+}
+
_wait_for_message() (
nextpartpeek "$1" >wait_for_message.$n
grep -F "$2" wait_for_message.$n >/dev/null
ret=0
fail=0
success=0
+reached=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
&& 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 ] || {
- echo_i "allowed ${allowed}/40"
+ # The active count (field 3) is capped at 40 but can dip lower between
+ # bursts, so retry the sample, flag only a count above 40, and require the
+ # limit to be reached at least once. (Field 6 is the cumulative "allowed"
+ # counter, which grows past 40 as refilled slots are counted.)
+ retry_quiet 5 perdomain_at_limit && reached=1
+ if [ "${active:-0}" -gt 40 ]; then
+ echo_i "active ${active}/40"
ret=1
- }
- [ $ret -eq 1 ] && break
+ break
+ fi
sleep 1
done
+[ "$reached" -eq 1 ] || {
+ echo_i "per-domain limit (40) not reached"
+ ret=1
+}
echo_i "$success successful valid queries, $fail SERVFAIL"
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))