1 # #-- dnstap_reconnect.pre--#
2 # source the master var file when it's there
3 [ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4 # use .tpkg.var.test for in test variable passing
5 [ -f .tpkg.var.test ] && source .tpkg.var.test
10 if grep "define USE_DNSTAP 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
13 UNBOUND_PORT=$RND_PORT
14 FWD_PORT=$(($RND_PORT + 1))
15 CONTROL_PORT=$(($RND_PORT + 2))
16 echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
17 echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
18 echo "CONTROL_PORT=$CONTROL_PORT" >> .tpkg.var.test
22 $LDNS_TESTNS -p $FWD_PORT dnstap_reconnect.testns >fwd.log 2>&1 &
24 echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
26 # start the dnstap log server
27 # the -vvvv flag prints protocol and connection information from the
28 # unbound-dnstap-socket server.
29 # the -l flag prints the DNS info in the DNSTAP packet in multiline output.
30 # stderr is the '-vvvv' server logs and errors.
31 # stdout is the one-line packet logs (or with -l, multiline).
32 $PRE/unbound-dnstap-socket -u dnstap.socket -l -vvvv 2>tap.errlog >tap.log &
33 if test $? -ne 0; then
34 echo "could not start unbound-dnstap-socket server"
38 echo "DNSTAP_SOCKET_PID=$DNSTAP_SOCKET_PID" >> .tpkg.var.test
39 # wait for the server to go up and make the dnstap.socket file
40 wait_server_up "tap.errlog" "creating unix socket"
41 if test ! -S dnstap.socket; then
42 echo "the dnstap.socket file does not exist!"
46 sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' -e 's/@CONTROL_PORT\@/'$CONTROL_PORT'/' < dnstap_reconnect.conf > ub.conf
47 # start unbound in the background
48 $PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
50 echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
53 wait_ldns_testns_up fwd.log
54 wait_unbound_up unbound.log