#
# Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
status=0
n=0
DIGOPTS="+tcp +short -p 5300 @10.53.0.2"
DIGOPTS6="+tcp +short -p 5300 @fd92:7065:b8e:ffff::2"
n=`expr $n + 1`
echo "I:checking GeoIP country database by code ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP country database by code (using client subnet) ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking response scope using client subnet ($n)"
ret=0
$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
$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
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP country database by three-letter code ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP country database by name ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP region code, no specified database ($n)"
ret=0
lret=0
# skipping 2 on purpose here; it has the same region code as 1
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP region database by region name and country code ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP region database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
then
n=`expr $n + 1`
echo "I:checking GeoIP city database by city name using IPv6 ($n)"
ret=0
$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
else
echo "I:IPv6 unavailable; skipping"
fi
n=`expr $n + 1`
echo "I:checking GeoIP city database by city name ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP city database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP isp database ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP isp database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP org database ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP org database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP asnum database ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP asnum database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP asnum database - ASNNNN only ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP asnum database - ASNNNN only (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP domain database ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP domain database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP netspeed database ($n)"
ret=0
lret=0
done
n=`expr $n + 1`
echo "I:checking GeoIP netspeed database (using client subnet) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP blackhole ACL ($n)"
ret=0
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking GeoIP country database by code (using nested ACLs) ($n)"
ret=0
lret=0
done
echo "I:reloading server"
sleep 3
n=`expr $n + 1`
echo "I:checking geoip-use-ecs ($n)"
ret=0
lret=0
$DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.ecs.$i || lret=1
done
n=`expr $n + 1`
echo "I:reloading server with different geoip-directory ($n)"
sleep 3
awk '/using "..\/data2" as GeoIP directory/ {m=1} ; { if (m>0) { print } }' ns2/named.run | grep "GeoIP City .* DB not available" > /dev/null || ret=1
n=`expr $n + 1`
ret=0
fi
n=`expr $n + 1`
echo "I:checking other GeoIP options are parsed correctly ($n)"
ret=0
echo "I:exit status: $status"