]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix invalid scope test to do what I think is actually intended
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 20 Jan 2025 13:08:02 +0000 (14:08 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 28 May 2025 13:56:04 +0000 (15:56 +0200)
pdns/recursordist/lwres.cc
regression-tests.recursor-dnssec/test_ECS.py

index 7d2e71afa133b526fd850ce8579fdafbc5ae555f..a1d6a548508a05ae2ff5b5b472932d7f974facf4 100644 (file)
@@ -582,7 +582,7 @@ static LWResult::Result asyncresolve(const ComboAddress& address, const DNSName&
 
       // If we sent out ECS, we can also expect to see a return with or without ECS, the absent case is
       // not handled explicitly. If we do see a ECS in the reply, the source part *must* match with
-      // what we sent out See https://www.rfc-editor.org/rfc/rfc7871#section-7.3
+      // what we sent out. See https://www.rfc-editor.org/rfc/rfc7871#section-7.3
       if (subnetOpts) {
         for (const auto& opt : edo.d_options) {
           if (opt.first == EDNSOptionCode::ECS) {
index d4e5e9d72b435ad9d85a63808a0b30f9c639bb3c..24d2e73f5cd3f42140b4cb6d6c1919a34a5caeee 100644 (file)
@@ -481,9 +481,9 @@ ecs-ipv6-cache-bits=128
 
     def testSendECSInvalidScope(self):
         # test that the recursor does not cache with a more specific scope than the source it sent
-        expected = dns.rrset.from_text(nameECSInvalidScope, ttlECS, dns.rdataclass.IN, 'TXT', '192.0.2.0/24')
+        expected = dns.rrset.from_text(nameECSInvalidScope, ttlECS, dns.rdataclass.IN, 'TXT', '192.0.2.0/24/25')
 
-        ecso = clientsubnetoption.ClientSubnetOption('192.0.2.1', 32)
+        ecso = clientsubnetoption.ClientSubnetOption('192.0.2.1', 24)
         query = dns.message.make_query(nameECSInvalidScope, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
 
         self.sendECSQuery(query, expected)
@@ -623,7 +623,8 @@ class UDPECSResponder(DatagramProtocol):
 
                     # Send a scope more specific than the received source for nameECSInvalidScope
                     if request.question[0].name == dns.name.from_text(nameECSInvalidScope):
-                        ecso = clientsubnetoption.ClientSubnetOption("192.0.42.42", 32, 32)
+                        ecso = clientsubnetoption.ClientSubnetOption("192.0.2.1", 24, 25)
+                        text += "/25"
                     else:
                         ecso = clientsubnetoption.ClientSubnetOption(self.ipToStr(option), option.mask, option.mask)