]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - regression-tests.recursor-dnssec/test_EDNSBufferSize.py
Merge pull request #13733 from fredmorcos/ci-verbose-logging
[thirdparty/pdns.git] / regression-tests.recursor-dnssec / test_EDNSBufferSize.py
index 1f4726eb692100088b24c991e8917cce0736b762..01ac82462fcff46cd74e523ed4bada569b2d5076 100644 (file)
@@ -32,11 +32,12 @@ class EDNSBufferTest(RecursorTest):
     -----+-----------+---------------+----------------+-----------------+------------------+-------------------+
      01  | 1680      | 1680          | 4096           | 1680 (inc EDNS) | 1680 (inc EDNS)  | 1680              |
      02  | 1680      | 1680          | 1679           | 1680 (inc EDNS) | TC (+EDNS)       | 1680              |
-     03  | 1680      | 1681          | 4096           | 1680 (inc EDNS) | TC (+EDNS)       | 1680              |
+     03  | 1680      | 1681          | 4096           | 1681 (inc EDNS) | TC (+EDNS)       | 1680              |
      04  | 1680      | 1679          | 4096           | 1679 (inc EDNS) | 1679 (inc EDNS)  | 1680              |
      05  | 1680      | 1680          | 1680           | 1680 (inc EDNS) | 1680 (inc EDNS)  | 1680              |
      06  | 1680      | 1680          | 512 (No EDNS)  | 512 (+EDNS)     | 512 (no EDNS)    | (no EDNS)         |
      07  | 1680      | 1680          | 512 (No EDNS)  | 513 (+EDNS)     | TC (no EDNS)     | (no EDNS)         |
+     08  | 1680      | 1680          | 511            | 501 (+EDNS)     | 512 (inc EDNS)   | 1680              |
 
     The qname is $testnum.edns-tests.example.
     """
@@ -46,6 +47,7 @@ class EDNSBufferTest(RecursorTest):
     _qnameSuffix = '.edns-tests.example.'
 
     _config_template = """
+qname-minimization=no
 forward-zones=edns-tests.example=%s.22
 udp-truncation-threshold=%d
 edns-outgoing-bufsize=%d
@@ -82,13 +84,13 @@ edns-outgoing-bufsize=%d
         """
         response = dns.message.from_wire(rawResponse)
 
-        self.assertEquals(len(rawResponse), size)
+        self.assertEqual(len(rawResponse), size)
         self.assertRcodeEqual(response, dns.rcode.NOERROR)
 
         self.assertMessageHasFlags(response, ['QR', 'RD', 'RA'])
 
         for record in response.answer:
-            self.assertEquals(record.rdtype, dns.rdatatype.TXT)
+            self.assertEqual(record.rdtype, dns.rdatatype.TXT)
             for part in record:
                 for string in part.strings:
                     self.assertTrue(len(string) == 255 or
@@ -111,7 +113,7 @@ edns-outgoing-bufsize=%d
 
 class EDNSBufferTest16801680(EDNSBufferTest):
     """
-    Runs test cases 1, 2, 5, 6, 7
+    Runs test cases 1, 2, 5, 6, 7, 8
     """
 
     def testEdnsBufferTestCase01(self):
@@ -121,14 +123,14 @@ class EDNSBufferTest16801680(EDNSBufferTest):
             self.checkResponseContent(raw, 'A',
                                       self._udpTruncationThreshold, 9)
             message = dns.message.from_wire(raw)
-            self.checkEDNS(message, 1680)
+            self.checkEDNS(message, 512)
 
     def testEdnsBufferTestCase02(self):
         query = self.getMessage('02', 1679)
         for _ in range(10):
             message = self.sendUDPQuery(query)
             self.checkTruncatedResponse(message)
-            self.checkEDNS(message, self._udpTruncationThreshold)
+            self.checkEDNS(message, 512)
 
     def testEdnsBufferTestCase05(self):
         query = self.getMessage('05', 1680)
@@ -137,7 +139,7 @@ class EDNSBufferTest16801680(EDNSBufferTest):
             self.checkResponseContent(raw, 'E',
                                       self._udpTruncationThreshold, 9)
             message = dns.message.from_wire(raw)
-            self.checkEDNS(message, self._udpTruncationThreshold)
+            self.checkEDNS(message, 512)
 
     def testEdnsBufferTestCase06(self):
         query = self.getMessage('06', 0)
@@ -154,6 +156,14 @@ class EDNSBufferTest16801680(EDNSBufferTest):
             self.checkTruncatedResponse(message)
             self.checkEDNS(message, 0)
 
+    def testEdnsBufferTestCase08(self):
+        query = self.getMessage('08', 511)
+        for _ in range(10):
+            raw = self.sendUDPQuery(query, decode=False)
+            self.checkResponseContent(raw, 'H', 512, 181)
+            message = dns.message.from_wire(raw)
+            self.checkEDNS(message, 512)
+
 class EDNSBufferTest16801681(EDNSBufferTest):
     """
     Runs test case 3
@@ -164,6 +174,7 @@ class EDNSBufferTest16801681(EDNSBufferTest):
     _qnameSuffix = '.edns-tests.example.'
 
     _config_template = """
+qname-minimization=no
 forward-zones=edns-tests.example=%s.22
 udp-truncation-threshold=%d
 edns-outgoing-bufsize=%d
@@ -174,7 +185,7 @@ edns-outgoing-bufsize=%d
         for _ in range(10):
             message = self.sendUDPQuery(query)
             self.checkTruncatedResponse(message)
-            self.checkEDNS(message, 1680)
+            self.checkEDNS(message, 512)
 
 
 class EDNSBufferTest16801679(EDNSBufferTest):
@@ -187,6 +198,7 @@ class EDNSBufferTest16801679(EDNSBufferTest):
     _qnameSuffix = '.edns-tests.example.'
 
     _config_template = """
+qname-minimization=no
 forward-zones=edns-tests.example=%s.22
 udp-truncation-threshold=%d
 edns-outgoing-bufsize=%d
@@ -199,7 +211,7 @@ edns-outgoing-bufsize=%d
             self.checkResponseContent(raw, 'D',
                                       self._ednsOutgoingBufsize, 8)
             message = dns.message.from_wire(raw)
-            self.checkEDNS(message, self._udpTruncationThreshold)
+            self.checkEDNS(message, 512)
 
 
 class UDPLargeResponder(DatagramProtocol):
@@ -215,6 +227,8 @@ class UDPLargeResponder(DatagramProtocol):
             packet_size = 512 + 11
         if testnum == 7:
             packet_size = 513 + 11
+        if testnum == 8:
+            packet_size = 501 + 11
 
         # An EDNS(0) RR without options is 11 bytes:
         # NAME:  1
@@ -236,8 +250,7 @@ class UDPLargeResponder(DatagramProtocol):
         # This is an authoritative answer
         response.flags |= dns.flags.AA
         # We pretend to do EDNS with a 4096 buffer size
-        response.edns = 0
-        response.payload = 4096
+        response.use_edns(payload=4096)
 
         # What we use to fill the TXT records
         # Test number + 64, so 01 = 'A', 02 = 'B' etc...