stream reuse, add a test for close by upstream server after timeout.

This commit is contained in:
W.C.A. Wijngaards 2020-07-30 16:41:28 +02:00
parent 444681af9d
commit 12d880ad47
3 changed files with 33 additions and 1 deletions

View file

@ -10,6 +10,7 @@ server:
chroot: ""
username: ""
do-not-query-localhost: no
tcp-idle-timeout: 10000
log-queries: yes
log-replies: yes
@ -24,6 +25,7 @@ server:
local-data: "www4.example.com A 10.20.30.44"
local-data: "www5.example.com A 10.20.30.45"
local-data: "www6.example.com A 10.20.30.46"
local-data: "www7.example.com A 10.20.30.47"
local-zone: "drop.net" deny
local-zone: "refuse.net" refuse

View file

@ -25,7 +25,7 @@ wait_unbound_up unbound.log
sed -e 's/@PORT\@/'$UPSTREAM_PORT'/' -e 's/@TOPORT\@/'$UPSTREAM_PORT'/' < tcp_reuse.conf2 > ub2.conf
# start upstream unbound in the background
#$PRE/unbound -d -c ub2.conf >unbound2.log 2>&1 &
$PRE/unbound -d -c ub2.conf 2>&1 | tee unbound2.log &
valgrind $PRE/unbound -d -c ub2.conf 2>&1 | tee unbound2.log &
UPSTREAM_PID=$!
echo "UPSTREAM_PID=$UPSTREAM_PID" >> .tpkg.var.test
wait_unbound_up unbound2.log

View file

@ -213,6 +213,36 @@ for x in a1.more.net a2.more.net a3.more.net a4.more.net a5.more.net; do
fi
done
# make the server timeout to drop the upstream connection
echo "> sleep 20"
sleep 15
# see if we are still up.
echo "> query a7.more.net"
$PRE/streamtcp -a -f 127.0.0.1@$UNBOUND_PORT a7.more.net A IN >outfile 2>&1
if test "$?" -ne 0; then
echo "exit status not OK"
echo "> cat logfiles"
cat outfile
cat unbound2.log
cat unbound.log
echo "Not OK"
exit 1
fi
cat outfile
for x in a7.more.net; do
if grep "$x" outfile | grep "10.20.30.40"; then
echo "content OK for $x"
else
echo "result contents not OK, for $x"
echo "> cat logfiles"
cat outfile
cat unbound2.log
cat unbound.log
echo "result contents not OK, for $x"
exit 1
fi
done
# dropconn.drop.net make the server drop the connection.
echo "> query a11.more.net a12.more.net dropconn.drop.net a14.more.net a15.more.net"
$PRE/streamtcp -a -f 127.0.0.1@$UNBOUND_PORT a11.more.net A IN a12.more.net A IN dropconn.drop.net A IN a14.more.net A IN a15.more.net A IN >outfile 2>&1