501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt#!/bin/sh
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt#
27424c351db1b1ee96848956cf314025f727d1deTinderbox User# Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan HuntSYSTEMTESTTOP=..
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt. $SYSTEMTESTTOP/conf.sh
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntrm -f dig.out.*
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan HuntDIGOPTS="+tcp +short -p 5300 @10.53.0.2"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan HuntDIGOPTS6="+tcp +short -p 5300 @fd92:7065:b8e:ffff::2"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by code ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP country database by code (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
c968a257c1ed1007307cb9b1757f70bbe45da79aMark Andrews $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking response scope using client subnet ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt$DIG +tcp -p5300 @10.53.0.2 txt example -b 127.0.0.1 +subnet="10.53.0.1/32" > dig.out.ns2.test$n.1 || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntgrep 'CLIENT-SUBNET.*10.53.0.1/32/32' dig.out.ns2.test$n.1 > /dev/null || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt$DIG +tcp -p5300 @10.53.0.2 txt example -b 127.0.0.1 +subnet="192.0.2.64/32" > dig.out.ns2.test$n.2 || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntgrep 'CLIENT-SUBNET.*192.0.2.64/32/24' dig.out.ns2.test$n.2 > /dev/null || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named2.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by three-letter code ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named3.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by name ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named4.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP region code, no specified database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt# skipping 2 on purpose here; it has the same region code as 1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named5.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP region database by region name and country code ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP region database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named6.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntif $TESTSOCK6 fd92:7065:b8e:ffff::3
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntthen
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt n=`expr $n + 1`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt echo "I:checking GeoIP city database by city name using IPv6 ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt ret=0
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt $DIG +tcp +short -p 5300 @fd92:7065:b8e:ffff::1 -6 txt example -b fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt [ $ret -eq 0 ] || echo "I:failed"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt status=`expr $status + $ret`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntelse
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt echo "I:IPv6 unavailable; skipping"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntfi
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP city database by city name ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP city database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named7.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP isp database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP isp database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named8.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP org database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP org database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named9.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP asnum database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP asnum database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named10.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntecho "I:checking GeoIP asnum database - ASNNNN only ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4 5 6 7; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:checking GeoIP asnum database - ASNNNN only (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntcp -f ns2/named11.conf ns2/named.conf
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntsleep 3
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntn=`expr $n + 1`
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntecho "I:checking GeoIP domain database ($n)"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntret=0
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntlret=0
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntfor i in 1 2 3 4 5 6 7; do
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt [ "$i" = "$j" ] || lret=1
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt [ $lret -eq 1 ] && break
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntdone
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt[ $lret -eq 1 ] && ret=1
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntstatus=`expr $status + $ret`
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntn=`expr $n + 1`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:checking GeoIP domain database (using client subnet) ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntret=0
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntlret=0
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntfor i in 1 2 3 4 5 6 7; do
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt [ "$i" = "$j" ] || lret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt [ $lret -eq 1 ] && break
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntdone
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt[ $lret -eq 1 ] && ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntstatus=`expr $status + $ret`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntecho "I:reloading server"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntcp -f ns2/named12.conf ns2/named.conf
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntsleep 3
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP netspeed database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntlret=0
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntfor i in 1 2 3 4; do
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ "$i" = "$j" ] || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt [ $lret -eq 1 ] && break
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntdone
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $lret -eq 1 ] && ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntstatus=`expr $status + $ret`
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP netspeed database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Huntecho "I:reloading server"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntcp -f ns2/named13.conf ns2/named.conf
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Huntsleep 3
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP blackhole ACL ($n)"
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Huntret=0
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt$DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n || ret=1
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 status 2>&1 > rndc.out.ns2.test$n || ret=1
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Huntstatus=`expr $status + $ret`
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:reloading server"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntcp -f ns2/named14.conf ns2/named.conf
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntsleep 3
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntn=`expr $n + 1`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by code (using nested ACLs) ($n)"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntret=0
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntlret=0
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntfor i in 1 2 3 4 5 6 7; do
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt [ "$i" = "$j" ] || lret=1
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt [ $lret -eq 1 ] && break
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntdone
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt[ $lret -eq 1 ] && ret=1
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt[ $ret -eq 0 ] || echo "I:failed"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntstatus=`expr $status + $ret`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:reloading server"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntcp -f ns2/named14.conf ns2/named.conf
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntsleep 3
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntn=`expr $n + 1`
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking geoip-use-ecs ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntlret=0
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntfor i in 1 2 3 4 5 6 7; do
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$i" = "$j" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.ecs.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt j=`cat dig.out.ns2.test$n.ecs.$i | tr -d '"'`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ "$j" = "bogus" ] || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt [ $lret -eq 1 ] && break
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntdone
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $lret -eq 1 ] && ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntstatus=`expr $status + $ret`
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntn=`expr $n + 1`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:reloading server with different geoip-directory ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntcp -f ns2/named15.conf ns2/named.conf
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntsleep 3
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntawk '/using "..\/data2" as GeoIP directory/ {m=1} ; { if (m>0) { print } }' ns2/named.run | grep "GeoIP City .* DB not available" > /dev/null || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntstatus=`expr $status + $ret`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntn=`expr $n + 1`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:checking GeoIP v4/v6 when only IPv6 database is available ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntret=0
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt$DIG $DIGOPTS -4 txt example -b 10.53.0.2 > dig.out.ns2.test$n.1 || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntj=`cat dig.out.ns2.test$n.1 | tr -d '"'`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt[ "$j" = "bogus" ] || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntif $TESTSOCK6 fd92:7065:b8e:ffff::2; then
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt $DIG $DIGOPTS6 txt example -b fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n.2 || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt j=`cat dig.out.ns2.test$n.2 | tr -d '"'`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt [ "$j" = "2" ] || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntfi
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntstatus=`expr $status + $ret`
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt
fbed5f0f44515f5b3ca499a3466c875507852970Evan Huntn=`expr $n + 1`
fbed5f0f44515f5b3ca499a3466c875507852970Evan Huntecho "I:checking other GeoIP options are parsed correctly ($n)"
fbed5f0f44515f5b3ca499a3466c875507852970Evan Huntret=0
fbed5f0f44515f5b3ca499a3466c875507852970Evan Hunt$CHECKCONF options.conf || ret=1
fbed5f0f44515f5b3ca499a3466c875507852970Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
fbed5f0f44515f5b3ca499a3466c875507852970Evan Huntstatus=`expr $status + $ret`
fbed5f0f44515f5b3ca499a3466c875507852970Evan Hunt
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:exit status: $status"
3635d8f9104e70e141a8f191a0e6c1502ceed2f3Mark Andrews[ $status -eq 0 ] || exit 1