]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Transform a AAAA NoData result into a FormErr in Lua and see if dns64 is still applied
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 12 Aug 2022 08:28:37 +0000 (10:28 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 12 Aug 2022 08:28:37 +0000 (10:28 +0200)
regression-tests.recursor-dnssec/test_DNS64.py

index 4fb601cb55b2e19114e2e31b2a4ad548983817dd..281be08d988e743eb65dd70a92222700fa8c15c9 100644 (file)
@@ -19,6 +19,16 @@ class DNS64RecursorTest(RecursorTest):
     dns64-prefix=64:ff9b::/96
     """ % (_confdir, _confdir, _confdir)
 
+    _lua_dns_script_file = """
+      function nodata(dq)
+        if dq.qtype == pdns.AAAA and dq.qname:equal("formerr.example.dns64") then
+          dq.rcode = pdns.FORMERR
+          return true
+        end
+        return false
+       end
+    """
+
     @classmethod
     def generateRecursorConfig(cls, confdir):
         authzonepath = os.path.join(confdir, 'example.dns64.zone')
@@ -30,6 +40,7 @@ www 3600 IN TXT "does exist"
 aaaa 3600 IN AAAA 2001:db8::1
 cname 3600 IN CNAME cname2.example.dns64.
 cname2 3600 IN CNAME www.example.dns64.
+formerr 3600 IN A 192.0.2.43
 """.format(soa=cls._SOA))
 
         authzonepath = os.path.join(confdir, 'in-addr.arpa.zone')
@@ -123,6 +134,18 @@ cname2 3600 IN CNAME www.example.dns64.
             self.assertRcodeEqual(res, dns.rcode.NOERROR)
             self.assertRRsetInAnswer(res, expected)
 
+    # If the AAAA FormFails, we still should get a dns64 result
+    def testFormErrAAAA(self):
+        qname = 'formerr.example.dns64.'
+        expected = dns.rrset.from_text(qname, 0, dns.rdataclass.IN, 'AAAA', '64:ff9b::c000:22b')
+
+        query = dns.message.make_query(qname, 'AAAA', want_dnssec=True)
+        for method in ("sendUDPQuery", "sendTCPQuery"):
+            sender = getattr(self, method)
+            res = sender(query)
+            self.assertRcodeEqual(res, dns.rcode.NOERROR)
+            self.assertRRsetInAnswer(res, expected)
+
     # there is a TXT record, we should get it
     def testExistingTXT(self):
         qname = 'www.example.dns64.'