]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add test case for #11320: followCNAMERecords leads to a result that 11327/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 15 Feb 2022 13:09:36 +0000 (14:09 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 15 Feb 2022 13:49:41 +0000 (14:49 +0100)
should be subject to dns64 processing

regression-tests.recursor-dnssec/test_Lua.py

index e5649533d7a1eed55e7a82c2f3bbf6558e294dde..9e04d0a9a9c387c8a3280f1e81beb2164368050e 100644 (file)
@@ -704,7 +704,7 @@ dnssec=validate
         self.assertEqual(len(res.authority), 0)
 
 class PolicyEventFilterOnFollowUpTest(RecursorTest):
-    """Tests the interaction between RPZ and followup queries (dns64, folliwCNAME)
+    """Tests the interaction between RPZ and followup queries (dns64, followCNAME)
     """
 
     _confdir = 'policyeventfilter-followup'
@@ -754,6 +754,43 @@ secure.example.zone.rpz. 60 IN A 192.0.2.42
             self.assertEqual(len(res.authority), 0)
             self.assertResponseMatches(query, expected, res)
 
+class PolicyEventFilterOnFollowUpWithNativeDNS64Test(RecursorTest):
+    """Tests the interaction between followup queries and native dns64
+    """
+
+    _confdir = 'policyeventfilter-followup-dns64'
+    _config_template = """
+    dns64-prefix=1234::/96
+    """
+    _lua_config_file = """
+    """
+    _lua_dns_script_file = """
+    function preresolve(dq)
+      dq:addAnswer(pdns.CNAME, "cname.secure.example.")
+      dq.followupFunction="followCNAMERecords"
+      dq.rcode = pdns.NOERROR
+      return true
+    end
+
+    """
+
+    def testAAAA(self):
+        expected = [
+            dns.rrset.from_text('mx1.secure.example.', 15, dns.rdataclass.IN, 'CNAME', 'cname.secure.example.'),
+            dns.rrset.from_text('cname.secure.example.', 15, dns.rdataclass.IN, 'CNAME', ' host1.secure.example.'),
+            dns.rrset.from_text('host1.secure.example.', 15, dns.rdataclass.IN, 'AAAA', '1234::c000:202')
+        ]
+        query = dns.message.make_query('mx1.secure.example', 'AAAA')
+
+        for method in ("sendUDPQuery", "sendTCPQuery"):
+            sender = getattr(self, method)
+            res = sender(query)
+            print(res)
+            self.assertRcodeEqual(res, dns.rcode.NOERROR)
+            self.assertEqual(len(res.answer), 3)
+            self.assertEqual(len(res.authority), 0)
+            self.assertResponseMatches(query, expected, res)
+
 class LuaPostResolveFFITest(RecursorTest):
     """Tests postresolve_ffi interface"""