From: Otto Moerbeek Date: Mon, 20 Jan 2025 13:08:02 +0000 (+0100) Subject: Fix invalid scope test to do what I think is actually intended X-Git-Tag: rec-5.4.0-alpha0~18^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1e9aaf3dec220026663b70429090bc969cc4eac;p=thirdparty%2Fpdns.git Fix invalid scope test to do what I think is actually intended --- diff --git a/pdns/recursordist/lwres.cc b/pdns/recursordist/lwres.cc index 4dddb0c34a..d96e1cbb30 100644 --- a/pdns/recursordist/lwres.cc +++ b/pdns/recursordist/lwres.cc @@ -598,7 +598,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) { diff --git a/regression-tests.recursor-dnssec/test_ECS.py b/regression-tests.recursor-dnssec/test_ECS.py index be91694f74..9a5ca01433 100644 --- a/regression-tests.recursor-dnssec/test_ECS.py +++ b/regression-tests.recursor-dnssec/test_ECS.py @@ -463,9 +463,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) @@ -589,7 +589,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)