]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add a response handler for ignoring all queries
authorMichał Kępień <michal@isc.org>
Tue, 25 Mar 2025 04:01:34 +0000 (05:01 +0100)
committerMichał Kępień <michal@isc.org>
Tue, 25 Mar 2025 04:01:34 +0000 (05:01 +0100)
Dropping all incoming queries is a typical use case for a custom server
used in BIND 9 system tests.  Add a response handler implementing that
behavior so that it can be reused.

bin/tests/system/isctest/asyncserver.py

index 996db22893ce9e71b1dc74d95aea1c7412aecda1..dd2cf0c04cb025364dc1014e0cff7949f5ef8914 100644 (file)
@@ -383,6 +383,17 @@ class ResponseHandler(abc.ABC):
         yield DnsResponseSend(qctx.response)
 
 
+class IgnoreAllQueries(ResponseHandler):
+    """
+    Do not respond to any queries sent to the server.
+    """
+
+    async def get_responses(
+        self, qctx: QueryContext
+    ) -> AsyncGenerator[ResponseAction, None]:
+        yield ResponseDrop()
+
+
 class DomainHandler(ResponseHandler):
     """
     Base class used for deriving custom domain handlers.