xref: /netbsd-src/external/bsd/unbound/dist/testdata/ipset.tdir/ipset.pre (revision 91f7d55fb697b5e0475da4718fa34c3a3ebeac85)
1# #-- ipset.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
6
7. ../common.sh
8
9PRE="../.."
10if grep "define USE_IPSET 1" $PRE/config.h; then echo test enabled; else skip_test "test skipped"; fi
11
12get_random_port 2
13UNBOUND_PORT=$RND_PORT
14FWD_PORT=$(($RND_PORT + 1))
15echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
16echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
17
18# start forwarder
19get_ldns_testns
20$LDNS_TESTNS -p $FWD_PORT ipset.testns >fwd.log 2>&1 &
21FWD_PID=$!
22echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
23
24# make config file
25sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < ipset.conf > ub.conf
26# start unbound in the background
27$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
28UNBOUND_PID=$!
29echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
30
31cat .tpkg.var.test
32wait_ldns_testns_up fwd.log
33wait_unbound_up unbound.log
34