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 10 1.1 christos # Make all the queries. They need to succeed by the way. 11 1.1 christos echo "> dig www.example.net." 12 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT www.example.net. | tee outfile 13 1.1 christos echo "> check answer" 14 1.1 christos if grep "1.1.1.1" outfile; then 15 1.1 christos echo "OK" 16 1.1 christos else 17 1.1 christos echo "> cat logfiles" 18 1.1 christos cat fwd.log 19 1.1 christos cat unbound.log 20 1.1 christos echo "Not OK" 21 1.1 christos exit 1 22 1.1 christos fi 23 1.1 christos echo "> check ipset" 24 1.1 christos if grep "ipset: add 1.1.1.1 to atotallymadeupnamefor4 for www.example.net." unbound.log; then 25 1.1 christos echo "ipset OK" 26 1.1 christos else 27 1.1 christos echo "> cat logfiles" 28 1.1 christos cat fwd.log 29 1.1 christos cat unbound.log 30 1.1 christos echo "Not OK" 31 1.1 christos exit 1 32 1.1 christos fi 33 1.1 christos 34 1.1 christos echo "> dig www.example.net. AAAA" 35 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT www.example.net. AAAA | tee outfile 36 1.1 christos echo "> check answer" 37 1.1 christos if grep "::1" outfile; then 38 1.1 christos echo "OK" 39 1.1 christos else 40 1.1 christos echo "> cat logfiles" 41 1.1 christos cat fwd.log 42 1.1 christos cat unbound.log 43 1.1 christos echo "Not OK" 44 1.1 christos exit 1 45 1.1 christos fi 46 1.1 christos echo "> check ipset" 47 1.1 christos if grep "ipset: add ::1 to atotallymadeupnamefor6 for www.example.net." unbound.log; then 48 1.1 christos echo "ipset OK" 49 1.1 christos else 50 1.1 christos echo "> cat logfiles" 51 1.1 christos cat fwd.log 52 1.1 christos cat unbound.log 53 1.1 christos echo "Not OK" 54 1.1 christos exit 1 55 1.1 christos fi 56 1.1 christos 57 1.1 christos echo "> dig cname.example.net." 58 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT cname.example.net. | tee outfile 59 1.1 christos echo "> check answer" 60 1.1 christos if grep "2.2.2.2" outfile; then 61 1.1 christos echo "OK" 62 1.1 christos else 63 1.1 christos echo "> cat logfiles" 64 1.1 christos cat fwd.log 65 1.1 christos cat unbound.log 66 1.1 christos echo "Not OK" 67 1.1 christos exit 1 68 1.1 christos fi 69 1.1 christos echo "> check ipset" 70 1.1 christos if grep "ipset: add 2.2.2.2 to atotallymadeupnamefor4 for target.example.net." unbound.log; then 71 1.1 christos echo "ipset OK" 72 1.1 christos else 73 1.1 christos echo "> cat logfiles" 74 1.1 christos cat fwd.log 75 1.1 christos cat unbound.log 76 1.1 christos echo "Not OK" 77 1.1 christos exit 1 78 1.1 christos fi 79 1.1 christos 80 1.1 christos echo "> dig cname.example.net. AAAA" 81 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT cname.example.net. AAAA | tee outfile 82 1.1 christos echo "> check answer" 83 1.1 christos if grep "::2" outfile; then 84 1.1 christos echo "OK" 85 1.1 christos else 86 1.1 christos echo "> cat logfiles" 87 1.1 christos cat fwd.log 88 1.1 christos cat unbound.log 89 1.1 christos echo "Not OK" 90 1.1 christos exit 1 91 1.1 christos fi 92 1.1 christos echo "> check ipset" 93 1.1 christos if grep "ipset: add ::2 to atotallymadeupnamefor6 for target.example.net." unbound.log; then 94 1.1 christos echo "ipset OK" 95 1.1 christos else 96 1.1 christos echo "> cat logfiles" 97 1.1 christos cat fwd.log 98 1.1 christos cat unbound.log 99 1.1 christos echo "Not OK" 100 1.1 christos exit 1 101 1.1 christos fi 102 1.1 christos 103 1.1 christos echo "> dig outsidecname.example.net." 104 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT outsidecname.example.net. | tee outfile 105 1.1 christos echo "> check answer" 106 1.1 christos if grep "3.3.3.3" outfile; then 107 1.1 christos echo "OK" 108 1.1 christos else 109 1.1 christos echo "> cat logfiles" 110 1.1 christos cat fwd.log 111 1.1 christos cat unbound.log 112 1.1 christos echo "Not OK" 113 1.1 christos exit 1 114 1.1 christos fi 115 1.1 christos echo "> check ipset" 116 1.1 christos if grep "ipset: add 3.3.3.3 to atotallymadeupnamefor4 for target.example.com." unbound.log; then 117 1.1 christos echo "ipset OK" 118 1.1 christos else 119 1.1 christos echo "> cat logfiles" 120 1.1 christos cat fwd.log 121 1.1 christos cat unbound.log 122 1.1 christos echo "Not OK" 123 1.1 christos exit 1 124 1.1 christos fi 125 1.1 christos 126 1.1 christos echo "> dig outsidecname.example.net. AAAA" 127 1.1 christos dig @127.0.0.1 -p $UNBOUND_PORT outsidecname.example.net. AAAA | tee outfile 128 1.1 christos echo "> check answer" 129 1.1 christos if grep "::3" outfile; then 130 1.1 christos echo "OK" 131 1.1 christos else 132 1.1 christos echo "> cat logfiles" 133 1.1 christos cat fwd.log 134 1.1 christos cat unbound.log 135 1.1 christos echo "Not OK" 136 1.1 christos exit 1 137 1.1 christos fi 138 1.1 christos echo "> check ipset" 139 1.1 christos if grep "ipset: add ::3 to atotallymadeupnamefor6 for target.example.com." unbound.log; then 140 1.1 christos echo "ipset OK" 141 1.1 christos else 142 1.1 christos echo "> cat logfiles" 143 1.1 christos cat fwd.log 144 1.1 christos cat unbound.log 145 1.1 christos echo "Not OK" 146 1.1 christos exit 1 147 1.1 christos fi 148 1.1 christos 149 1.1.1.2 christos echo "> dig lookslikeexample.net. AAAA" 150 1.1.1.2 christos dig @127.0.0.1 -p $UNBOUND_PORT lookslikeexample.net. AAAA | tee outfile 151 1.1.1.2 christos echo "> check answer" 152 1.1.1.2 christos if grep "::4" outfile; then 153 1.1.1.2 christos echo "OK" 154 1.1.1.2 christos else 155 1.1.1.2 christos echo "> cat logfiles" 156 1.1.1.2 christos cat fwd.log 157 1.1.1.2 christos cat unbound.log 158 1.1.1.2 christos echo "Not OK" 159 1.1.1.2 christos exit 1 160 1.1.1.2 christos fi 161 1.1.1.2 christos echo "> check ipset" 162 1.1.1.2 christos if grep "ipset: add ::4 to atotallymadeupnamefor6 for lookslikeexample.net." unbound.log; then 163 1.1.1.2 christos echo "> cat logfiles" 164 1.1.1.2 christos cat fwd.log 165 1.1.1.2 christos cat unbound.log 166 1.1.1.2 christos echo "Not OK" 167 1.1.1.2 christos exit 1 168 1.1.1.2 christos else 169 1.1.1.2 christos echo "ipset OK" 170 1.1.1.2 christos fi 171 1.1.1.2 christos 172 1.1 christos echo "> cat logfiles" 173 1.1 christos cat tap.log 174 1.1 christos cat tap.errlog 175 1.1 christos cat fwd.log 176 1.1 christos echo "> OK" 177 1.1 christos exit 0 178