]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add test case for #11320: followCNAMERecords leads to a result that 11362/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>
Fri, 25 Feb 2022 10:24:41 +0000 (11:24 +0100)
should be subject to dns64 processing

(cherry picked from commit 63ad9c90eb8f1842d2d79acefa803db9f820e33d)

regression-tests.recursor-dnssec/test_Lua.py

index 6053fbb9938b36cb38b2ad4e9dc6205bfbe978d7..bd0c00ba653b342be0e11c13fa3e2d24b9d71d10 100644 (file)
@@ -714,7 +714,7 @@ log-common-errors=yes
         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'
@@ -763,3 +763,41 @@ secure.example.zone.rpz. 60 IN A 192.0.2.42
             self.assertEqual(len(res.answer), 2)
             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)
+