]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3260. [bug] "rrset-order cyclic" could appear not to rotate
authorEvan Hunt <each@isc.org>
Wed, 4 Jan 2012 03:12:03 +0000 (03:12 +0000)
committerEvan Hunt <each@isc.org>
Wed, 4 Jan 2012 03:12:03 +0000 (03:12 +0000)
for some query patterns.  [RT #27170/27185]

13 files changed:
CHANGES
bin/named/query.c
bin/tests/system/rrsetorder/dig.out.cyclic.fixed1 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.fixed2 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.fixed3 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.fixed4 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.good1 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.good2 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.good3 [deleted file]
bin/tests/system/rrsetorder/dig.out.cyclic.good4 [deleted file]
bin/tests/system/rrsetorder/ns1/root.db
bin/tests/system/rrsetorder/tests.sh
lib/dns/rbtdb.c

diff --git a/CHANGES b/CHANGES
index c21df012bfb5c3115b487085edd67068c1f229f3..1be4629ddd6c40c03beddc2ebf3cc5dc949dc892 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,7 @@
        --- 9.6-ESV-R6rc1 released ---
 
-3260.  [bug]           "rrset-order cyclic" could appear to not rotate
-                       for some query patterns.  [RT #27170]
+3260.  [bug]           "rrset-order cyclic" could appear not to rotate
+                       for some query patterns.  [RT #27170/27185]
 
 3259.  [bug]           named-compilezone: Suppress "dump zone to <file>"
                        message when writing to stdout. [RT #27109]
index 5c63c9dd4f405c7e9cba6896f0dabbc92663642e..02f753ddb238f7b274811b969b49288283c78f08 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.313.20.32 2011/11/16 09:45:24 marka Exp $ */
+/* $Id: query.c,v 1.313.20.33 2012/01/04 03:12:02 each Exp $ */
 
 /*! \file */
 
@@ -1032,7 +1032,8 @@ query_isduplicate(ns_client_t *client, dns_name_t *name,
        if (name == mname)
                mname = NULL;
 
-       *mnamep = mname;
+       if (mnamep != NULL)
+               *mnamep = mname;
 
        CTRACE("query_isduplicate: false: done");
        return (ISC_FALSE);
@@ -1273,6 +1274,8 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
                        if (sigrdataset == NULL)
                                goto addname;
                }
+               if (query_isduplicate(client, fname, dns_rdatatype_a, NULL))
+                       goto aaaa_lookup;
                result = dns_db_findrdataset(db, node, version,
                                             dns_rdatatype_a, 0,
                                             client->now, rdataset,
@@ -1316,6 +1319,9 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
                                        dns_rdataset_disassociate(sigrdataset);
                        }
                }
+  aaaa_lookup:
+               if (query_isduplicate(client, fname, dns_rdatatype_aaaa, NULL))
+                       goto addname;
                result = dns_db_findrdataset(db, node, version,
                                             dns_rdatatype_aaaa, 0,
                                             client->now, rdataset,
@@ -1481,7 +1487,13 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
        dns_rdatatype_t type;
        dns_rdatasetadditional_t additionaltype;
 
-       if (qtype != dns_rdatatype_a) {
+       /*
+        * If we don't have an additional cache call query_addadditional.
+        */
+       client = additionalctx->client;
+       REQUIRE(NS_CLIENT_VALID(client));
+
+       if (qtype != dns_rdatatype_a || client->view->acache == NULL) {
                /*
                 * This function is optimized for "address" types.  For other
                 * types, use a generic routine.
@@ -1495,8 +1507,6 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
         * Initialization.
         */
        rdataset_base = additionalctx->rdataset;
-       client = additionalctx->client;
-       REQUIRE(NS_CLIENT_VALID(client));
        eresult = ISC_R_SUCCESS;
        fname = NULL;
        rdataset = NULL;
@@ -1749,6 +1759,9 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
        if (sigrdataset == NULL)
                goto cleanup;
 
+       if (additionaltype == dns_rdatasetadditional_fromcache &&
+           query_isduplicate(client, fname, dns_rdatatype_a, NULL))
+               goto aaaa_lookup;
        /*
         * Find A RRset with sig RRset.  Even if we don't find a sig RRset
         * for a client using DNSSEC, we'll continue the process to make a
@@ -1793,6 +1806,10 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
                }
        }
 
+ aaaa_lookup:
+       if (additionaltype == dns_rdatasetadditional_fromcache &&
+           query_isduplicate(client, fname, dns_rdatatype_aaaa, NULL))
+               goto foundcache;
        /* Find AAAA RRset with sig RRset */
        result = dns_db_findrdataset(db, node, version, dns_rdatatype_aaaa,
                                     0, client->now, rdataset, sigrdataset);
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.fixed1 b/bin/tests/system/rrsetorder/dig.out.cyclic.fixed1
deleted file mode 100644 (file)
index c25c756..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.4
-1.2.3.3
-1.2.3.2
-1.2.3.1
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.fixed2 b/bin/tests/system/rrsetorder/dig.out.cyclic.fixed2
deleted file mode 100644 (file)
index e8deb67..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.3
-1.2.3.2
-1.2.3.1
-1.2.3.4
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.fixed3 b/bin/tests/system/rrsetorder/dig.out.cyclic.fixed3
deleted file mode 100644 (file)
index 3b27693..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.2
-1.2.3.1
-1.2.3.4
-1.2.3.3
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.fixed4 b/bin/tests/system/rrsetorder/dig.out.cyclic.fixed4
deleted file mode 100644 (file)
index d2ca6fc..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.1
-1.2.3.4
-1.2.3.3
-1.2.3.2
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.good1 b/bin/tests/system/rrsetorder/dig.out.cyclic.good1
deleted file mode 100644 (file)
index c272c75..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.1
-1.2.3.2
-1.2.3.3
-1.2.3.4
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.good2 b/bin/tests/system/rrsetorder/dig.out.cyclic.good2
deleted file mode 100644 (file)
index 6a39e3f..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.2
-1.2.3.3
-1.2.3.4
-1.2.3.1
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.good3 b/bin/tests/system/rrsetorder/dig.out.cyclic.good3
deleted file mode 100644 (file)
index 6082a25..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.3
-1.2.3.4
-1.2.3.1
-1.2.3.2
diff --git a/bin/tests/system/rrsetorder/dig.out.cyclic.good4 b/bin/tests/system/rrsetorder/dig.out.cyclic.good4
deleted file mode 100644 (file)
index a5530c6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-1.2.3.4
-1.2.3.1
-1.2.3.2
-1.2.3.3
index dd2f08f444c98eea5f991ea7dfe2951c2d5e7429..8970d1ac63f6ce39bbf4a224121bc1ba0e9c39f1 100644 (file)
@@ -12,7 +12,7 @@
 ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 ; PERFORMANCE OF THIS SOFTWARE.
 
-; $Id: root.db,v 1.4 2007/06/19 23:47:05 tbox Exp $
+; $Id: root.db,v 1.4.332.1 2012/01/04 03:12:03 each Exp $
 
 $TTL 3600
 .                       SOA    hostmaster.isc.org. a.root-servers.nil. (
@@ -22,7 +22,8 @@ $TTL 3600
                                1200
                                600 )
 .                       NS      a.root-servers.nil.
-a.root-servers.nil     A       10.53.0.1
+.                       NS      cyclic.example.
+a.root-servers.nil.    A       10.53.0.1
 ;
 fixed.example.         A       1.2.3.4
 fixed.example.         A       1.2.3.3
@@ -38,3 +39,8 @@ cyclic.example.               A       1.2.3.4
 cyclic.example.                A       1.2.3.3
 cyclic.example.                A       1.2.3.2
 cyclic.example.                A       1.2.3.1
+;
+cyclic2.example.       A       1.2.3.4
+cyclic2.example.       A       1.2.3.3
+cyclic2.example.       A       1.2.3.2
+cyclic2.example.       A       1.2.3.1
index 8d8bc5878fd741e20f8a7bad6278795d1cc612de..6825a682dbbe66bb385d1725350598f2089533cb 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2006-2008, 2011  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2006-2008  Internet Systems Consortium, Inc. ("ISC")
 #
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.8.44.3 2011/12/23 23:45:49 tbox Exp $
+# $Id: tests.sh,v 1.8.44.4 2012/01/04 03:12:03 each Exp $
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
 status=0
-n=0
 
 if grep "^#define DNS_RDATASET_FIXED" $TOP/config.h > /dev/null 2>&1 ; then
         test_fixed=true
@@ -32,65 +31,73 @@ fi
 #
 #
 #
-n=`expr $n + 1`
 if $test_fixed; then
-    echo "I: Checking order fixed (master) ($n)"
+    echo "I: Checking order fixed (master)"
+    ret=0
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     do
-    ret=0
     $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-           -p 5300 @10.53.0.1 fixed.example > dig.out.test$n || ret=1
-    cmp -s dig.out.test$n dig.out.fixed.good || ret=1
-    [ $ret = 0 ] && break
+           -p 5300 @10.53.0.1 fixed.example > dig.out.fixed || ret=1
+    cmp -s dig.out.fixed dig.out.fixed.good || ret=1
     done
     if [ $ret != 0 ]; then echo "I:failed"; fi
     status=`expr $status + $ret`
-else
-    echo "I: Skipped: Checking order fixed (master) ($n)"
 fi
 
 #
 #
 #
-n=`expr $n + 1`
-echo "I: Checking order cyclic (master) ($n)"
+echo "I: Checking order cyclic (master + additional)"
 ret=0
-for i in 1 2 3 4
-do
-       eval match$i=0
-done
-for i in a b c d e f g h
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-$DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-       -p 5300 @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
-       match=0
-       for j in 1 2 3 4
-       do
-               if $test_fixed; then
-                       cmp -s dig.out.cyclic dig.out.cyclic.fixed$j && {
-                               eval "match$j=1 match=1";
-                       }
-               else
-                       cmp -s dig.out.cyclic dig.out.cyclic.good$j && {
-                               eval "match$j=1 match=1";
-                       }
-               fi
-               if [ $match -eq 1 ]; then break; fi
-       done
-       if [ $match -eq 0 ]; then ret=1; echo "I:unexpected order"; cat dig.out.cyclic; fi
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic dig.out.$j
+    else
+        cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-match=0
-for i in 1 2 3 4
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
+#
+#
+#
+echo "I: Checking order cyclic (master)"
+ret=0
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-       eval "match=\`expr \$match + \$match$i\`"
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic2 dig.out.$j
+    else
+        cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-echo "I: Cyclic selection return $match of 4 possible orders in 8 samples"
-if [ $match -ne 4 ]; then echo ret=1; fi
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
-
-n=`expr $n + 1`
-echo "I: Checking order random (master) ($n)"
+echo "I: Checking order random (master)"
 ret=0
 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 do
@@ -121,64 +128,74 @@ status=`expr $status + $ret`
 #
 #
 #
-n=`expr $n + 1`
 if $test_fixed; then
-    echo "I: Checking order fixed (slave) ($n)"
+    echo "I: Checking order fixed (slave)"
     ret=0
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     do
     $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-           -p 5300 @10.53.0.2 fixed.example > dig.out.test$n || ret=1
-    cmp -s dig.out.test$n dig.out.fixed.good || ret=1
+           -p 5300 @10.53.0.2 fixed.example > dig.out.fixed || ret=1
+    cmp -s dig.out.fixed dig.out.fixed.good || ret=1
     done
     if [ $ret != 0 ]; then echo "I:failed"; fi
     status=`expr $status + $ret`
-else
-    echo "I: Skipped: Checking order fixed (slave) ($n)"
 fi
 
 #
 #
 #
-n=`expr $n + 1`
-echo "I: Checking order cyclic (slave) ($n)"
+echo "I: Checking order cyclic (slave + additional)"
 ret=0
-for i in 1 2 3 4
-do
-       eval match$i=0
-done
-for i in a b c d e f g h
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-$DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-       -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
-       match=0
-       for j in 1 2 3 4
-       do
-               if $test_fixed; then
-                       cmp -s dig.out.cyclic dig.out.cyclic.fixed$j && {
-                               eval "match$j=1 match=1";
-                       }
-               else
-                       cmp -s dig.out.cyclic dig.out.cyclic.good$j && {
-                               eval "match$j=1 match=1";
-                       }
-               fi
-               if [ $match -eq 1 ]; then break; fi
-       done
-       if [ $match -eq 0 ]; then ret=1; echo "I:unexpected order"; fi
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic dig.out.$j
+    else
+        cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-match=0
-for i in 1 2 3 4
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
+#
+#
+#
+echo "I: Checking order cyclic (slave)"
+ret=0
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-       eval "match=\`expr \$match + \$match$i\`"
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic2 dig.out.$j
+    else
+        cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-echo "I: Cyclic selection return $match of 4 possible orders in 8 samples"
-if [ $match -ne 4 ]; then echo ret=1; fi
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
-n=`expr $n + 1`
-echo "I: Checking order random (slave) ($n)"
+echo "I: Checking order random (slave)"
 ret=0
 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 do
@@ -210,8 +227,7 @@ echo "I: Shutting down slave"
 
 (cd ..; sh stop.sh rrsetorder ns2 )
 
-n=`expr $n + 1`
-echo "I: Checking for slave's on disk copy of zone ($n)"
+echo "I: Checking for slave's on disk copy of zone"
 
 if [ ! -f ns2/root.bk ]
 then
@@ -226,67 +242,74 @@ echo "I: Re-starting slave"
 #
 #
 #
-n=`expr $n + 1`
 if $test_fixed; then
-    echo "I: Checking order fixed (slave loaded from disk) ($n)"
+    echo "I: Checking order fixed (slave loaded from disk)"
+    ret=0
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     do
-    ret=0
     $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-           -p 5300 @10.53.0.2 fixed.example > dig.out.test$n || ret=1
-    cmp -s dig.out.test$n dig.out.fixed.good || ret=1
-    [ $ret = 0 ] && break
-    sleep 1
+           -p 5300 @10.53.0.2 fixed.example > dig.out.fixed || ret=1
+    cmp -s dig.out.fixed dig.out.fixed.good || ret=1
     done
     if [ $ret != 0 ]; then echo "I:failed"; fi
     status=`expr $status + $ret`
-else
-    echo "I: Skipped: Checking order fixed (slave loaded from disk) ($n)"
-
 fi
 
 #
 #
 #
-n=`expr $n + 1`
-echo "I: Checking order cyclic (slave loaded from disk) ($n)"
+echo "I: Checking order cyclic (slave + additional, loaded from disk)"
 ret=0
-for i in 1 2 3 4
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-       eval match$i=0
-done
-for i in a b c d e f g h
-do
-$DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-       -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
-       match=0
-       for j in 1 2 3 4
-       do
-               if $test_fixed; then
-                       cmp -s dig.out.cyclic dig.out.cyclic.fixed$j && {
-                               eval "match$j=1 match=1";
-                       }
-               else
-                       cmp -s dig.out.cyclic dig.out.cyclic.good$j && {
-                               eval "match$j=1 match=1";
-                       }
-               fi
-               if [ $match -eq 1 ]; then break; fi
-       done
-       if [ $match -eq 0 ]; then ret=1; echo "I:unexpected order"; fi
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic dig.out.$j
+    else
+        cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-match=0
-for i in 1 2 3 4
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
+#
+#
+#
+echo "I: Checking order cyclic (slave loaded from disk)"
+ret=0
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-       eval "match=\`expr \$match + \$match$i\`"
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic2 dig.out.$j
+    else
+        cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-echo "I: Cyclic selection return $match of 4 possible orders in 8 samples"
-if [ $match -ne 4 ]; then echo ret=1; fi
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
-n=`expr $n + 1`
-echo "I: Checking order random (slave loaded from disk) ($n)"
+echo "I: Checking order random (slave loaded from disk)"
 ret=0
 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 do
@@ -317,65 +340,80 @@ status=`expr $status + $ret`
 #
 #
 #
-n=`expr $n + 1`
 if $test_fixed; then
-    echo "I: Checking order fixed (cache) ($n)"
+    echo "I: Checking order fixed (cache)"
     ret=0
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     do
     $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-           -p 5300 @10.53.0.3 fixed.example > dig.out.test$n || ret=1
-    cmp -s dig.out.test$n dig.out.fixed.good || ret=1
+           -p 5300 @10.53.0.3 fixed.example > dig.out.fixed || ret=1
+    cmp -s dig.out.fixed dig.out.fixed.good || ret=1
     done
     if [ $ret != 0 ]; then echo "I:failed"; fi
     status=`expr $status + $ret`
-else
-    echo "I: Skipped: Checking order fixed (cache) ($n)"
 fi
 
 #
 #
 #
-n=`expr $n + 1`
-echo "I: Checking order cyclic (cache) ($n)"
+echo "I: Checking order cyclic (cache + additional)"
 ret=0
-for i in 1 2 3 4
+# prime acache
+$DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-       eval match$i=0
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic dig.out.$j
+    else
+        cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-for i in a b c d e f g h
-do
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
+#
+#
+#
+echo "I: Checking order cyclic (cache)"
+ret=0
+# prime acache
 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
-       -p 5300 @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
-       match=0
-       for j in 1 2 3 4
-       do
-               if $test_fixed; then
-                       cmp -s dig.out.cyclic dig.out.cyclic.fixed$j && {
-                               eval "match$j=1 match=1";
-                       }
-               else
-                       cmp -s dig.out.cyclic dig.out.cyclic.good$j && {
-                               eval "match$j=1 match=1";
-                       }
-               fi
-               if [ $match -eq 1 ]; then break; fi
-       done
-       if [ $match -eq 0 ]; then ret=1; echo "I:unexpected order"; fi
-done
-match=0
-for i in 1 2 3 4
+           -p 5300 @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
+matches=0
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 do
-       eval "match=\`expr \$match + \$match$i\`"
+    j=`expr $i % 4`
+    $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+           -p 5300 @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
+    if [ $i -le 4 ]; then
+        cp dig.out.cyclic2 dig.out.$j
+    else
+        cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
+    fi
 done
-echo "I: Cyclic selection return $match of 4 possible orders in 8 samples"
-if [ $match -ne 4 ]; then echo ret=1; fi
+cmp -s dig.out.0 dig.out.1 && ret=1
+cmp -s dig.out.0 dig.out.2 && ret=1
+cmp -s dig.out.0 dig.out.3 && ret=1
+cmp -s dig.out.1 dig.out.2 && ret=1
+cmp -s dig.out.1 dig.out.3 && ret=1
+cmp -s dig.out.2 dig.out.3 && ret=1
+if [ $matches -ne 16 ]; then ret=1; fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
-n=`expr $n + 1`
 
-n=`expr $n + 1`
-echo "I: Checking order random (cache) ($n)"
+echo "I: Checking order random (cache)"
 ret=0
 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 do
index 3f81de1498ef49b1cd8f60b3f0bc4b77983d8b97..57068e2f193b479ca26045c5b4de059d8249230b 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbtdb.c,v 1.270.12.39 2011/12/22 23:55:25 marka Exp $ */
+/* $Id: rbtdb.c,v 1.270.12.40 2012/01/04 03:12:03 each Exp $ */
 
 /*! \file */
 
@@ -2697,14 +2697,6 @@ zone_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) {
        return (result);
 }
 
-static inline unsigned int
-prand(isc_uint32_t val) {
-       val ^= val >> 16;
-       val ^= val >> 8;
-       val ^= val >> 4;
-       return (val & 0xf);
-}
-
 static inline void
 bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
              rdatasetheader_t *header, isc_stdtime_t now,
@@ -2744,8 +2736,6 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
        raw = (unsigned char *)header + sizeof(*header);
        rdataset->private3 = raw;
        rdataset->count = header->count++;
-       /* Add a weak pseudo random value [0..15]. */
-       header->count += prand(header->count);
        if (rdataset->count == ISC_UINT32_MAX)
                rdataset->count = 0;