From 4f9c71880350a23311e79a1ef3f4889f4c060049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= Date: Fri, 18 May 2018 20:00:31 +0200 Subject: [PATCH] qname minimization: fix tests --- bin/tests/system/additional/ns2/named.conf.in | 28 +++++++++++++++++++ bin/tests/system/additional/ns2/root.db | 10 +++++++ bin/tests/system/additional/ns3/root.hint | 4 +-- bin/tests/system/additional/setup.sh | 1 + bin/tests/system/reclimit/ns3/named1.conf.in | 1 + bin/tests/system/reclimit/ns3/named2.conf.in | 1 + bin/tests/system/reclimit/ns3/named3.conf.in | 1 + bin/tests/system/reclimit/ns3/named4.conf.in | 1 + bin/tests/system/resolver/ans2/ans.pl | 25 +++++++++++++++-- bin/tests/system/resolver/ans3/ans.pl | 2 ++ bin/tests/system/statistics/ns3/named.conf.in | 1 + util/copyrights | 2 ++ 12 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 bin/tests/system/additional/ns2/named.conf.in create mode 100644 bin/tests/system/additional/ns2/root.db diff --git a/bin/tests/system/additional/ns2/named.conf.in b/bin/tests/system/additional/ns2/named.conf.in new file mode 100644 index 0000000000..1437ec444d --- /dev/null +++ b/bin/tests/system/additional/ns2/named.conf.in @@ -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"; +}; diff --git a/bin/tests/system/additional/ns2/root.db b/bin/tests/system/additional/ns2/root.db new file mode 100644 index 0000000000..c5371e111a --- /dev/null +++ b/bin/tests/system/additional/ns2/root.db @@ -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. + diff --git a/bin/tests/system/additional/ns3/root.hint b/bin/tests/system/additional/ns3/root.hint index c1784c7ee8..775f78235a 100644 --- a/bin/tests/system/additional/ns3/root.hint +++ b/bin/tests/system/additional/ns3/root.hint @@ -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 diff --git a/bin/tests/system/additional/setup.sh b/bin/tests/system/additional/setup.sh index 417a8b872f..5f43253079 100644 --- a/bin/tests/system/additional/setup.sh +++ b/bin/tests/system/additional/setup.sh @@ -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 diff --git a/bin/tests/system/reclimit/ns3/named1.conf.in b/bin/tests/system/reclimit/ns3/named1.conf.in index a649db11e3..6275d5904a 100644 --- a/bin/tests/system/reclimit/ns3/named1.conf.in +++ b/bin/tests/system/reclimit/ns3/named1.conf.in @@ -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; diff --git a/bin/tests/system/reclimit/ns3/named2.conf.in b/bin/tests/system/reclimit/ns3/named2.conf.in index 806eb5170e..3d6d27e912 100644 --- a/bin/tests/system/reclimit/ns3/named2.conf.in +++ b/bin/tests/system/reclimit/ns3/named2.conf.in @@ -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; diff --git a/bin/tests/system/reclimit/ns3/named3.conf.in b/bin/tests/system/reclimit/ns3/named3.conf.in index a0c87a2dd9..57dbf032f7 100644 --- a/bin/tests/system/reclimit/ns3/named3.conf.in +++ b/bin/tests/system/reclimit/ns3/named3.conf.in @@ -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; diff --git a/bin/tests/system/reclimit/ns3/named4.conf.in b/bin/tests/system/reclimit/ns3/named4.conf.in index dd254ad6a1..c095913fe9 100644 --- a/bin/tests/system/reclimit/ns3/named4.conf.in +++ b/bin/tests/system/reclimit/ns3/named4.conf.in @@ -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; diff --git a/bin/tests/system/resolver/ans2/ans.pl b/bin/tests/system/resolver/ans2/ans.pl index a242a998ec..ee0fed5b25 100644 --- a/bin/tests/system/resolver/ans2/ans.pl +++ b/bin/tests/system/resolver/ans2/ans.pl @@ -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")); diff --git a/bin/tests/system/resolver/ans3/ans.pl b/bin/tests/system/resolver/ans3/ans.pl index 46d767378d..4f1ef38bf5 100644 --- a/bin/tests/system/resolver/ans3/ans.pl +++ b/bin/tests/system/resolver/ans3/ans.pl @@ -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" . diff --git a/bin/tests/system/statistics/ns3/named.conf.in b/bin/tests/system/statistics/ns3/named.conf.in index 67d041b67a..c3c9208870 100644 --- a/bin/tests/system/statistics/ns3/named.conf.in +++ b/bin/tests/system/statistics/ns3/named.conf.in @@ -21,6 +21,7 @@ options { recursion yes; dnssec-validation yes; notify yes; + qname-minimization disabled; }; statistics-channels { diff --git a/util/copyrights b/util/copyrights index ddeb8eafa2..22dbf69854 100644 --- a/util/copyrights +++ b/util/copyrights @@ -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