]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4192. [bug] The default rrset-order of random was not always being
authorMark Andrews <marka@isc.org>
Tue, 25 Aug 2015 04:52:27 +0000 (14:52 +1000)
committerMark Andrews <marka@isc.org>
Tue, 25 Aug 2015 04:52:51 +0000 (14:52 +1000)
                        applied. [RT #40456]

(cherry picked from commit 9b956d342e93ab60d5d9367785b26546f7e49391)

CHANGES
bin/tests/system/rrsetorder/ns4/named.conf [new file with mode: 0644]
bin/tests/system/rrsetorder/tests.sh
lib/dns/order.c

diff --git a/CHANGES b/CHANGES
index 5d05bff4325e4a7c7c83d9d8a32b6cc0a3eb26db..daaf115deaab7a86051c601515fd2d07f08ea095 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4192.  [bug]           The default rrset-order of random was not always being
+                       applied. [RT #40456]
+
 4191.  [protocol]      Accept DNS-SD non LDH PTR records in reverse zones
                        as per RFC 6763. [RT #37889]
 
diff --git a/bin/tests/system/rrsetorder/ns4/named.conf b/bin/tests/system/rrsetorder/ns4/named.conf
new file mode 100644 (file)
index 0000000..0ee3296
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2006, 2007  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
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: named.conf,v 1.5 2007/06/18 23:47:30 tbox Exp $ */
+
+controls { /* empty */ };
+
+options {
+       query-source address 10.53.0.4;
+       notify-source 10.53.0.4;
+       transfer-source 10.53.0.4;
+       port 5300;
+       pid-file "named.pid";
+       listen-on { 10.53.0.4; };
+       listen-on-v6 { none; };
+       recursion yes;
+       acache-enable yes;
+       notify yes;
+       rrset-order {
+               class IN type A name "host.example.com" order random;
+       };
+
+};
+
+zone "." {
+       type hint;
+       file "../../common/root.hint";
+};
index b2e3dedb1c07ac00fb8b67d726e23732fc2b5787..80dd5b6564d6efc28bbc77c3b966c41366151b51 100644 (file)
@@ -446,6 +446,33 @@ echo "I: Random selection return $match of 24 possible orders in 36 samples"
 if [ $match -lt 8 ]; then echo ret=1; fi
 if [ $ret != 0 ]; then echo "I:failed"; fi
 
+echo "I: Checking default order no match in rrset-order (random)"
+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
+       eval match$i=0
+done
+for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
+do
+$DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
+       -p 5300 @10.53.0.4 random.example > dig.out.random|| ret=1
+       match=0
+       for j 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
+               eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
+               if [ $match -eq 1 ]; then break; fi
+       done
+       if [ $match -eq 0 ]; then ret=1; fi
+done
+match=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
+eval "match=\`expr \$match + \$match$i\`"
+done
+echo "I: Random selection return $match of 24 possible orders in 36 samples"
+if [ $match -lt 8 ]; then echo ret=1; fi
+if [ $ret != 0 ]; then echo "I:failed"; fi
+
 status=`expr $status + $ret`
 echo "I:exit status: $status"
 exit $status
index 853b00196d21da1c08663b34b017c5a440c9f5a9..c91d561e9ac86cc934e4a2d526bd0ed9f4ab40ad 100644 (file)
@@ -132,7 +132,7 @@ dns_order_find(dns_order_t *order, dns_name_t *name,
                if (match(name, dns_fixedname_name(&ent->name)))
                        return (ent->mode);
        }
-       return (0);
+       return (DNS_RDATASETATTR_RANDOMIZE);
 }
 
 void