From: Michał Kępień Date: Tue, 17 Jul 2018 09:21:39 +0000 (+0200) Subject: [squash] Make resolver tests even more civilized (ans8.pl) X-Git-Tag: v9.13.3~103^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e10e6756c9e4806de3d8574d507c3298befcc59d;p=thirdparty%2Fbind9.git [squash] Make resolver tests even more civilized (ans8.pl) Set AA=1 even for truncated responses. Put glue record in responses to no-questions/NS queries. Add comments, simplify code. --- diff --git a/bin/tests/system/resolver/ans8/ans.pl b/bin/tests/system/resolver/ans8/ans.pl index 59c55b738bc..80e288219e9 100644 --- a/bin/tests/system/resolver/ans8/ans.pl +++ b/bin/tests/system/resolver/ans8/ans.pl @@ -62,20 +62,25 @@ sub handleUDP { my $id = $packet->header->id; $packet->header->qr(1); - $packet->header->aa(0); + $packet->header->aa(1); $packet->header->tc(0); + # Responses to queries for no-questions/NS and ns.no-questions/A are + # _not_ malformed or truncated. + if ($qname eq "no-questions" && $qtype eq "NS") { + $packet->push("answer", new Net::DNS::RR($qname . " 300 NS ns.no-questions")); + $packet->push("additional", new Net::DNS::RR("ns.no-questions. 300 A 10.53.0.8")); + return $packet->data; + } elsif ($qname eq "ns.no-questions") { + $packet->push("answer", new Net::DNS::RR($qname . " 300 A 10.53.0.8")); + return $packet->data; + } + + # Ensure the QUESTION section is empty in the response. + $packet->pop("question"); + if ($qname eq "truncated.no-questions") { - $packet->pop("question"); $packet->header->tc(1); - } elsif ($qname eq "not-truncated.no-questions") { - $packet->pop("question"); - } elsif ($qname eq "no-questions" && $qtype eq "NS") { - $packet->header->aa(1); - $packet->push("answer", new Net::DNS::RR("no-questions. 300 NS ns.no-questions")); - } elsif ($qname eq "ns.no-questions" && $qtype eq "A") { - $packet->header->aa(1); - $packet->push("answer", new Net::DNS::RR("ns.no-questions. 300 A 10.53.0.8")); } # Net::DNS versions < 0.68 insert an ./ANY RR into the QUESTION section