diff --git a/CHANGES b/CHANGES index c9b444fd80..7c7c93f69a 100644 --- 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 index 0000000000..0ee3296863 --- /dev/null +++ b/bin/tests/system/rrsetorder/ns4/named.conf @@ -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"; +}; diff --git a/bin/tests/system/rrsetorder/tests.sh b/bin/tests/system/rrsetorder/tests.sh index 8b8efe4ffd..0ca76dd724 100644 --- a/bin/tests/system/rrsetorder/tests.sh +++ b/bin/tests/system/rrsetorder/tests.sh @@ -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 diff --git a/lib/dns/order.c b/lib/dns/order.c index 853b00196d..c91d561e9a 100644 --- a/lib/dns/order.c +++ b/lib/dns/order.c @@ -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