File: padding.pre

package info (click to toggle)
unbound 1.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,436 kB
  • sloc: ansic: 138,476; sh: 6,860; yacc: 4,259; python: 1,950; makefile: 1,881; awk: 162; perl: 158; xml: 36
file content (69 lines) | stat: -rw-r--r-- 2,548 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# #-- padding.pre--#
# 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

PRE="../.."
. ../common.sh
if grep "define USE_DNSTAP 1" $PRE/config.h; then echo test enabled; else skip_test "test skipped"; fi

get_random_port 5
UNBOUND_PORT=$RND_PORT
UPSTREAM_PORT=$(($RND_PORT + 1))
FWD_PORT=$(($RND_PORT + 2))
CONTROL_PORT=$(($RND_PORT + 3))
CONTROL_PORT2=$(($RND_PORT + 4))
echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
echo "UPSTREAM_PORT=$UPSTREAM_PORT" >> .tpkg.var.test
echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
echo "CONTROL_PORT=$CONTROL_PORT" >> .tpkg.var.test
echo "CONTROL_PORT2=$CONTROL_PORT2" >> .tpkg.var.test

# start ldns-testnd
get_ldns_testns
$LDNS_TESTNS -p $FWD_PORT padding.testns >fwd.log 2>&1 &
FWD_PID=$!
echo "FWD_PID=$FWD_PID" >> .tpkg.var.test

# start the dnstap log server
# the -vvvv flag prints protocol and connection information from the
# unbound-dnstap-socket server.
# the -l flag prints the DNS info in the DNSTAP packet in multiline output.
# stderr is the '-vvvv' server logs and errors.
# stdout is the one-line packet logs (or with -l, multiline).
$PRE/unbound-dnstap-socket -u dnstap.socket -l -vvvv 2>tap.errlog >tap.log &
if test $? -ne 0; then
        echo "could not start unbound-dnstap-socket server"
        exit 1
fi
DNSTAP_SOCKET_PID=$!
echo "DNSTAP_SOCKET_PID=$DNSTAP_SOCKET_PID" >> .tpkg.var.test
# wait for the server to go up and make the dnstap.socket file
wait_server_up "tap.errlog" "creating unix socket"
if test ! -S dnstap.socket; then 
        echo "the dnstap.socket file does not exist!"
fi

# make config file
sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$UPSTREAM_PORT'/' -e 's/@CONTROL_PORT\@/'$CONTROL_PORT'/' < padding.conf > ub.conf
# start unbound in the background
$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
#$PRE/unbound -d -c ub.conf 2>&1 | tee unbound.log &
UNBOUND_PID=$!
echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test

# make upstream config file
sed -e 's/@PORT\@/'$UPSTREAM_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' -e 's/@CONTROL_PORT2\@/'$CONTROL_PORT2'/' < padding.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 &
UPSTREAM_PID=$!
echo "UPSTREAM_PID=$UPSTREAM_PID" >> .tpkg.var.test

wait_ldns_testns_up fwd.log
wait_unbound_up unbound.log
wait_unbound_up unbound2.log

cat .tpkg.var.test