1 1.1 christos # #-- ipset.test --# 2 1.1 christos # source the master var file when it's there 3 1.1 christos [ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4 1.1 christos # use .tpkg.var.test for in test variable passing 5 1.1 christos [ -f .tpkg.var.test ] && source .tpkg.var.test 6 1.1 christos 7 1.1 christos . ../common.sh 8 1.1 christos PRE="../.." 9 1.1 christos if grep "define USE_IPSET 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi 10 1.1 christos 11 1.1 christos # Make all the queries. They need to succeed by the way. 12 1.1 christos echo "> dig www.example.net." 13 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT www.example.net. | tee outfile 14 1.1 christos echo "> check answer" 15 1.1 christos if grep "1.1.1.1" outfile; then 16 1.1 christos echo "OK" 17 1.1 christos else 18 1.1 christos echo "> cat logfiles" 19 1.1 christos cat fwd.log 20 1.1 christos cat unbound.log 21 1.1 christos echo "Not OK" 22 1.1 christos exit 1 23 1.1 christos fi 24 1.1 christos echo "> check ipset" 25 1.1 christos if grep "ipset: add 1.1.1.1 to atotallymadeupnamefor4 for www.example.net." unbound.log; then 26 1.1 christos echo "ipset OK" 27 1.1 christos else 28 1.1 christos echo "> cat logfiles" 29 1.1 christos cat fwd.log 30 1.1 christos cat unbound.log 31 1.1 christos echo "Not OK" 32 1.1 christos exit 1 33 1.1 christos fi 34 1.1 christos 35 1.1 christos echo "> dig www.example.net. AAAA" 36 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT www.example.net. AAAA | tee outfile 37 1.1 christos echo "> check answer" 38 1.1 christos if grep "::1" outfile; then 39 1.1 christos echo "OK" 40 1.1 christos else 41 1.1 christos echo "> cat logfiles" 42 1.1 christos cat fwd.log 43 1.1 christos cat unbound.log 44 1.1 christos echo "Not OK" 45 1.1 christos exit 1 46 1.1 christos fi 47 1.1 christos echo "> check ipset" 48 1.1 christos if grep "ipset: add ::1 to atotallymadeupnamefor6 for www.example.net." unbound.log; then 49 1.1 christos echo "ipset OK" 50 1.1 christos else 51 1.1 christos echo "> cat logfiles" 52 1.1 christos cat fwd.log 53 1.1 christos cat unbound.log 54 1.1 christos echo "Not OK" 55 1.1 christos exit 1 56 1.1 christos fi 57 1.1 christos 58 1.1 christos echo "> dig cname.example.net." 59 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT cname.example.net. | tee outfile 60 1.1 christos echo "> check answer" 61 1.1 christos if grep "2.2.2.2" outfile; then 62 1.1 christos echo "OK" 63 1.1 christos else 64 1.1 christos echo "> cat logfiles" 65 1.1 christos cat fwd.log 66 1.1 christos cat unbound.log 67 1.1 christos echo "Not OK" 68 1.1 christos exit 1 69 1.1 christos fi 70 1.1 christos echo "> check ipset" 71 1.1 christos if grep "ipset: add 2.2.2.2 to atotallymadeupnamefor4 for target.example.net." unbound.log; then 72 1.1 christos echo "ipset OK" 73 1.1 christos else 74 1.1 christos echo "> cat logfiles" 75 1.1 christos cat fwd.log 76 1.1 christos cat unbound.log 77 1.1 christos echo "Not OK" 78 1.1 christos exit 1 79 1.1 christos fi 80 1.1 christos 81 1.1 christos echo "> dig cname.example.net. AAAA" 82 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT cname.example.net. AAAA | tee outfile 83 1.1 christos echo "> check answer" 84 1.1 christos if grep "::2" outfile; then 85 1.1 christos echo "OK" 86 1.1 christos else 87 1.1 christos echo "> cat logfiles" 88 1.1 christos cat fwd.log 89 1.1 christos cat unbound.log 90 1.1 christos echo "Not OK" 91 1.1 christos exit 1 92 1.1 christos fi 93 1.1 christos echo "> check ipset" 94 1.1 christos if grep "ipset: add ::2 to atotallymadeupnamefor6 for target.example.net." unbound.log; then 95 1.1 christos echo "ipset OK" 96 1.1 christos else 97 1.1 christos echo "> cat logfiles" 98 1.1 christos cat fwd.log 99 1.1 christos cat unbound.log 100 1.1 christos echo "Not OK" 101 1.1 christos exit 1 102 1.1 christos fi 103 1.1 christos 104 1.1 christos echo "> dig outsidecname.example.net." 105 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT outsidecname.example.net. | tee outfile 106 1.1 christos echo "> check answer" 107 1.1 christos if grep "3.3.3.3" outfile; then 108 1.1 christos echo "OK" 109 1.1 christos else 110 1.1 christos echo "> cat logfiles" 111 1.1 christos cat fwd.log 112 1.1 christos cat unbound.log 113 1.1 christos echo "Not OK" 114 1.1 christos exit 1 115 1.1 christos fi 116 1.1 christos echo "> check ipset" 117 1.1 christos if grep "ipset: add 3.3.3.3 to atotallymadeupnamefor4 for target.example.com." unbound.log; then 118 1.1 christos echo "ipset OK" 119 1.1 christos else 120 1.1 christos echo "> cat logfiles" 121 1.1 christos cat fwd.log 122 1.1 christos cat unbound.log 123 1.1 christos echo "Not OK" 124 1.1 christos exit 1 125 1.1 christos fi 126 1.1 christos 127 1.1 christos echo "> dig outsidecname.example.net. AAAA" 128 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT outsidecname.example.net. AAAA | tee outfile 129 1.1 christos echo "> check answer" 130 1.1 christos if grep "::3" outfile; then 131 1.1 christos echo "OK" 132 1.1 christos else 133 1.1 christos echo "> cat logfiles" 134 1.1 christos cat fwd.log 135 1.1 christos cat unbound.log 136 1.1 christos echo "Not OK" 137 1.1 christos exit 1 138 1.1 christos fi 139 1.1 christos echo "> check ipset" 140 1.1 christos if grep "ipset: add ::3 to atotallymadeupnamefor6 for target.example.com." unbound.log; then 141 1.1 christos echo "ipset OK" 142 1.1 christos else 143 1.1 christos echo "> cat logfiles" 144 1.1 christos cat fwd.log 145 1.1 christos cat unbound.log 146 1.1 christos echo "Not OK" 147 1.1 christos exit 1 148 1.1 christos fi 149 1.1 christos 150 1.1 christos echo "> cat logfiles" 151 1.1 christos cat tap.log 152 1.1 christos cat tap.errlog 153 1.1 christos cat fwd.log 154 1.1 christos echo "> OK" 155 1.1 christos exit 0 156