1# #-- fwd_ancil.test --# 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 7PRE="../.." 8. ../common.sh 9 10if fgrep "disable interface-automatic" unbound.log; then 11 echo "skip test" 12 exit 0 13fi 14 15get_make 16(cd $PRE; $MAKE streamtcp) 17 18# detect platform support first 19echo "> streamtcp -n -u -f 127.0.0.1 www.example.com. A IN" 20$PRE/streamtcp -n -u -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile 21sleep 2 22echo "> check answer" 23if ! grep "Please disable interface-automatic" unbound.log; then 24 echo "OK" 25else 26 echo "No platform support for ancillary data" 27 echo "> cat logfiles" 28 cat fwd.log 29 cat unbound.log 30 echo "Not OK - but ignore test" 31 exit 0 32fi 33rm outfile 34 35 36# do the test 37echo "> streamtcp -f 127.0.0.1 www.example.com. A IN" 38$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile 39echo "> check answer" 40if grep "10.20.30.40" outfile; then 41 echo "OK" 42else 43 echo "> cat logfiles" 44 cat fwd.log 45 cat unbound.log 46 echo "Not OK" 47 exit 1 48fi 49rm outfile 50 51echo "> streamtcp -f ::1 www.example.com. A IN" 52$PRE/streamtcp -f ::1@$UNBOUND_PORT www.example.com. A IN | tee outfile 53echo "> check answer" 54if grep "10.20.30.40" outfile; then 55 echo "OK" 56else 57 echo "> cat logfiles" 58 cat fwd.log 59 cat unbound.log 60 echo "Not OK" 61 exit 1 62fi 63rm outfile 64 65echo "> streamtcp -u -f ::1 www.example.com. A IN" 66$PRE/streamtcp -u -f ::1@$UNBOUND_PORT www.example.com. A IN | tee outfile 67echo "> check answer" 68if grep "10.20.30.40" outfile; then 69 echo "OK" 70else 71 echo "> cat logfiles" 72 cat fwd.log 73 cat unbound.log 74 echo "Not OK" 75 exit 1 76fi 77rm outfile 78 79echo "> streamtcp -u -f 127.0.0.1 www.example.com. A IN" 80$PRE/streamtcp -u -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile 81echo "> check answer" 82if grep "10.20.30.40" outfile; then 83 echo "OK" 84else 85 echo "> cat logfiles" 86 cat fwd.log 87 cat unbound.log 88 echo "Not OK" 89 exit 1 90fi 91rm outfile 92 93echo "> cat logfiles" 94cat fwd.log 95cat unbound.log 96exit 0 97