qname minimization: fix tests

This commit is contained in:
Witold Kręcicki 2018-05-18 20:00:31 +02:00
parent dd7bb617be
commit 4f9c718803
12 changed files with 73 additions and 4 deletions

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.2;
notify-source 10.53.0.2;
transfer-source 10.53.0.2;
recursion no;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.2; };
listen-on-v6 { none; };
notify no;
minimal-responses yes;
};
zone "." {
type master;
file "root.db";
};

View file

@ -0,0 +1,10 @@
. IN SOA ns2. hostmaster ( 2 8H 2H 4W 1D);
. NS ns2.
ns1. A 10.53.0.1
ns2. A 10.53.0.2
rt.example. NS ns1.
naptr.example. NS ns1.
rt2.example. NS ns1.
naptr2.example. NS ns1.
nid.example. NS ns1.

View file

@ -7,5 +7,5 @@
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
. NS ns1.
ns1. A 10.53.0.1
. NS ns2.
ns2. A 10.53.0.2

View file

@ -14,4 +14,5 @@ SYSTEMTESTTOP=..
$SHELL clean.sh
copy_setports ns1/named1.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
copy_setports ns3/named.conf.in ns3/named.conf

View file

@ -19,6 +19,7 @@ options {
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
servfail-ttl 0;
qname-minimization disabled;
max-recursion-depth 12;
recursion yes;
dnssec-validation yes;

View file

@ -19,6 +19,7 @@ options {
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
servfail-ttl 0;
qname-minimization disabled;
max-recursion-depth 5;
recursion yes;
dnssec-validation yes;

View file

@ -19,6 +19,7 @@ options {
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
servfail-ttl 0;
qname-minimization disabled;
max-recursion-depth 100;
max-recursion-queries 50;
recursion yes;

View file

@ -19,6 +19,7 @@ options {
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
servfail-ttl 0;
qname-minimization disabled;
max-recursion-depth 100;
max-recursion-queries 40;
recursion yes;

View file

@ -57,7 +57,13 @@ for (;;) {
my $qname = $questions[0]->qname;
my $qtype = $questions[0]->qtype;
if ($qname eq "cname1.example.com") {
if ($qname eq "com" && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("com 300 NS a.root-servers.nil."));
} elsif ($qname eq "example.com" && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("example.com 300 NS a.root-servers.nil."));
} elsif ($qname eq "cname1.example.com") {
# Data for the "cname + other data / 1" test
$packet->push("answer", new Net::DNS::RR("cname1.example.com 300 CNAME cname1.example.com"));
$packet->push("answer", new Net::DNS::RR("cname1.example.com 300 A 1.2.3.4"));
@ -65,6 +71,15 @@ for (;;) {
# Data for the "cname + other data / 2" test: same RRs in opposite order
$packet->push("answer", new Net::DNS::RR("cname2.example.com 300 A 1.2.3.4"));
$packet->push("answer", new Net::DNS::RR("cname2.example.com 300 CNAME cname2.example.com"));
} elsif ($qname eq "org" && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("org 300 NS a.root-servers.nil."));
} elsif ($qname eq "example.org" && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("example.org 300 NS a.root-servers.nil."));
} elsif (($qname eq "baddname.example.org" || $qname eq "gooddname.example.org") && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("example.org 300 NS a.root-servers.nil."));
} elsif ($qname eq "www.example.org" || $qname eq "www.example.net" ||
$qname eq "badcname.example.org" ||
$qname eq "goodcname.example.org" ||
@ -81,6 +96,12 @@ for (;;) {
new Net::DNS::RR($qname .
" 300 AAAA 2001:db8:beef::1"));
}
} elsif ($qname eq "net" && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("net 300 NS a.root-servers.nil."));
} elsif ($qname eq "example.net" && $qtype eq "NS") {
$packet->header->aa(1);
$packet->push("answer", new Net::DNS::RR("example.net 300 NS a.root-servers.nil."));
} elsif ($qname eq "badcname.example.net" ||
$qname eq "goodcname.example.net") {
# Data for CNAME/DNAME filtering. We need to make one-level
@ -97,7 +118,7 @@ for (;;) {
# expected to be accepted regardless of the filter setting.
$packet->push("authority", new Net::DNS::RR("sub.example.org 300 NS ns.sub.example.org"));
$packet->push("additional", new Net::DNS::RR("ns.sub.example.org 300 A 10.53.0.3"));
} elsif ($qname =~ /\.broken/) {
} elsif ($qname =~ /broken/) {
# Delegation to broken TLD.
$packet->push("authority", new Net::DNS::RR("broken 300 NS ns.broken"));
$packet->push("additional", new Net::DNS::RR("ns.broken 300 A 10.53.0.4"));

View file

@ -61,6 +61,8 @@ for (;;) {
$packet->push("answer",
new Net::DNS::RR($qname .
" 300 CNAME badcname.example.org"));
} elsif (($qname eq "baddname.example.net" || $qname eq "gooddname.example.net") && $qtype eq "NS") {
$packet->push("authority", new Net::DNS::RR("example.net IN SOA (1 2 3 4 5)"))
} elsif ($qname eq "foo.baddname.example.net") {
$packet->push("answer",
new Net::DNS::RR("baddname.example.net" .

View file

@ -21,6 +21,7 @@ options {
recursion yes;
dnssec-validation yes;
notify yes;
qname-minimization disabled;
};
statistics-channels {

View file

@ -433,6 +433,8 @@
./bin/tests/system/additional/ns1/rt.db ZONE 2013,2016,2018
./bin/tests/system/additional/ns1/rt2.db ZONE 2013,2016,2018
./bin/tests/system/additional/ns1/srv.db ZONE 2016,2018
./bin/tests/system/additional/ns2/named.conf.in CONF-C 2018
./bin/tests/system/additional/ns2/root.db ZONE 2018
./bin/tests/system/additional/ns3/named.conf.in CONF-C 2017,2018
./bin/tests/system/additional/ns3/root.hint ZONE 2017,2018
./bin/tests/system/additional/setup.sh SH 2013,2016,2018