1 1.1 christos #!/bin/sh 2 1.1.1.4 christos 3 1.1 christos # Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4 1.1 christos # 5 1.1.1.4 christos # SPDX-License-Identifier: MPL-2.0 6 1.1.1.4 christos # 7 1.1 christos # This Source Code Form is subject to the terms of the Mozilla Public 8 1.1.1.4 christos # License, v. 2.0. If a copy of the MPL was not distributed with this 9 1.1.1.3 christos # file, you can obtain one at https://mozilla.org/MPL/2.0/. 10 1.1 christos # 11 1.1 christos # See the COPYRIGHT file distributed with this work for additional 12 1.1 christos # information regarding copyright ownership. 13 1.1 christos 14 1.1.1.5 christos set -e 15 1.1.1.5 christos 16 1.1.1.5 christos . ../conf.sh 17 1.1 christos 18 1.1.1.6 christos dig_with_opts() { 19 1.1.1.6 christos $DIG -p "${PORT}" +retries=0 "$@" 20 1.1.1.6 christos } 21 1.1 christos 22 1.1 christos status=0 23 1.1 christos n=0 24 1.1 christos 25 1.1 christos ns3_reset() { 26 1.1.1.5 christos $RNDC -c ../_common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/I:ns3 /' 27 1.1.1.5 christos $RNDC -c ../_common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} flush | sed 's/^/I:ns3 /' 28 1.1 christos } 29 1.1 christos 30 1.1.1.6 christos ns3_flush() { 31 1.1.1.6 christos $RNDC -c ../_common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} flush | sed 's/^/I:ns3 /' 32 1.1.1.6 christos } 33 1.1.1.6 christos 34 1.1 christos ns3_sends_aaaa_queries() { 35 1.1.1.5 christos if grep "started AAAA fetch" ns3/named.run >/dev/null; then 36 1.1.1.5 christos return 0 37 1.1.1.5 christos else 38 1.1.1.5 christos return 1 39 1.1.1.5 christos fi 40 1.1 christos } 41 1.1 christos 42 1.1 christos # Check whether the number of queries ans2 received from ns3 (this value is 43 1.1 christos # read from dig output stored in file $1) is as expected. The expected query 44 1.1 christos # count is variable: 45 1.1 christos # - if ns3 sends AAAA queries, the query count should equal $2, 46 1.1 christos # - if ns3 does not send AAAA queries, the query count should equal $3. 47 1.1 christos check_query_count() { 48 1.1.1.5 christos count1=$(sed 's/[^0-9]//g;' $1) 49 1.1.1.5 christos count2=$(sed 's/[^0-9]//g;' $2) 50 1.1.1.5 christos count=$((count1 + count2)) 51 1.1.1.5 christos #echo_i "count1=$count1 count2=$count2 count=$count" 52 1.1.1.5 christos expected_count_with_aaaa=$3 53 1.1.1.5 christos expected_count_without_aaaa=$4 54 1.1.1.5 christos 55 1.1.1.5 christos if ns3_sends_aaaa_queries; then 56 1.1.1.5 christos expected_count=$expected_count_with_aaaa 57 1.1.1.5 christos else 58 1.1.1.5 christos expected_count=$expected_count_without_aaaa 59 1.1.1.5 christos fi 60 1.1.1.5 christos 61 1.1.1.5 christos if [ $count -ne $expected_count ]; then 62 1.1.1.5 christos echo_i "count $count (actual) != $expected_count (expected)" 63 1.1.1.5 christos ret=1 64 1.1.1.5 christos fi 65 1.1 christos } 66 1.1 christos 67 1.1 christos echo_i "set max-recursion-depth=12" 68 1.1 christos 69 1.1.1.5 christos n=$((n + 1)) 70 1.1 christos echo_i "attempt excessive-depth lookup ($n)" 71 1.1 christos ret=0 72 1.1.1.5 christos echo "1000" >ans2/ans.limit 73 1.1.1.5 christos echo "1000" >ans4/ans.limit 74 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 75 1.1.1.6 christos dig_with_opts @10.53.0.4 reset >/dev/null || ret=1 76 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect1.example.org >dig.out.1.test$n || ret=1 77 1.1.1.5 christos grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1 78 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 79 1.1.1.6 christos dig_with_opts +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1 80 1.1.1.2 christos check_query_count dig.out.2.test$n dig.out.4.test$n 27 14 81 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 82 1.1.1.5 christos status=$((status + ret)) 83 1.1 christos 84 1.1.1.5 christos n=$((n + 1)) 85 1.1 christos echo_i "attempt permissible lookup ($n)" 86 1.1 christos ret=0 87 1.1.1.5 christos echo "12" >ans2/ans.limit 88 1.1.1.5 christos echo "12" >ans4/ans.limit 89 1.1.1.9 christos ns3_reset 90 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 91 1.1.1.6 christos dig_with_opts @10.53.0.4 reset >/dev/null || ret=1 92 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect2.example.org >dig.out.1.test$n || ret=1 93 1.1.1.5 christos grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1 94 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 95 1.1.1.6 christos dig_with_opts +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1 96 1.1.1.2 christos check_query_count dig.out.2.test$n dig.out.4.test$n 50 26 97 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 98 1.1.1.5 christos status=$((status + ret)) 99 1.1 christos 100 1.1 christos echo_i "set max-recursion-depth=5" 101 1.1 christos 102 1.1.1.5 christos n=$((n + 1)) 103 1.1 christos echo_i "attempt excessive-depth lookup ($n)" 104 1.1 christos ret=0 105 1.1.1.5 christos echo "12" >ans2/ans.limit 106 1.1.1.9 christos cp ns3/named2.conf ns3/named.conf 107 1.1.1.9 christos ns3_reset 108 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 109 1.1.1.6 christos dig_with_opts @10.53.0.4 reset >/dev/null || ret=1 110 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect3.example.org >dig.out.1.test$n || ret=1 111 1.1.1.5 christos grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1 112 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 113 1.1.1.6 christos dig_with_opts +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1 114 1.1.1.2 christos check_query_count dig.out.2.test$n dig.out.4.test$n 13 7 115 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 116 1.1.1.5 christos status=$((status + ret)) 117 1.1 christos 118 1.1.1.5 christos n=$((n + 1)) 119 1.1 christos echo_i "attempt permissible lookup ($n)" 120 1.1 christos ret=0 121 1.1.1.5 christos echo "5" >ans2/ans.limit 122 1.1.1.5 christos echo "5" >ans4/ans.limit 123 1.1.1.9 christos ns3_reset 124 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 125 1.1.1.6 christos dig_with_opts @10.53.0.4 reset >/dev/null || ret=1 126 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect4.example.org >dig.out.1.test$n || ret=1 127 1.1.1.5 christos grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1 128 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 129 1.1.1.6 christos dig_with_opts +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1 130 1.1.1.2 christos check_query_count dig.out.2.test$n dig.out.4.test$n 22 12 131 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 132 1.1.1.5 christos status=$((status + ret)) 133 1.1 christos 134 1.1 christos echo_i "set max-recursion-depth=100, max-recursion-queries=50" 135 1.1 christos 136 1.1.1.5 christos n=$((n + 1)) 137 1.1 christos echo_i "attempt excessive-queries lookup ($n)" 138 1.1 christos ret=0 139 1.1.1.5 christos echo "13" >ans2/ans.limit 140 1.1.1.5 christos echo "13" >ans4/ans.limit 141 1.1.1.9 christos cp ns3/named3.conf ns3/named.conf 142 1.1.1.9 christos ns3_reset 143 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 144 1.1.1.6 christos dig_with_opts @10.53.0.4 reset >/dev/null || ret=1 145 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect5.example.org >dig.out.1.test$n || ret=1 146 1.1 christos if ns3_sends_aaaa_queries; then 147 1.1.1.5 christos grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1 148 1.1 christos fi 149 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 150 1.1.1.6 christos dig_with_opts +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1 151 1.1.1.5 christos eval count=$(cat dig.out.2.test$n) 152 1.1.1.5 christos [ $count -le 50 ] || { 153 1.1.1.5 christos ret=1 154 1.1.1.5 christos echo_i "count ($count) !<= 50" 155 1.1.1.5 christos } 156 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 157 1.1.1.5 christos status=$((status + ret)) 158 1.1 christos 159 1.1.1.5 christos n=$((n + 1)) 160 1.1 christos echo_i "attempt permissible lookup ($n)" 161 1.1 christos ret=0 162 1.1.1.5 christos echo "12" >ans2/ans.limit 163 1.1.1.9 christos ns3_reset 164 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 165 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect6.example.org >dig.out.1.test$n || ret=1 166 1.1.1.5 christos grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1 167 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 168 1.1.1.5 christos eval count=$(cat dig.out.2.test$n) 169 1.1.1.5 christos [ $count -le 50 ] || { 170 1.1.1.5 christos ret=1 171 1.1.1.5 christos echo_i "count ($count) !<= 50" 172 1.1.1.5 christos } 173 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 174 1.1.1.5 christos status=$((status + ret)) 175 1.1 christos 176 1.1 christos echo_i "set max-recursion-depth=100, max-recursion-queries=40" 177 1.1 christos 178 1.1.1.5 christos n=$((n + 1)) 179 1.1 christos echo_i "attempt excessive-queries lookup ($n)" 180 1.1 christos ret=0 181 1.1.1.5 christos echo "11" >ans2/ans.limit 182 1.1.1.9 christos cp ns3/named4.conf ns3/named.conf 183 1.1.1.9 christos ns3_reset 184 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 185 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect7.example.org >dig.out.1.test$n || ret=1 186 1.1 christos if ns3_sends_aaaa_queries; then 187 1.1.1.5 christos grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1 188 1.1 christos fi 189 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 190 1.1.1.5 christos eval count=$(cat dig.out.2.test$n) 191 1.1.1.5 christos [ $count -le 40 ] || { 192 1.1.1.5 christos ret=1 193 1.1.1.5 christos echo_i "count ($count) !<= 40" 194 1.1.1.5 christos } 195 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 196 1.1.1.5 christos status=$((status + ret)) 197 1.1 christos 198 1.1.1.5 christos n=$((n + 1)) 199 1.1 christos echo_i "attempt permissible lookup ($n)" 200 1.1 christos ret=0 201 1.1.1.5 christos echo "9" >ans2/ans.limit 202 1.1.1.9 christos ns3_reset 203 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 204 1.1.1.6 christos dig_with_opts @10.53.0.3 indirect8.example.org >dig.out.1.test$n || ret=1 205 1.1.1.5 christos grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1 206 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 207 1.1.1.5 christos eval count=$(cat dig.out.2.test$n) 208 1.1.1.5 christos [ $count -le 40 ] || { 209 1.1.1.5 christos ret=1 210 1.1.1.5 christos echo_i "count ($count) !<= 40" 211 1.1.1.5 christos } 212 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 213 1.1.1.5 christos status=$((status + ret)) 214 1.1 christos 215 1.1.1.5 christos n=$((n + 1)) 216 1.1 christos echo_i "attempting NS explosion ($n)" 217 1.1 christos ret=0 218 1.1.1.9 christos ns3_reset 219 1.1.1.6 christos dig_with_opts @10.53.0.2 reset >/dev/null || ret=1 220 1.1.1.6 christos dig_with_opts +short @10.53.0.3 ns1.1.example.net >dig.out.1.test$n || ret=1 221 1.1.1.6 christos dig_with_opts +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1 222 1.1.1.5 christos eval count=$(cat dig.out.2.test$n) 223 1.1 christos [ $count -lt 50 ] || ret=1 224 1.1.1.6 christos dig_with_opts +short @10.53.0.7 count txt >dig.out.3.test$n || ret=1 225 1.1.1.5 christos eval count=$(cat dig.out.3.test$n) 226 1.1.1.5 christos [ $count -lt 50 ] || { 227 1.1.1.5 christos ret=1 228 1.1.1.5 christos echo_i "count ($count) !<= 50" 229 1.1.1.5 christos } 230 1.1 christos if [ $ret != 0 ]; then echo_i "failed"; fi 231 1.1.1.5 christos status=$((status + ret)) 232 1.1 christos 233 1.1.1.6 christos n=$((n + 1)) 234 1.1.1.6 christos echo_i "checking RRset that exceeds max-records-per-type ($n)" 235 1.1.1.6 christos ret=0 236 1.1.1.6 christos dig_with_opts @10.53.0.3 biganswer.big >dig.out.1.test$n || ret=1 237 1.1.1.6 christos grep 'status: SERVFAIL' dig.out.1.test$n >/dev/null || ret=1 238 1.1.1.7 christos 239 1.1.1.7 christos msg="error adding 'biganswer.big/A' in './IN' (cache): too many records (must not exceed 100)" 240 1.1.1.7 christos wait_for_log 10 "$msg" ns3/named.run || ret=1 241 1.1.1.7 christos if [ $ret != 0 ]; then echo_i "failed"; fi 242 1.1.1.7 christos status=$((status + ret)) 243 1.1.1.7 christos 244 1.1.1.9 christos cp ns3/named5.conf ns3/named.conf 245 1.1.1.9 christos ns3_reset 246 1.1.1.6 christos dig_with_opts @10.53.0.3 biganswer.big >dig.out.2.test$n || ret=1 247 1.1.1.6 christos grep 'status: NOERROR' dig.out.2.test$n >/dev/null || ret=1 248 1.1.1.6 christos if [ $ret != 0 ]; then echo_i "failed"; fi 249 1.1.1.6 christos status=$((status + ret)) 250 1.1.1.6 christos 251 1.1.1.6 christos check_manytypes() ( 252 1.1.1.6 christos i=$1 253 1.1.1.6 christos name=$2 254 1.1.1.6 christos type=$3 255 1.1.1.6 christos expected=$4 256 1.1.1.6 christos exname=$5 257 1.1.1.6 christos extype=$6 258 1.1.1.6 christos ttl=$7 259 1.1.1.6 christos neq_ttl=$8 260 1.1.1.6 christos 261 1.1.1.6 christos if ! dig_with_opts @10.53.0.3 IN "$type" "$name" >"dig.out.$i.$type.test$n"; then 262 1.1.1.6 christos exit 1 263 1.1.1.6 christos fi 264 1.1.1.6 christos 265 1.1.1.6 christos if ! grep 'status: '"${expected}"'' "dig.out.$i.$type.test$n" >/dev/null; then 266 1.1.1.6 christos exit 1 267 1.1.1.6 christos fi 268 1.1.1.6 christos 269 1.1.1.6 christos if [ -n "$ttl" ] && ! grep -q "^$exname.[[:space:]]*${ttl}[[:space:]]*IN[[:space:]]*$extype" "dig.out.$i.$type.test$n"; then 270 1.1.1.6 christos exit 1 271 1.1.1.6 christos fi 272 1.1.1.6 christos 273 1.1.1.6 christos if [ -n "${neq_ttl}" ] && grep -q "^$exname.[[:space:]]*${neq_ttl}[[:space:]]*IN[[:space:]]*$type" "dig.out.$i.$type.test$n"; then 274 1.1.1.6 christos exit 1 275 1.1.1.6 christos fi 276 1.1.1.6 christos 277 1.1.1.6 christos exit 0 278 1.1.1.6 christos ) 279 1.1.1.6 christos 280 1.1.1.6 christos n=$((n + 1)) 281 1.1.1.6 christos ret=0 282 1.1.1.6 christos echo_i "checking that priority names under the max-types-per-name limit get cached ($n)" 283 1.1.1.6 christos 284 1.1.1.6 christos # Query for NXDOMAIN for items on our priority list - these should get cached 285 1.1.1.6 christos for rrtype in AAAA MX NS; do 286 1.1.1.8 christos check_manytypes 1 manytypes.big "${rrtype}" NOERROR big SOA 120 || ret=1 287 1.1.1.6 christos done 288 1.1.1.6 christos # Wait at least 1 second 289 1.1.1.6 christos for rrtype in AAAA MX NS; do 290 1.1.1.8 christos check_manytypes 2 manytypes.big "${rrtype}" NOERROR big SOA "" 120 || ret=1 291 1.1.1.6 christos done 292 1.1.1.6 christos 293 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 294 1.1.1.6 christos status=$((status + ret)) 295 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 296 1.1.1.6 christos 297 1.1.1.6 christos ns3_flush 298 1.1.1.6 christos 299 1.1.1.6 christos n=$((n + 1)) 300 1.1.1.6 christos ret=0 301 1.1.1.6 christos echo_i "checking that NXDOMAIN names under the max-types-per-name limit get cached ($n)" 302 1.1.1.6 christos 303 1.1.1.6 christos # Query for 10 NXDOMAIN types 304 1.1.1.6 christos for ntype in $(seq 65270 65279); do 305 1.1.1.8 christos check_manytypes 1 manytypes.big "TYPE${ntype}" NOERROR big SOA 120 || ret=1 306 1.1.1.6 christos done 307 1.1.1.6 christos # Wait at least 1 second 308 1.1.1.6 christos sleep 1 309 1.1.1.6 christos # Query for 10 NXDOMAIN types again - these should be cached 310 1.1.1.6 christos for ntype in $(seq 65270 65279); do 311 1.1.1.8 christos check_manytypes 2 manytypes.big "TYPE${ntype}" NOERROR big SOA "" 120 || ret=1 312 1.1.1.6 christos done 313 1.1.1.6 christos 314 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 315 1.1.1.6 christos status=$((status + ret)) 316 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 317 1.1.1.6 christos 318 1.1.1.6 christos n=$((n + 1)) 319 1.1.1.6 christos ret=0 320 1.1.1.6 christos echo_i "checking that existing names under the max-types-per-name limit get cached ($n)" 321 1.1.1.6 christos 322 1.1.1.6 christos # Limited to 10 types - these should be cached and the previous record should be evicted 323 1.1.1.6 christos for ntype in $(seq 65280 65289); do 324 1.1.1.8 christos check_manytypes 1 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" 120 || ret=1 325 1.1.1.6 christos done 326 1.1.1.6 christos # Wait at least one second 327 1.1.1.6 christos sleep 1 328 1.1.1.6 christos # Limited to 10 types - these should be cached 329 1.1.1.6 christos for ntype in $(seq 65280 65289); do 330 1.1.1.8 christos check_manytypes 2 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" "" 120 || ret=1 331 1.1.1.6 christos done 332 1.1.1.6 christos 333 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 334 1.1.1.6 christos status=$((status + ret)) 335 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 336 1.1.1.6 christos 337 1.1.1.6 christos n=$((n + 1)) 338 1.1.1.6 christos ret=0 339 1.1.1.6 christos echo_i "checking that NXDOMAIN names over the max-types-per-name limit don't get cached ($n)" 340 1.1.1.6 christos 341 1.1.1.6 christos # Query for 10 NXDOMAIN types 342 1.1.1.6 christos for ntype in $(seq 65270 65279); do 343 1.1.1.6 christos check_manytypes 1 manytypes.big "TYPE${ntype}" NOERROR big SOA 0 || ret=1 344 1.1.1.6 christos done 345 1.1.1.6 christos # Wait at least 1 second 346 1.1.1.6 christos sleep 1 347 1.1.1.6 christos # Query for 10 NXDOMAIN types again - these should not be cached 348 1.1.1.6 christos for ntype in $(seq 65270 65279); do 349 1.1.1.6 christos check_manytypes 2 manytypes.big "TYPE${ntype}" NOERROR big SOA 0 || ret=1 350 1.1.1.6 christos done 351 1.1.1.6 christos 352 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 353 1.1.1.6 christos status=$((status + ret)) 354 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 355 1.1.1.6 christos 356 1.1.1.6 christos n=$((n + 1)) 357 1.1.1.6 christos ret=0 358 1.1.1.6 christos echo_i "checking that priority NXDOMAIN names over the max-types-per-name limit get cached ($n)" 359 1.1.1.6 christos 360 1.1.1.6 christos # Query for NXDOMAIN for items on our priority list - these should get cached 361 1.1.1.6 christos for rrtype in AAAA MX NS; do 362 1.1.1.8 christos check_manytypes 1 manytypes.big "${rrtype}" NOERROR big SOA 120 || ret=1 363 1.1.1.6 christos done 364 1.1.1.6 christos # Wait at least 1 second 365 1.1.1.6 christos for rrtype in AAAA MX NS; do 366 1.1.1.8 christos check_manytypes 2 manytypes.big "${rrtype}" NOERROR big SOA "" 120 || ret=1 367 1.1.1.6 christos done 368 1.1.1.6 christos 369 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 370 1.1.1.6 christos status=$((status + ret)) 371 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 372 1.1.1.6 christos 373 1.1.1.6 christos n=$((n + 1)) 374 1.1.1.6 christos ret=0 375 1.1.1.6 christos echo_i "checking that priority name over the max-types-per-name get cached ($n)" 376 1.1.1.6 christos 377 1.1.1.6 christos # Query for an item on our priority list - it should get cached 378 1.1.1.8 christos check_manytypes 1 manytypes.big "A" NOERROR manytypes.big A 120 || ret=1 379 1.1.1.6 christos # Wait at least 1 second 380 1.1.1.6 christos sleep 1 381 1.1.1.6 christos # Query the same name again - it should be in the cache 382 1.1.1.8 christos check_manytypes 2 manytypes.big "A" NOERROR big manytypes.A "" 120 || ret=1 383 1.1.1.6 christos 384 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 385 1.1.1.6 christos status=$((status + ret)) 386 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 387 1.1.1.6 christos 388 1.1.1.6 christos ns3_flush 389 1.1.1.6 christos 390 1.1.1.6 christos n=$((n + 1)) 391 1.1.1.6 christos ret=0 392 1.1.1.6 christos echo_i "checking that priority name over the max-types-per-name don't get evicted ($n)" 393 1.1.1.6 christos 394 1.1.1.6 christos # Query for an item on our priority list - it should get cached 395 1.1.1.8 christos check_manytypes 1 manytypes.big "A" NOERROR manytypes.big A 120 || ret=1 396 1.1.1.6 christos # Query for 10 more types - this should not evict A record 397 1.1.1.6 christos for ntype in $(seq 65280 65289); do 398 1.1.1.6 christos check_manytypes 1 manytypes.big "TYPE${ntype}" NOERROR manytypes.big || ret=1 399 1.1.1.6 christos done 400 1.1.1.6 christos # Wait at least 1 second 401 1.1.1.6 christos sleep 1 402 1.1.1.6 christos # Query the same name again - it should be in the cache 403 1.1.1.8 christos check_manytypes 2 manytypes.big "A" NOERROR manytypes.big A "" 120 || ret=1 404 1.1.1.6 christos # This one was first in the list and should have been evicted 405 1.1.1.8 christos check_manytypes 2 manytypes.big "TYPE65280" NOERROR manytypes.big TYPE65280 120 || ret=1 406 1.1.1.6 christos 407 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 408 1.1.1.6 christos status=$((status + ret)) 409 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 410 1.1.1.6 christos 411 1.1.1.6 christos ns3_flush 412 1.1.1.6 christos 413 1.1.1.6 christos n=$((n + 1)) 414 1.1.1.6 christos ret=0 415 1.1.1.6 christos echo_i "checking that non-priority types cause eviction ($n)" 416 1.1.1.6 christos 417 1.1.1.6 christos # Everything on top of that will cause the cache eviction 418 1.1.1.6 christos for ntype in $(seq 65280 65299); do 419 1.1.1.8 christos check_manytypes 1 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" 120 || ret=1 420 1.1.1.6 christos done 421 1.1.1.6 christos # Wait at least one second 422 1.1.1.6 christos sleep 1 423 1.1.1.8 christos # These should have TTL != 120 now 424 1.1.1.6 christos for ntype in $(seq 65290 65299); do 425 1.1.1.8 christos check_manytypes 2 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" "" 120 || ret=1 426 1.1.1.6 christos done 427 1.1.1.6 christos # These should have been evicted 428 1.1.1.6 christos for ntype in $(seq 65280 65289); do 429 1.1.1.8 christos check_manytypes 3 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" 120 || ret=1 430 1.1.1.6 christos done 431 1.1.1.6 christos # These should have been evicted by the previous block 432 1.1.1.6 christos for ntype in $(seq 65290 65299); do 433 1.1.1.8 christos check_manytypes 4 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" 120 || ret=1 434 1.1.1.6 christos done 435 1.1.1.6 christos 436 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 437 1.1.1.6 christos status=$((status + ret)) 438 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 439 1.1.1.6 christos 440 1.1.1.6 christos ns3_flush 441 1.1.1.6 christos 442 1.1.1.6 christos n=$((n + 1)) 443 1.1.1.6 christos ret=0 444 1.1.1.6 christos echo_i "checking that signed names under the max-types-per-name limit get cached ($n)" 445 1.1.1.6 christos 446 1.1.1.6 christos # Go through the 10 items, this should result in 20 items (type + rrsig(type)) 447 1.1.1.6 christos for ntype in $(seq 65280 65289); do 448 1.1.1.8 christos check_manytypes 1 manytypes.signed "TYPE${ntype}" NOERROR manytypes.signed "TYPE${ntype}" 120 || ret=1 449 1.1.1.6 christos done 450 1.1.1.6 christos 451 1.1.1.6 christos # Wait at least one second 452 1.1.1.6 christos sleep 1 453 1.1.1.6 christos 454 1.1.1.8 christos # These should have TTL != 120 now 455 1.1.1.6 christos for ntype in $(seq 65285 65289); do 456 1.1.1.8 christos check_manytypes 2 manytypes.signed "TYPE${ntype}" NOERROR manytypes.signed "TYPE${ntype}" "" 120 || ret=1 457 1.1.1.6 christos done 458 1.1.1.6 christos 459 1.1.1.6 christos # These should have been evicted 460 1.1.1.6 christos for ntype in $(seq 65280 65284); do 461 1.1.1.8 christos check_manytypes 3 manytypes.signed "TYPE${ntype}" NOERROR manytypes.signed "TYPE${ntype}" 120 || ret=1 462 1.1.1.6 christos done 463 1.1.1.6 christos 464 1.1.1.6 christos # These should have been evicted by the previous block 465 1.1.1.6 christos for ntype in $(seq 65285 65289); do 466 1.1.1.8 christos check_manytypes 4 manytypes.signed "TYPE${ntype}" NOERROR manytypes.signed "TYPE${ntype}" 120 || ret=1 467 1.1.1.6 christos done 468 1.1.1.6 christos 469 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 470 1.1.1.6 christos status=$((status + ret)) 471 1.1.1.6 christos if [ $status -ne 0 ]; then exit 1; fi 472 1.1.1.6 christos 473 1.1.1.6 christos n=$((n + 1)) 474 1.1.1.6 christos ret=0 475 1.1.1.6 christos echo_i "checking that lifting the limit will allow everything to get cached ($n)" 476 1.1.1.6 christos 477 1.1.1.6 christos # Lift the limit 478 1.1.1.9 christos cp ns3/named6.conf ns3/named.conf 479 1.1.1.9 christos ns3_reset 480 1.1.1.6 christos 481 1.1.1.6 christos for ntype in $(seq 65280 65534); do 482 1.1.1.8 christos check_manytypes 1 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" 120 || ret=1 483 1.1.1.6 christos done 484 1.1.1.6 christos # Wait at least one second 485 1.1.1.6 christos sleep 1 486 1.1.1.6 christos for ntype in $(seq 65280 65534); do 487 1.1.1.8 christos check_manytypes 2 manytypes.big "TYPE${ntype}" NOERROR manytypes.big "TYPE${ntype}" "" 120 || ret=1 488 1.1.1.6 christos done 489 1.1.1.6 christos 490 1.1.1.6 christos if [ $ret -ne 0 ]; then echo_i "failed"; fi 491 1.1.1.6 christos status=$((status + ret)) 492 1.1.1.6 christos 493 1.1 christos echo_i "exit status: $status" 494 1.1 christos [ $status -eq 0 ] || exit 1 495