Fix forward ns4 when statistics-channels is disabled

With statistics-channels disabled, ns4 fails to start with:

    option 'statistics-channels' was not enabled at compile time
This commit is contained in:
Michal Nowak 2025-10-08 20:13:58 +02:00
parent 876060f3ef
commit 2a4355331a
2 changed files with 12 additions and 6 deletions

View file

@ -33,7 +33,9 @@ options {
};
{% if FEATURE_JSON_C == "1" %}
statistics-channels { inet 10.53.0.4 port @EXTRAPORT1@ allow { localhost; }; };
{% endif %}
zone "." {
type hint;

View file

@ -170,12 +170,16 @@ status=$((status + ret))
# GL#1793
n=$((n + 1))
echo_i "checking that the correct counter is increased because of the SERVFAIL in the previous check ($n)"
ret=0
"${CURL}" "http://10.53.0.4:${EXTRAPORT1}/json/v1" 2>/dev/null >statschannel.out.$n
grep -F '"ServerQuota"' statschannel.out.$n >/dev/null && ret=1
grep -F '"ForwardOnlyFail":1' statschannel.out.$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
if $FEATURETEST --have-json-c && [ -x ${CURL} ]; then
ret=0
"${CURL}" "http://10.53.0.4:${EXTRAPORT1}/json/v1" 2>/dev/null >statschannel.out.$n
grep -F '"ServerQuota"' statschannel.out.$n >/dev/null && ret=1
grep -F '"ForwardOnlyFail":1' statschannel.out.$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
else
echo_i "skipping test as libjson-c and/or curl was not found"
fi
n=$((n + 1))
echo_i "checking for negative caching of forwarder response ($n)"