Commit b1840a3d1a for bind
commit b1840a3d1a5f94a90e9396e4ef3ddef71b8e8c49
Author: Michal Nowak <mnowak@isc.org>
Date: Fri Oct 9 15:16:33 2026 +0000
Send the glue test's cookie as a CookieOption
dnspython 2.7.0 added a typed COOKIE option, so the cookie no longer has
to be spelled as a GenericOption with a raw option code. The client
cookie bytes are unchanged, so the query stays the same size, which
matters as the test probes the truncation limit.
Assisted-by: Claude:claude-opus-5-5
diff --git a/bin/tests/system/glue/tests_glue.py b/bin/tests/system/glue/tests_glue.py
index 2e30c7e6bd..915622e438 100644
--- a/bin/tests/system/glue/tests_glue.py
+++ b/bin/tests/system/glue/tests_glue.py
@@ -107,7 +107,7 @@ def test_glue_truncation(qname, dnssec):
# Zones used in this test were created with dig in mind that, unlike dnspython,
# by default, sets a cookie. Given that the message size must be close to the
# truncation limit, we also need to set a cookie here.
- options=[dns.edns.GenericOption(dns.edns.OptionType.COOKIE, b"0xda13cc")],
+ options=[dns.edns.CookieOption(client=b"0xda13cc", server=b"")],
)
msg.want_dnssec(wanted=True)
res = isctest.query.udp(msg, "10.53.0.1")
diff --git a/bin/tests/system/resolver/tests_resolver.py b/bin/tests/system/resolver/tests_resolver.py
index c81dc1cf57..677e8104bf 100644
--- a/bin/tests/system/resolver/tests_resolver.py
+++ b/bin/tests/system/resolver/tests_resolver.py
@@ -51,17 +51,13 @@ def test_any_udp_server_cookie():
# A valid server cookie proves that the client address is not
# spoofed, so the ANY query is answered over UDP. Get the server
# cookie with a query of another type first.
- client_cookie = dns.edns.GenericOption(dns.edns.OptionType.COOKIE, b"\x01" * 8)
+ client_cookie = dns.edns.CookieOption(client=b"\x01" * 8, server=b"")
msg = isctest.query.create("mx-only.tld.", "MX", rd=False, dnssec=False)
msg.use_edns(edns=0, options=[client_cookie])
res = isctest.query.udp(msg, "10.53.0.4")
isctest.check.noerror(res)
- cookies = [
- option.to_wire()
- for option in res.options
- if option.otype == dns.edns.OptionType.COOKIE
- ]
- assert len(cookies) == 1 and len(cookies[0]) > 8, res
+ cookies = res.get_options(dns.edns.OptionType.COOKIE)
+ assert len(cookies) == 1 and cookies[0].server, res
# A client cookie alone proves nothing.
msg = isctest.query.create("mx-only.tld.", "ANY", rd=False, dnssec=False)
@@ -71,9 +67,8 @@ def test_any_udp_server_cookie():
isctest.check.tcflag(res)
isctest.check.empty_answer(res)
- full_cookie = dns.edns.GenericOption(dns.edns.OptionType.COOKIE, cookies[0])
msg = isctest.query.create("mx-only.tld.", "ANY", rd=False, dnssec=False)
- msg.use_edns(edns=0, options=[full_cookie])
+ msg.use_edns(edns=0, options=cookies)
res = isctest.query.udp(msg, "10.53.0.4")
isctest.check.noerror(res)
isctest.check.notcflag(res)