1
0
mirror of https://gitlab.isc.org/isc-projects/bind9.git synced 2025-04-18 09:44:09 +03:00

Add debug logs for response handler matching

With multiple and/or dynamically managed response handlers at play, it
becomes useful for debugging purposes to know which handler (if any) was
used for preparing each response sent by the server.  Add debug logs
providing that information.  Make class name the default string
representation of each response handler to prettify logs.
This commit is contained in:
Michał Kępień 2025-04-11 09:14:57 -05:00
parent 92b072bff4
commit 5e71fd081e
No known key found for this signature in database

View File

@ -394,6 +394,9 @@ class ResponseHandler(abc.ABC):
"""
yield DnsResponseSend(qctx.response)
def __str__(self) -> str:
return self.__class__.__name__
class IgnoreAllQueries(ResponseHandler):
"""
@ -778,6 +781,7 @@ class AsyncDnsServer(AsyncServer):
response_handled = True
if not response_handled:
logging.debug("Responding based on zone data")
yield qctx.response
def _prepare_response_from_zone_data(self, qctx: QueryContext) -> None:
@ -911,6 +915,7 @@ class AsyncDnsServer(AsyncServer):
"""
for handler in self._response_handlers:
if handler.match(qctx):
logging.debug("Matched response handler: %s", handler)
async for response in handler.get_responses(qctx):
yield response
return