mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-21 07:10:43 -05:00
stream reuse, add a test for close by upstream server after timeout.
This commit is contained in:
parent
444681af9d
commit
12d880ad47
3 changed files with 33 additions and 1 deletions
2
testdata/tcp_reuse.tdir/tcp_reuse.conf2
vendored
2
testdata/tcp_reuse.tdir/tcp_reuse.conf2
vendored
|
|
@ -10,6 +10,7 @@ server:
|
||||||
chroot: ""
|
chroot: ""
|
||||||
username: ""
|
username: ""
|
||||||
do-not-query-localhost: no
|
do-not-query-localhost: no
|
||||||
|
tcp-idle-timeout: 10000
|
||||||
|
|
||||||
log-queries: yes
|
log-queries: yes
|
||||||
log-replies: yes
|
log-replies: yes
|
||||||
|
|
@ -24,6 +25,7 @@ server:
|
||||||
local-data: "www4.example.com A 10.20.30.44"
|
local-data: "www4.example.com A 10.20.30.44"
|
||||||
local-data: "www5.example.com A 10.20.30.45"
|
local-data: "www5.example.com A 10.20.30.45"
|
||||||
local-data: "www6.example.com A 10.20.30.46"
|
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: "drop.net" deny
|
||||||
local-zone: "refuse.net" refuse
|
local-zone: "refuse.net" refuse
|
||||||
|
|
|
||||||
2
testdata/tcp_reuse.tdir/tcp_reuse.pre
vendored
2
testdata/tcp_reuse.tdir/tcp_reuse.pre
vendored
|
|
@ -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
|
sed -e 's/@PORT\@/'$UPSTREAM_PORT'/' -e 's/@TOPORT\@/'$UPSTREAM_PORT'/' < tcp_reuse.conf2 > ub2.conf
|
||||||
# start upstream unbound in the background
|
# start upstream unbound in the background
|
||||||
#$PRE/unbound -d -c ub2.conf >unbound2.log 2>&1 &
|
#$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=$!
|
UPSTREAM_PID=$!
|
||||||
echo "UPSTREAM_PID=$UPSTREAM_PID" >> .tpkg.var.test
|
echo "UPSTREAM_PID=$UPSTREAM_PID" >> .tpkg.var.test
|
||||||
wait_unbound_up unbound2.log
|
wait_unbound_up unbound2.log
|
||||||
|
|
|
||||||
30
testdata/tcp_reuse.tdir/tcp_reuse.test
vendored
30
testdata/tcp_reuse.tdir/tcp_reuse.test
vendored
|
|
@ -213,6 +213,36 @@ for x in a1.more.net a2.more.net a3.more.net a4.more.net a5.more.net; do
|
||||||
fi
|
fi
|
||||||
done
|
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.
|
# 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"
|
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
|
$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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue