assert len(rrs) != 0, "no NSEC records found in authority section"
-def check_auth_nsec3(response, iterations=0, optout=0, saltlen=0):
- match = f"IN NSEC3 1 {optout} {iterations}"
+def check_auth_nsec3(response, iterations=0, optout=0, salt="-"):
+ match = f"IN NSEC3 1 {optout} {iterations} {salt}"
rrs = []
for rrset in response.authority:
if rrset.match(dns.rdataclass.IN, dns.rdatatype.NSEC3, dns.rdatatype.NONE):
assert match in rrset.to_text()
- if saltlen == 0:
- assert f"{match} -" in rrset.to_text()
- else:
- assert not f"{match} -" in rrset.to_text()
-
rrs.append(rrset)
assert not rrset.match(
dns.rdataclass.IN, dns.rdatatype.NSEC, dns.rdatatype.NONE
def check_nsec3param(response, match, saltlen):
rrs = []
+ salt = "-"
for rrset in response.answer:
if rrset.match(dns.rdataclass.IN, dns.rdatatype.NSEC3PARAM, dns.rdatatype.NONE):
assert f"{match} -" in rrset.to_text()
else:
assert not f"{match} -" in rrset.to_text()
+ salt = rrset.to_text().split()[7]
rrs.append(rrset)
else:
)
assert len(rrs) != 0
+
+ return salt
response = isctest.query.tcp(query, ns3.ip)
assert response.rcode() == dns.rcode.NOERROR
- check_nsec3param(response, match, saltlen)
+ salt = check_nsec3param(response, match, saltlen)
query = isctest.query.create(f"nosuchname.{fqdn}", dns.rdatatype.A)
response = isctest.query.tcp(query, ns3.ip)
assert response.rcode() == dns.rcode.NXDOMAIN
- check_auth_nsec3(response, iterations, optout, saltlen)
+ check_auth_nsec3(response, iterations, optout, salt)
# Extra test for nsec3-change.kasp.
if zone == "nsec3-change.kasp":