Commit 7be520494a for bind
commit 7be520494a0def9ff4643c6172aabac2bb15da94
Author: Štěpán Balážik <stepan@isc.org>
Date: Wed Oct 21 12:34:04 2026 +0200
Spell EDNS option codes as OptionType values
GenericOption() takes a dns.edns.OptionType, so that is what the call
sites now pass: the keepalive option by its enum name, and KEY-TAG and
ZONEVERSION, which the enum does not define, through OptionType.make().
That drops the type: ignore in resolver/ans2. The options render the
same.
Assisted-by: Claude:claude-fable-5-1
diff --git a/bin/tests/system/dnssec/tests_tat.py b/bin/tests/system/dnssec/tests_tat.py
index 61f61f5549..d63c782341 100644
--- a/bin/tests/system/dnssec/tests_tat.py
+++ b/bin/tests/system/dnssec/tests_tat.py
@@ -60,8 +60,9 @@ def test_tat_queries(ns1, ns6):
# check that KEY-TAG (ednsopt 14) trust-anchor-telemetry queries are
# logged. this matches "dig . dnskey +ednsopt=KEY-TAG:ffff":
+ key_tag_opt = edns.OptionType.make(14)
msg = isctest.query.create(".", "DNSKEY")
- opt = edns.GenericOption(14, b"\xff\xff")
+ opt = edns.GenericOption(key_tag_opt, b"\xff\xff")
msg.use_edns(edns=True, options=[opt])
pattern = Re("trust-anchor-telemetry './IN' from .* 65535")
with ns1.watch_log_from_here() as watcher:
@@ -72,8 +73,8 @@ def test_tat_queries(ns1, ns6):
# leak memory, by stopping and restarting the server (a memory leak
# would trigger a core dump).
msg = isctest.query.create(".", "DNSKEY")
- opt1 = edns.GenericOption(14, b"\xff\xff")
- opt2 = edns.GenericOption(14, b"\xff\xfe")
+ opt1 = edns.GenericOption(key_tag_opt, b"\xff\xff")
+ opt2 = edns.GenericOption(key_tag_opt, b"\xff\xfe")
msg.use_edns(edns=True, options=[opt2, opt1])
pattern = Re("trust-anchor-telemetry './IN' from .* 65534")
with ns1.watch_log_from_here() as watcher:
diff --git a/bin/tests/system/resolver/ans2/ans.py b/bin/tests/system/resolver/ans2/ans.py
index 75cff208d7..3e04d9efee 100644
--- a/bin/tests/system/resolver/ans2/ans.py
+++ b/bin/tests/system/resolver/ans2/ans.py
@@ -111,7 +111,9 @@ class ZoneVersionHandler(ResponseHandler):
self, qctx: QueryContext
) -> AsyncGenerator[DnsResponseSend, None]:
qctx.response.authority.append(soa("."))
- zoneversion_opt = dns.edns.GenericOption(19, bytes.fromhex("000101022304")) # type: ignore
+ zoneversion_opt = dns.edns.GenericOption(
+ dns.edns.OptionType.make(19), bytes.fromhex("000101022304")
+ )
qctx.response.use_edns(edns=0, options=[zoneversion_opt])
yield DnsResponseSend(qctx.response, authoritative=False)
diff --git a/bin/tests/system/timeouts/tests_tcp_timeouts.py b/bin/tests/system/timeouts/tests_tcp_timeouts.py
index 22c2c06083..27923c2382 100644
--- a/bin/tests/system/timeouts/tests_tcp_timeouts.py
+++ b/bin/tests/system/timeouts/tests_tcp_timeouts.py
@@ -95,7 +95,7 @@ def test_keepalive_timeout(named_port):
# Keepalive is 7 seconds, so the third message should succeed.
#
msg = create_msg("example.", "A")
- kopt = dns.edns.GenericOption(11, b"\x00")
+ kopt = dns.edns.GenericOption(dns.edns.OptionType.KEEPALIVE, b"\x00")
msg.use_edns(edns=True, payload=4096, options=[kopt])
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: