]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[squash] Make resolver tests even more civilized (ans8.pl)
authorMichał Kępień <michal@isc.org>
Tue, 17 Jul 2018 09:21:39 +0000 (11:21 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 17 Jul 2018 11:01:42 +0000 (13:01 +0200)
Set AA=1 even for truncated responses.  Put glue record in responses to
no-questions/NS queries.  Add comments, simplify code.

bin/tests/system/resolver/ans8/ans.pl

index 59c55b738bcc983165f47bc006878910294d30fb..80e288219e987d684fd8e84970b7e23879021cd1 100644 (file)
@@ -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