Commit b9da46f3a3 for bind
commit b9da46f3a3d903946f6cf7bdc61d915b3c62fb21
Author: Štěpán Balážik <stepan@isc.org>
Date: Tue Sep 8 16:45:59 2026 +0200
Match on EDNS with a matcher
Edns and EdnsOptions declare that a handler answers queries carrying
an OPT record or EDNS options, which was previously done with a
match() method.
Assisted-by: Claude:claude-fable-5
diff --git a/bin/tests/system/isctest/asyncserver/matchers.py b/bin/tests/system/isctest/asyncserver/matchers.py
index 41a6d49305..8c52fb0c51 100644
--- a/bin/tests/system/isctest/asyncserver/matchers.py
+++ b/bin/tests/system/isctest/asyncserver/matchers.py
@@ -219,3 +219,27 @@ class Protocol(Matcher):
def __str__(self) -> str:
return f"over {self._protocol.name}"
+
+
+class Edns(Matcher):
+ """
+ Match queries carrying an OPT record.
+ """
+
+ def match(self, qctx: QueryContext) -> bool:
+ return qctx.query.edns > -1
+
+ def __str__(self) -> str:
+ return "with EDNS"
+
+
+class EdnsOptions(Matcher):
+ """
+ Match queries carrying EDNS options.
+ """
+
+ def match(self, qctx: QueryContext) -> bool:
+ return bool(qctx.query.options)
+
+ def __str__(self) -> str:
+ return "with EDNS options"
diff --git a/bin/tests/system/resolver/ans10/ans.py b/bin/tests/system/resolver/ans10/ans.py
index c54412e5de..0c75842308 100644
--- a/bin/tests/system/resolver/ans10/ans.py
+++ b/bin/tests/system/resolver/ans10/ans.py
@@ -16,13 +16,13 @@ import dns.rdatatype
from isctest.asyncserver import AsyncDnsServer, QueryContext, ResponseHandler
from isctest.asyncserver.actions import DnsResponseSend
+from isctest.asyncserver.matchers import Edns, EdnsOptions
from ..resolver_ans import rrset, soa_rrset
class EdnsWithOptionsFormerrHandler(ResponseHandler):
- def match(self, qctx: QueryContext) -> bool:
- return qctx.query.edns > -1 and qctx.query.options
+ matcher = Edns() & EdnsOptions()
async def get_responses(
self, qctx: QueryContext
diff --git a/bin/tests/system/xfer/ans5/ans.py b/bin/tests/system/xfer/ans5/ans.py
index 72c383f90d..1af045948e 100644
--- a/bin/tests/system/xfer/ans5/ans.py
+++ b/bin/tests/system/xfer/ans5/ans.py
@@ -29,7 +29,7 @@ from isctest.asyncserver import (
from isctest.asyncserver.actions import DnsResponseSend
from isctest.asyncserver.commands import SwitchControlCommand
from isctest.asyncserver.handlers import AxfrHandler, ResponseHandlerWrapper
-from isctest.asyncserver.matchers import Qtype
+from isctest.asyncserver.matchers import Edns, Qtype
from isctest.vars.algorithms import ALG_VARS
GOOD_KEY_DATA = "LSAnCU+Z"
@@ -302,8 +302,7 @@ class AxfrEdnsRcodeHandler(ResponseHandler):
def __init__(self, rcode: dns.rcode.Rcode) -> None:
self._rcode = rcode
- def match(self, qctx: QueryContext) -> bool:
- return qctx.qtype == dns.rdatatype.AXFR and qctx.query.edns > -1
+ matcher = Qtype(dns.rdatatype.AXFR) & Edns()
async def get_responses(
self, qctx: QueryContext