mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
for tap_data_free, does not delete NULL items. Also it does not try to free the tail, specifically in the free of the list since that picked up the next item in the list for its loop causing invalid free. Added internal unit test to unbound-dnstap-socket for that.
127 lines
4.1 KiB
Text
127 lines
4.1 KiB
Text
# #-- dnstap.test --#
|
|
# source the master var file when it's there
|
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
|
# use .tpkg.var.test for in test variable passing
|
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
|
|
|
. ../common.sh
|
|
PRE="../.."
|
|
|
|
# test if the server is up.
|
|
echo "> dig www.example.com."
|
|
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
|
|
echo "> check answer"
|
|
if grep "10.20.30.40" outfile; then
|
|
echo "OK"
|
|
else
|
|
echo "> cat logfiles"
|
|
cat tap.log
|
|
cat tap.errlog
|
|
cat fwd.log
|
|
cat unbound.log
|
|
echo "Not OK"
|
|
exit 1
|
|
fi
|
|
|
|
echo "> wait for log to happen on timer"
|
|
sleep 3
|
|
echo "> check tap.log for dnstap info"
|
|
# see if it logged the information in tap.log
|
|
# wait for a moment for filesystem to catch up.
|
|
if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "www.example.com" tap.log >/dev/null; then :; else sleep 10; fi
|
|
if grep "www.example.com" tap.log; then echo "yes it is in tap.log";
|
|
else
|
|
echo "information not in tap.log"
|
|
echo "failed"
|
|
echo "> cat logfiles"
|
|
cat tap.log
|
|
cat tap.errlog
|
|
cat fwd.log
|
|
cat unbound.log
|
|
echo "Not OK"
|
|
exit 1
|
|
fi
|
|
|
|
echo "> make 10 queries to spread them over threads"
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q1.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q2.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q3.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q4.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q5.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q6.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q7.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q8.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q9.example.net.
|
|
dig @127.0.0.1 -p $UNBOUND_PORT q10.example.net.
|
|
echo "> wait for log to happen on timer"
|
|
sleep 3
|
|
for x in q1 q2 q3 q4 5 q6 q7 q8 q9 q10; do
|
|
if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 10; fi
|
|
if grep "$x.example.net" tap.log; then echo "yes it is in tap.log";
|
|
else
|
|
echo "$x.example.net. information not in tap.log"
|
|
echo "failed"
|
|
echo "> cat logfiles"
|
|
cat tap.log
|
|
cat tap.errlog
|
|
cat fwd.log
|
|
cat unbound.log
|
|
echo "Not OK"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
echo "> query for a short ttl record"
|
|
dig @127.0.0.1 -p $UNBOUND_PORT short.example.com.
|
|
echo "> wait for log to happen on timer"
|
|
sleep 3
|
|
if grep "short.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "short.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "short.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "short.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "short.example.com" tap.log >/dev/null; then :; else sleep 1; fi
|
|
if grep "short.example.com" tap.log >/dev/null; then :; else sleep 10; fi
|
|
if grep "short.example.com" tap.log; then echo "yes it is in tap.log";
|
|
else
|
|
echo "short.example.com. information not in tap.log"
|
|
echo "failed"
|
|
echo "> cat logfiles"
|
|
cat tap.log
|
|
cat tap.errlog
|
|
cat fwd.log
|
|
cat unbound.log
|
|
echo "Not OK"
|
|
exit 1
|
|
fi
|
|
echo "> query again for the now expired record"
|
|
dig @127.0.0.1 -p $UNBOUND_PORT short.example.com.
|
|
echo "> wait for log to happen on timer"
|
|
sleep 3
|
|
num_responses=`grep "short.example.com" tap.log | grep CLIENT_RESPONSE | wc -l`
|
|
# Responses should be 2 for the 2 distinct dig commands.
|
|
if test $num_responses -gt 2; then
|
|
echo "Duplicate client responses for short.example.com. in tap.log"
|
|
echo "failed"
|
|
echo "> cat logfiles"
|
|
cat tap.log
|
|
cat tap.errlog
|
|
cat fwd.log
|
|
cat unbound.log
|
|
echo "Not OK"
|
|
exit 1
|
|
fi
|
|
|
|
echo "> cat logfiles"
|
|
cat fwd.log
|
|
echo "> OK"
|
|
exit 0
|