mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 22:32:07 -04:00
[squash] Make resolver tests even more civilized (ans2.pl and ans3.pl)
Prevent ans2.pl from responding authoritatively for any name at or below example.net. Make ans3.pl properly answer example.net/NS queries. Use string comparisons instead of regular expressions where possible.
This commit is contained in:
parent
122a1a00be
commit
82082ecd56
2 changed files with 22 additions and 14 deletions
|
|
@ -80,7 +80,7 @@ for (;;) {
|
|||
} 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" ||
|
||||
} elsif ($qname eq "www.example.org" ||
|
||||
$qname eq "badcname.example.org" ||
|
||||
$qname eq "goodcname.example.org" ||
|
||||
$qname eq "foo.baddname.example.org" ||
|
||||
|
|
@ -99,9 +99,8 @@ for (;;) {
|
|||
} 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 =~ /\.example\.net/ || $qname =~ /^example\.net/) {
|
||||
$packet->header->aa(1);
|
||||
$packet->push("authority", new Net::DNS::RR("example.net 300 NS ns.example.net."));
|
||||
} elsif ($qname =~ /example\.net/) {
|
||||
$packet->push("authority", new Net::DNS::RR("example.net 300 NS ns.example.net"));
|
||||
$packet->push("additional", new Net::DNS::RR("ns.example.net 300 A 10.53.0.3"));
|
||||
} elsif ($qname =~ /sub\.example\.org/) {
|
||||
# Data for CNAME/DNAME filtering. The final answers are
|
||||
|
|
|
|||
|
|
@ -56,8 +56,26 @@ for (;;) {
|
|||
|
||||
my @questions = $packet->question;
|
||||
my $qname = $questions[0]->qname;
|
||||
my $qtype = $questions[0]->qtype;
|
||||
|
||||
if ($qname eq "badcname.example.net") {
|
||||
if ($qname eq "example.net" && $qtype eq "NS") {
|
||||
$packet->push("answer", new Net::DNS::RR($qname . " 300 NS ns.example.net"));
|
||||
$packet->push("additional", new Net::DNS::RR("ns.example.net 300 A 10.53.0.3"));
|
||||
} elsif ($qname eq "ns.example.net") {
|
||||
$packet->push("answer", new Net::DNS::RR($qname . " 300 A 10.53.0.3"));
|
||||
} elsif ($qname eq "nodata.example.net") {
|
||||
# Do not add a SOA RRset.
|
||||
} elsif ($qname eq "nxdomain.example.net") {
|
||||
# Do not add a SOA RRset.
|
||||
$packet->header->rcode(NXDOMAIN);
|
||||
} elsif ($qname eq "www.example.net") {
|
||||
# Data for address/alias filtering.
|
||||
if ($qtype eq "A") {
|
||||
$packet->push("answer", new Net::DNS::RR($qname . " 300 A 192.0.2.1"));
|
||||
} elsif ($qtype eq "AAAA") {
|
||||
$packet->push("answer", new Net::DNS::RR($qname . " 300 AAAA 2001:db8:beef::1"));
|
||||
}
|
||||
} elsif ($qname eq "badcname.example.net") {
|
||||
$packet->push("answer",
|
||||
new Net::DNS::RR($qname .
|
||||
" 300 CNAME badcname.example.org"));
|
||||
|
|
@ -75,11 +93,6 @@ for (;;) {
|
|||
$packet->push("answer",
|
||||
new Net::DNS::RR($qname .
|
||||
" 300 CNAME goodcname.example.org"));
|
||||
} elsif ($qname =~ /^nodata\.example\.net$/i) {
|
||||
$packet->header->aa(1);
|
||||
} elsif ($qname =~ /^nxdomain\.example\.net$/i) {
|
||||
$packet->header->aa(1);
|
||||
$packet->header->rcode(NXDOMAIN);
|
||||
} elsif ($qname eq "cname.sub.example.org") {
|
||||
$packet->push("answer",
|
||||
new Net::DNS::RR($qname .
|
||||
|
|
@ -94,10 +107,6 @@ for (;;) {
|
|||
} elsif ($qname eq "www.ok.sub.example.org") {
|
||||
$packet->push("answer",
|
||||
new Net::DNS::RR($qname . " 300 A 192.0.2.1"));
|
||||
} elsif ($qname eq "ns.example.net") {
|
||||
$packet->push("answer",
|
||||
new Net::DNS::RR($qname .
|
||||
" 300 A 10.53.0.3"));
|
||||
} else {
|
||||
$packet->push("answer", new Net::DNS::RR("www.example.com 300 A 1.2.3.4"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue