4522. [bug] Handle big gaps in log file version numbers better.

[RT #38688]

(cherry picked from commit cab871f1bc)
This commit is contained in:
Mark Andrews
2016-11-30 10:55:21 +11:00
parent f47c8aa6f7
commit c7948d9050
7 changed files with 233 additions and 47 deletions

View File

@@ -25,3 +25,8 @@ rm -f ns1/named_log ns1/named_pipe ns1/named_sym
rm -f ns1/named.conf
rm -rf ns1/named_dir
rm -f ns1/rndc.out.test*
rm -f ns1/dig.out.test*
rm -f ns1/named_vers
rm -f ns1/named_vers.*
rm -f ns1/named_unlimited
rm -f ns1/named_unlimited.*

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port 5300;
pid-file "named.pid";
listen-on port 5300 {
10.53.0.1;
};
listen-on-v6 { none; };
recursion no;
notify yes;
};
logging {
channel default_log {
file "named_unlimited" versions unlimited size 1000;
severity debug 100;
print-time yes;
};
category default { default_log; default_debug; };
category lame-servers { null; };
channel query_log {
file "query_log";
print-time yes;
};
category queries { query_log; };
};
controls {
inet 127.0.0.1 port 9593 allow {
127.0.0.1/32; ::1/128; }
keys { "rndc-key"; };
};
key "rndc-key" {
algorithm hmac-sha256;
secret "Am9vCg==";
};
zone "." {
type master;
file "root.db";
};

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port 5300;
pid-file "named.pid";
listen-on port 5300 {
10.53.0.1;
};
listen-on-v6 { none; };
recursion no;
notify yes;
};
logging {
channel default_log {
file "named_vers" versions 5 size 1000; // really small size
severity debug 100;
print-time yes;
};
category default { default_log; default_debug; };
category lame-servers { null; };
channel query_log {
file "query_log";
print-time yes;
};
category queries { query_log; };
};
controls {
inet 127.0.0.1 port 9593 allow {
127.0.0.1/32; ::1/128; }
keys { "rndc-key"; };
};
key "rndc-key" {
algorithm hmac-sha256;
secret "Am9vCg==";
};
zone "." {
type master;
file "root.db";
};

View File

@@ -24,10 +24,14 @@ PLAINCONF="${THISDIR}/${CONFDIR}/named.plain"
DIRCONF="${THISDIR}/${CONFDIR}/named.dirconf"
PIPECONF="${THISDIR}/${CONFDIR}/named.pipeconf"
SYMCONF="${THISDIR}/${CONFDIR}/named.symconf"
VERSCONF="${THISDIR}/${CONFDIR}/named.versconf"
UNLIMITEDCONF="${THISDIR}/${CONFDIR}/named.unlimited"
PLAINFILE="named_log"
DIRFILE="named_dir"
PIPEFILE="named_pipe"
SYMFILE="named_sym"
VERSFILE="named_vers"
UNLIMITEDFILE="named_unlimited"
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -U 4"
@@ -236,5 +240,74 @@ else
echo "I: skipping symlink test (unable to create symlink)"
fi
echo "I:testing logging functionality"
n=`expr $n + 1`
echo "I: testing explict versions ($n)"
cp $VERSCONF named.conf
# a seconds since epoch version number
touch $VERSFILE.1480039317
t1=`$PERL -e 'print time()."\n";'`
$myRNDC reconfig > rndc.out.test$n 2>&1
$DIG version.bind txt ch @10.53.0.1 -p 5300 > dig.out.test$n
t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 1
then
echo "I: testing explict versions failed cleanup of old entries took too long"
status=`expr $status + 1`
fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then
echo "I: testing explict versions failed DiG lookup failed"
status=`expr $status + 1`
fi
if test -f $VERSFILE.1480039317
then
echo "I: testing explict versions failed $VERSFILE.1480039317 not removed"
status=`expr $status + 1`
fi
if test -f $VERSFILE.5
then
echo "I: testing explict versions failed $VERSFILE.5 exists"
status=`expr $status + 1`
fi
if test ! -f $VERSFILE.4
then
echo "I: testing explict versions failed $VERSFILE.4 does not exist"
status=`expr $status + 1`
fi
n=`expr $n + 1`
echo "I: testing unlimited versions ($n)"
cp $UNLIMITEDCONF named.conf
# a seconds since epoch version number
touch $UNLIMITEDFILE.1480039317
t1=`$PERL -e 'print time()."\n";'`
$myRNDC reconfig > rndc.out.test$n 2>&1
$DIG version.bind txt ch @10.53.0.1 -p 5300 > dig.out.test$n
t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 1
then
echo "I: testing unlimited versions failed took too long"
status=`expr $status + 1`
fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then
echo "I: testing unlimited versions failed DiG lookup failed"
status=`expr $status + 1`
fi
if test ! -f $UNLIMITEDFILE.1480039317
then
echo "I: testing unlimited versions failed $UNLIMITEDFILE.1480039317 removed"
status=`expr $status + 1`
fi
if test ! -f $UNLIMITEDFILE.5
then
echo "I: testing unlimited versions failed $UNLIMITEDFILE.5 does not"
status=`expr $status + 1`
fi
echo "I:exit status: $status"
[ $status -eq 0 ] || exit 1