]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt41269] additional tests for dig and delv,
authorCurtis Blackburn <ckb@isc.org>
Tue, 15 Dec 2015 19:58:28 +0000 (11:58 -0800)
committerCurtis Blackburn <ckb@isc.org>
Tue, 15 Dec 2015 19:58:28 +0000 (11:58 -0800)
              fix for --disable-ipv6 on osx,
              fixes for tests with --disable-ipv6

bin/tests/system/conf.sh.in
bin/tests/system/digdelv/tests.sh
bin/tests/system/reclimit/tests.sh
bin/tests/system/staticstub/tests.sh
lib/isc/tests/socket_test.c
lib/isc/unix/net.c

index 43716c034c1f5156275206d75d12ebecfa7587d8..4ab0f91aab1056296d4ac94538a4164a4dce736c 100644 (file)
@@ -101,6 +101,13 @@ else
        TESTSOCK6=false
 fi
 
+if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then
+        TESTSOCK6="$TESTSOCK6"
+else
+        TESTSOCK6=false
+fi
+
+
 PYTHON=@PYTHON@
 
 #
index e33b04c6584ea15c85ba18cfe85aad19bdea222f..7974df0b17142b6128b7bc1ff0fdaed1038e8bee 100644 (file)
@@ -179,6 +179,65 @@ if [ -x ${DIG} ] ; then
   grep "^weeks.example.                1814400" < dig.out.test$n > /dev/null || ret=1
   if [ $ret != 0 ]; then echo "I:failed"; fi
   status=`expr $status + $ret`
+  
+  n=`expr $n + 1`
+  echo "I:checking dig -6 -4 ($n)"
+  ret=0
+  $DIG $DIGOPTS +tcp @10.53.0.2 -4 -6 A a.example > dig.out.test$n 2>&1 && ret=1
+  grep "only one of -4 and -6 allowed" < dig.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi
+  status=`expr $status + $ret`
+  
+  n=`expr $n + 1`
+  echo "I:checking dig @IPv6addr -4 A a.example ($n)"
+  if $TESTSOCK6 fd92:7065:b8e:ffff::2
+  then
+    ret=0
+    $DIG $DIGOPTS +tcp @fd92:7065:b8e:ffff::2 -4 A a.example > dig.out.test$n 2>&1 && ret=1
+    grep "address family not supported" < dig.out.test$n > /dev/null || ret=1
+    if [ $ret != 0 ]; then echo "I:failed"; fi
+    status=`expr $status + $ret`
+  else
+    echo "I:IPv6 unavailable; skipping"
+  fi
+  
+  n=`expr $n + 1`
+  echo "I:checking dig @IPv4addr -6 A a.example ($n)"
+  if $TESTSOCK6 fd92:7065:b8e:ffff::2
+  then
+    ret=0
+    ret=0
+    $DIG $DIGOPTS +tcp @10.53.0.2 -6 A a.example > dig.out.test$n 2>&1 || ret=1
+    grep "SERVER: ::ffff:10.53.0.2#5300" < dig.out.test$n > /dev/null || ret=1
+    if [ $ret != 0 ]; then echo "I:failed"; fi
+    status=`expr $status + $ret`
+  else
+    echo "I:IPv6 unavailable; skipping"
+  fi
+  
+  n=`expr $n + 1`
+  echo "I:checking dig +subnet ($n)"
+  ret=0
+  $DIG $DIGOPTS +tcp @10.53.0.2 +subnet=127.0.0.1 A a.example > dig.out.test$n 2>&1 || ret=1
+  grep "CLIENT-SUBNET: 127.0.0.1/32/0" < dig.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi
+  status=`expr $status + $ret`
+  
+  n=`expr $n + 1`
+  echo "I:checking dig +sp works as an abbriviated form of split ($n)"
+  ret=0
+  $DIG $DIGOPTS @10.53.0.3 +sp=4 -t sshfp foo.example > dig.out.test$n || ret=1
+  grep " 9ABC DEF6 7890 " < dig.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi 
+  status=`expr $status + $ret`
+
+  n=`expr $n + 1`
+  echo "I:checking dig -c works ($n)"
+  ret=0
+  $DIG $DIGOPTS @10.53.0.3 -c CHAOS -t txt version.bind > dig.out.test$n || ret=1
+  grep "version.bind.          0       CH      TXT" < dig.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi 
+  status=`expr $status + $ret`
 
 else
   echo "$DIG is needed, so skipping these dig tests"
@@ -302,6 +361,38 @@ if [ -x ${DELV} ] ; then
   test "${f:-0}" -eq 4 || ret=1
   if [ $ret != 0 ]; then echo "I:failed"; fi
   status=`expr $status + $ret`
+  
+  n=`expr $n + 1`
+  echo "I:checking delv +sp works as an abbriviated form of split ($n)"
+  ret=0
+  $DELV $DELVOPTS @10.53.0.3 +sp=4 -t sshfp foo.example > delv.out.test$n || ret=1
+  grep " 9ABC DEF6 7890 " < delv.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi 
+  status=`expr $status + $ret`
+  
+  n=`expr $n + 1`
+  echo "I:checking delv +sh works as an abbriviated form of short ($n)"
+  ret=0
+  $DELV $DELVOPTS @10.53.0.3 +sh a a.example > delv.out.test$n || ret=1
+  if test `wc -l < delv.out.test$n` != 1 ; then ret=1 ; fi
+  if [ $ret != 0 ]; then echo "I:failed"; fi 
+  status=`expr $status + $ret`
+
+  n=`expr $n + 1`
+  echo "I:checking delv -c IN works ($n)"
+  ret=0
+  $DELV $DELVOPTS @10.53.0.3 -c IN -t a a.example > delv.out.test$n || ret=1
+  grep "a.example." < delv.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi 
+  status=`expr $status + $ret`
+
+  n=`expr $n + 1`
+  echo "I:checking delv -c CH is ignored, and treated like IN ($n)"
+  ret=0
+  $DELV $DELVOPTS @10.53.0.3 -c CH -t a a.example > delv.out.test$n || ret=1
+  grep "a.example." < delv.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi 
+  status=`expr $status + $ret`
 
   exit $status
 else
index eee69febcaa0b7c21ca7e78cd72f163f3065c9c8..50f9b16ff0de06584e685aca87b03ba35adbf86f 100644 (file)
@@ -31,7 +31,12 @@ $DIG $DIGOPTS @10.53.0.3 indirect1.example.org > dig.out.1.test$n || ret=1
 grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -eq 26 ] || ret=1
+if $TESTSOCK6 != false
+then
+  [ $count -eq 26 ] || { ret=1; echo "I: count ($count) != 26"; }
+else
+  [ $count -eq 14 ] || { ret=1; echo "I: count ($count) != 14"; }
+fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -45,7 +50,12 @@ $DIG $DIGOPTS @10.53.0.3 indirect2.example.org > dig.out.1.test$n || ret=1
 grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -eq 49 ] || ret=1
+if $TESTSOCK6 != false
+then
+  [ $count -eq 49 ] || { ret=1; echo "I: count ($count) != 49"; }
+else
+  [ $count -eq 26 ] || { ret=1; echo "I: count ($count) != 26"; }
+fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -64,7 +74,12 @@ $DIG $DIGOPTS @10.53.0.3 indirect3.example.org > dig.out.1.test$n || ret=1
 grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -eq 12 ] || ret=1
+if $TESTSOCK6 != false
+then
+  [ $count -eq 12 ] || { ret=1; echo "I: count ($count) != 12"; }
+else
+  [ $count -eq 7 ] || { ret=1; echo "I: count ($count) != 7"; }
+fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -78,7 +93,12 @@ $DIG $DIGOPTS @10.53.0.3 indirect4.example.org > dig.out.1.test$n || ret=1
 grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -eq 21 ] || ret=1
+if $TESTSOCK6 != false
+then
+  [ $count -eq 21 ] || { ret=1; echo "I: count ($count) != 21"; }
+else
+  [ $count -eq 12 ] || { ret=1; echo "I: count ($count) != 12"; }
+fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -94,10 +114,13 @@ echo "13" > ans2/ans.limit
 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 flush 2>&1 | sed 's/^/I:ns1 /'
 $DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
 $DIG $DIGOPTS @10.53.0.3 indirect5.example.org > dig.out.1.test$n || ret=1
-grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
+if $TESTSOCK6 != false
+then
+  grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
+fi
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -le 50 ] || ret=1
+[ $count -le 50 ] || { ret=1; echo "I: count ($count) !<= 50"; }
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -111,7 +134,7 @@ $DIG $DIGOPTS @10.53.0.3 indirect6.example.org > dig.out.1.test$n || ret=1
 grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -le 50 ] || ret=1
+[ $count -le 50 ] || { ret=1; echo "I: count ($count) !<= 50"; }
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -127,10 +150,13 @@ echo "10" > ans2/ans.limit
 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 flush 2>&1 | sed 's/^/I:ns1 /'
 $DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
 $DIG $DIGOPTS @10.53.0.3 indirect7.example.org > dig.out.1.test$n || ret=1
-grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
+if $TESTSOCK6 != false
+then
+  grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
+fi
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -le 40 ] || ret=1
+[ $count -le 40 ] || { ret=1; echo "I: count ($count) !<= 40"; }
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -144,7 +170,7 @@ $DIG $DIGOPTS @10.53.0.3 indirect8.example.org > dig.out.1.test$n || ret=1
 grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
 $DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
 eval count=`cat dig.out.2.test$n`
-[ $count -le 40 ] || ret=1
+[ $count -le 40 ] || { ret=1; echo "I: count ($count) !<= 40"; }
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -159,7 +185,7 @@ eval count=`cat dig.out.2.test$n`
 [ $count -lt 50 ] || ret=1
 $DIG $DIGOPTS +short @10.53.0.7 count txt > dig.out.3.test$n || ret=1
 eval count=`cat dig.out.3.test$n`
-[ $count -lt 50 ] || ret=1
+[ $count -lt 50 ] || { ret=1; echo "I: count ($count) !<= 50";  }
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
index 0abc308d7b6b345f81a585179d14e74a37f24793..edb2aa5f48a8d90ee0e177d57f353c71775bd622 100755 (executable)
@@ -162,7 +162,7 @@ n=`expr $n + 1`
 # 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 $PERL ../testsock6.pl ::1 2> /dev/null
+if $TESTSOCK6 ../testsock6.pl ::1 2> /dev/null
 then
     echo "I:checking IPv6 static-stub address ($n)"
     ret=0
index 8e84364732488f40dcb1fe8c3f3be1051628e3d8..49453ea7edae4154fa149d91b1ef7a5be930b3ba 100644 (file)
@@ -14,8 +14,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id$ */
-
 /*! \file */
 
 #include <config.h>
@@ -25,6 +23,7 @@
 #include <unistd.h>
 #include <time.h>
 
+#include <isc/platform.h>
 #include <isc/socket.h>
 #include <isc/print.h>
 
@@ -431,6 +430,7 @@ ATF_TC_HEAD(udp_dscp_v6, tc) {
        atf_tc_set_md_var(tc, "descr", "udp dscp ipv6");
 }
 ATF_TC_BODY(udp_dscp_v6, tc) {
+#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6)
        isc_result_t result;
        isc_sockaddr_t addr1, addr2;
        struct in6_addr in6;
@@ -526,6 +526,10 @@ ATF_TC_BODY(udp_dscp_v6, tc) {
        isc_socket_detach(&s2);
 
        isc_test_end();
+#else
+       UNUSED(tc);
+       atf_tc_skip("IPv6 not available");
+#endif
 }
 
 /* Test TCP sendto/recv (IPv4) */
@@ -632,6 +636,7 @@ ATF_TC_HEAD(tcp_dscp_v6, tc) {
        atf_tc_set_md_var(tc, "descr", "tcp dscp ipv6");
 }
 ATF_TC_BODY(tcp_dscp_v6, tc) {
+#ifdef ISC_PLATFORM_HAVEIPV6
        isc_result_t result;
        isc_sockaddr_t addr1;
        struct in6_addr in6;
@@ -730,6 +735,10 @@ ATF_TC_BODY(tcp_dscp_v6, tc) {
        isc_socket_detach(&s3);
 
        isc_test_end();
+#else
+       UNUSED(tc);
+       atf_tc_skip("IPv6 not available");
+#endif
 }
 
 ATF_TC(net_probedscp);
index 9bcd1892258b5e8b76f9d27802a7dd01a3c2a2c2..4329395f1de0b042abc629925ad4af82c5214e3c 100644 (file)
@@ -110,13 +110,21 @@ const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT;
 
 # if defined(WANT_IPV6)
 static isc_once_t      once_ipv6only = ISC_ONCE_INIT;
-# endif
 
-# if defined(ISC_PLATFORM_HAVEIN6PKTINFO)
+#  if defined(ISC_PLATFORM_HAVEIN6PKTINFO)
 static isc_once_t      once_ipv6pktinfo = ISC_ONCE_INIT;
-# endif
+#  endif
+# endif /* WANT_IPV6 */
 #endif /* ISC_PLATFORM_HAVEIPV6 */
 
+#ifndef ISC_CMSG_IP_TOS
+#ifdef __APPLE__
+#define ISC_CMSG_IP_TOS 0      /* As of 10.8.2. */
+#else /* ! __APPLE__ */
+#define ISC_CMSG_IP_TOS 1
+#endif /* ! __APPLE__ */
+#endif /* ! ISC_CMSG_IP_TOS */
+
 static isc_once_t      once = ISC_ONCE_INIT;
 static isc_once_t      once_dscp = ISC_ONCE_INIT;
 
@@ -408,6 +416,9 @@ isc_net_probe_ipv6pktinfo(void) {
        return (ipv6pktinfo_result);
 }
 
+#if ISC_CMSG_IP_TOS || \
+    defined(ISC_NET_BSD44MSGHDR) && defined(IPV6_TCLASS) && defined(WANT_IPV6)
+
 static inline ISC_SOCKADDR_LEN_T
 cmsg_len(ISC_SOCKADDR_LEN_T len) {
 #ifdef CMSG_LEN
@@ -613,6 +624,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) {
        return (ISC_TRUE);
 }
 #endif
+#endif
 
 static void
 try_dscp_v4(void) {
@@ -664,14 +676,6 @@ try_dscp_v4(void) {
 
 #ifdef ISC_NET_BSD44MSGHDR
 
-#ifndef ISC_CMSG_IP_TOS
-#ifdef __APPLE__
-#define ISC_CMSG_IP_TOS 0      /* As of 10.8.2. */
-#else /* ! __APPLE__ */
-#define ISC_CMSG_IP_TOS 1
-#endif /* ! __APPLE__ */
-#endif /* ! ISC_CMSG_IP_TOS */
-
 #if ISC_CMSG_IP_TOS
        if (cmsgsend(s, IPPROTO_IP, IP_TOS, res0))
                dscp_result |= ISC_NET_DSCPPKTV4;