# PERL will be an empty string if no perl interpreter was found.
PERL=@PERL@
-if test -n "$PERL"
-then
- if $PERL -e "use IO::Socket::INET6;" 2> /dev/null
+testsock6() {
+ if test -n "$PERL" \
+ && $PERL -e "use IO::Socket::INET6;" 2> /dev/null \
+ && grep "^#define WANT_IPV6 1" "$TOP/config.h" > /dev/null 2>&1
then
- TESTSOCK6="$PERL $TOP/bin/tests/system/testsock6.pl"
+ $PERL "$TOP/bin/tests/system/testsock6.pl" "$@"
else
- TESTSOCK6=false
+ false
fi
-else
- TESTSOCK6=false
-fi
-
-if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then
- TESTSOCK6="$TESTSOCK6"
-else
- TESTSOCK6=false
-fi
+}
# Windows process management leave empty
PSSUSPEND=
export SAMPLEUPDATE
export SIGNER
export SUBDIRS
-export TESTSOCK6
XMLLINT=/usr/bin/xmllint
PERL=/usr/bin/perl
-if test -n "$PERL"
-then
- if $PERL -e "use IO::Socket::INET6;" 2> /dev/null
+testsock6() {
+ if test -n "$PERL" \
+ && $PERL -e "use IO::Socket::INET6;" 2> /dev/null \
+ && grep "^#define WANT_IPV6 1" "$TOP/config.h" > /dev/null 2>&1
then
- TESTSOCK6="$PERL $TOP/bin/tests/system/testsock6.pl"
+ $PERL "$TOP/bin/tests/system/testsock6.pl" "$@"
else
- TESTSOCK6=false
+ false
fi
-else
- TESTSOCK6=false
-fi
-
-if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then
- TESTSOCK6="$TESTSOCK6"
-else
- TESTSOCK6=false
-fi
+}
#
# PsSuspend is part of PSTools and can be downloaded from
export SAMPLEUPDATE
export SIGNER
export SUBDIRS
-export TESTSOCK6
n=`expr $n + 1`
echo_i "checking dig @IPv6addr -4 A a.example ($n)"
- if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null
+ if testsock6 fd92:7065:b8e:ffff::2 2>/dev/null
then
ret=0
$DIG $DIGOPTS +tcp @fd92:7065:b8e:ffff::2 -4 A a.example > dig.out.test$n 2>&1 && ret=1
n=`expr $n + 1`
echo_i "checking dig @IPv4addr -6 +mapped A a.example ($n)"
- if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null && [ `uname -s` != "OpenBSD" ]
+ if testsock6 fd92:7065:b8e:ffff::2 2>/dev/null && [ "`uname -s`" != "OpenBSD" ]
then
ret=0
ret=0
n=`expr $n + 1`
echo_i "checking dig +tcp @IPv4addr -6 +nomapped A a.example ($n)"
- if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null
+ if testsock6 fd92:7065:b8e:ffff::2 2>/dev/null
then
ret=0
ret=0
n=`expr $n + 1`
echo_i "checking dig +notcp @IPv4addr -6 +nomapped A a.example ($n)"
- if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null
+ if testsock6 fd92:7065:b8e:ffff::2 2>/dev/null
then
ret=0
ret=0
n=`expr $n + 1`
echo_i "checking delv with IPv6 on IPv4 does not work ($n)"
- if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null
+ if testsock6 fd92:7065:b8e:ffff::3 2>/dev/null
then
ret=0
# following should fail because @IPv4 overrides earlier @IPv6 above
n=`expr $n + 1`
echo_i "checking delv with IPv4 on IPv6 does not work ($n)"
- if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null
+ if testsock6 fd92:7065:b8e:ffff::3 2>/dev/null
then
ret=0
# following should fail because @IPv6 overrides earlier @IPv4 above
n=`expr $n + 1`
echo_i "checking that AAAA is returned when both AAAA and A record exists, unsigned over IPv6 ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::1
+if testsock6 fd92:7065:b8e:ffff::1
then
ret=0
$DIG $DIGOPTS aaaa dual.unsigned -b fd92:7065:b8e:ffff::1 @fd92:7065:b8e:ffff::1 > dig.out.ns1.test$n || ret=1
n=`expr $n + 1`
echo_i "checking that AAAA is included in additional section, qtype=MX, unsigned, over IPv6 ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::1
+if testsock6 fd92:7065:b8e:ffff::1
then
ret=0
$DIG $DIGOPTS +add +dnssec mx unsigned -b fd92:7065:b8e:ffff::1 @fd92:7065:b8e:ffff::1 > dig.out.ns1.test$n || ret=1
n=`expr $n + 1`
echo_i "checking that AAAA is returned when both AAAA and A record exists, unsigned over IPv6 with break-dnssec ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::4
+if testsock6 fd92:7065:b8e:ffff::4
then
ret=0
$DIG $DIGOPTS aaaa dual.unsigned -b fd92:7065:b8e:ffff::4 @fd92:7065:b8e:ffff::4 > dig.out.ns4.test$n || ret=1
n=`expr $n + 1`
echo_i "checking that AAAA is included in additional section, qtype=MX, unsigned, over IPv6, with break-dnssec ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::4
+if testsock6 fd92:7065:b8e:ffff::4
then
ret=0
$DIG $DIGOPTS +add +dnssec mx unsigned -b fd92:7065:b8e:ffff::4 @fd92:7065:b8e:ffff::4 > dig.out.ns4.test$n || ret=1
n=`expr $n + 1`
echo_i "checking that AAAA is returned when both AAAA and A record exists, unsigned over IPv6, recursive ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::2
+if testsock6 fd92:7065:b8e:ffff::2
then
ret=0
$DIG $DIGOPTS aaaa dual.unsigned -b fd92:7065:b8e:ffff::2 @fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n || ret=1
status=`expr $status + $ret`
n=`expr $n + 1`
-echo_i "checking that AAAA is included in additional section, qtype=MX, unsigned, over IPv6 ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::2
+echo_i "checking that AAAA is included in additional section, qtype=MX, unsigned, recursive, over IPv6 ($n)"
+if testsock6 fd92:7065:b8e:ffff::2
then
ret=0
$DIG $DIGOPTS +add +dnssec mx unsigned -b fd92:7065:b8e:ffff::2 @fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n || ret=1
n=`expr $n + 1`
echo_i "checking that AAAA is returned when both AAAA and A record exists, unsigned over IPv6, recursive with break-dnssec ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
ret=0
$DIG $DIGOPTS aaaa dual.unsigned -b fd92:7065:b8e:ffff::3 @fd92:7065:b8e:ffff::3 > dig.out.ns3.test$n || ret=1
n=`expr $n + 1`
echo_i "checking that AAAA is included in additional section, qtype=MX, unsigned, over IPv6, recursive with break-dnssec ($n)"
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
ret=0
$DIG $DIGOPTS +add +dnssec mx unsigned -b fd92:7065:b8e:ffff::3 @fd92:7065:b8e:ffff::3 > dig.out.ns3.test$n || ret=1
echo_i "skipped."
fi
-$TESTSOCK6 fd92:7065:b8e:ffff::1 || {
- echo_i "IPv6 address not configured; skipping IPv6 query tests"
- echo_i "exit status: $status"
- exit $status
-}
+if ! testsock6 fd92:7065:b8e:ffff::1
+then
+ echo_i "IPv6 address not configured; skipping IPv6 query tests"
+ echo_i "exit status: $status"
+ exit $status
+fi
# Reconfiguring for IPv6 tests
echo_i "reconfiguring servers"
$RNDCCMD 10.53.0.2 reload 2>&1 | sed 's/^/ns2 /' | cat_i
sleep 3
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking GeoIP city database by city name using IPv6 ($n)"
$DIG $DIGOPTS -4 txt example -b 10.53.0.2 > dig.out.ns2.test$n.1 || ret=1
j=`cat dig.out.ns2.test$n.1 | tr -d '"'`
[ "$j" = "bogus" ] || ret=1
-if $TESTSOCK6 fd92:7065:b8e:ffff::2; then
+if testsock6 fd92:7065:b8e:ffff::2; then
$DIG $DIGOPTS6 txt example -b fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n.2 || ret=1
j=`cat dig.out.ns2.test$n.2 | tr -d '"'`
[ "$j" = "2" ] || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking Country database by code using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking Country database with nested ACLs using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking Country database by name using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking Country database by continent code using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking City database by region code using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking City database by city name using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking ISP database using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking ASN database by org name using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking ASN database, ASNNNN only, using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking ASN database, NNNN only, using IPv6 ($n)"
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
-if $TESTSOCK6 fd92:7065:b8e:ffff::3
+if testsock6 fd92:7065:b8e:ffff::3
then
n=`expr $n + 1`
echo_i "checking Domain database using IPv6 ($n)"
# Note: for a short term workaround we use ::1, assuming it's configured and
# usable for our tests. We should eventually use the test ULA and available
# checks introduced in change 2916.
-if $TESTSOCK6 ../testsock6.pl ::1 2> /dev/null
+if testsock6 ::1
then
echo_i "checking IPv6 static-stub address ($n)"
ret=0