Commit 789e5f4a authored by Mark Andrews's avatar Mark Andrews
Browse files

Merge branch 'u/fanf2/dnstap-roll' into 'main'

Fix `rndc dnstap -roll N`

See merge request !3728
parents e8fa9986 81d15bc9
Pipeline #45023 passed with stages
in 2 minutes and 19 seconds
5444. [bug] 'rndc dnstap -roll <value>' was not limiting the
number of saved files to <value>. [GL !3728]
5443. [bug] The "primary" and "secondary" keywords, when used
as parameters for "check-names", were not
processed correctly and were being ignored. [GL #1949]
......
......@@ -547,6 +547,22 @@ retry_quiet() {
_retry "$@"
}
# _repeat: keep running command up to $1 times, unless it fails
_repeat() (
__retries="${1}"
shift
while :; do
if ! "$@"; then
return 1
fi
__retries=$((__retries-1))
if [ "${__retries}" -le 0 ]; then
break
fi
done
return 0
)
rndc_reload() {
echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'$1' /'`"
# reloading single zone is synchronous, if we're reloading whole server
......
......@@ -21,7 +21,9 @@ rm -f fstrm_capture.out
rm -f ns*/dnstap.out
rm -f ns*/dnstap.out.save
rm -f ns*/dnstap.out.save.?
rm -f ns*/named.lock
rm -f ydump.out
rm -f ns*/managed-keys.bind*
rm -f ns*/named.lock
rm -f ns2/dnstap.out.*
rm -f ns2/example.db ns2/example.db.jnl
rm -f ns3/dnstap.out.*
rm -f ydump.out
......@@ -758,5 +758,28 @@ lines=`$DNSTAPREAD -y large-answer.fstrm | grep -c "opcode: QUERY"`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
test_dnstap_roll() (
ip="$1"
ns="$2"
n="$3"
$RNDCCMD -s "${ip}" dnstap -roll "${n}" | sed "s/^/${ns} /" | cat_i &&
files=$(find . -name "${ns}/dnstap.out.*" | wc -l) &&
test "$files" -le "${n}"
)
echo_i "checking 'rndc -roll <value>' (no versions)"
ret=0
start_server --noclean --restart --port "${PORT}" dnstap ns3
_repeat 5 test_dnstap_roll 10.53.0.3 ns3 3 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
echo_i "checking 'rndc -roll <value>' (versions)"
ret=0
start_server --noclean --restart --port "${PORT}" dnstap ns2
_repeat 5 test_dnstap_roll 10.53.0.2 ns2 3 || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
[ "$status" -eq 0 ] || exit 1
......@@ -40,3 +40,6 @@ Bug Fixes
- The ``primary`` and ``secondary`` keywords, when used as parameters for
``check-names``, were not processed correctly and were being ignored.
[GL #1949]
- 'rndc dnstap -roll <value>' was not limiting the number of saved
files to <value>. [GL !3728]
......@@ -337,7 +337,7 @@ dns_dt_reopen(dns_dtenv_t *env, int roll) {
fstrm_iothr_destroy(&env->iothr);
}
if (roll != 0) {
if (roll == 0) {
roll = env->rolls;
}
......@@ -349,7 +349,7 @@ dns_dt_reopen(dns_dtenv_t *env, int roll) {
char *filename = isc_mem_strdup(env->mctx, env->path);
file.name = filename;
file.stream = NULL;
file.versions = roll != 0 ? roll : env->rolls;
file.versions = roll;
file.maximum_size = 0;
file.maximum_reached = false;
file.suffix = env->suffix;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment