mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 03:59:59 -04:00
Allow users of AsyncDnsServer to set AA bit for all responses
Previously, all responses had to be set as authoritative explicitly using DnsResponseSend(..., authoritative=True). After using this, it became obvious that this is obnoxious. Add an optional keyword-only parameter to AsyncDnsServer that sets the default value of the AA bit on outgoing responses. Make all the other parameters keyword-only as well.
This commit is contained in:
parent
a0970f3d04
commit
6e684d44e0
1 changed files with 5 additions and 0 deletions
|
|
@ -773,7 +773,9 @@ class AsyncDnsServer(AsyncServer):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
/,
|
||||||
default_rcode: dns.rcode.Rcode = dns.rcode.REFUSED,
|
default_rcode: dns.rcode.Rcode = dns.rcode.REFUSED,
|
||||||
|
default_aa: bool = True,
|
||||||
acknowledge_manual_dname_handling: bool = False,
|
acknowledge_manual_dname_handling: bool = False,
|
||||||
acknowledge_tsig_dnspython_hacks: bool = False,
|
acknowledge_tsig_dnspython_hacks: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
@ -783,6 +785,7 @@ class AsyncDnsServer(AsyncServer):
|
||||||
self._connection_handler: Optional[ConnectionHandler] = None
|
self._connection_handler: Optional[ConnectionHandler] = None
|
||||||
self._response_handlers: List[ResponseHandler] = []
|
self._response_handlers: List[ResponseHandler] = []
|
||||||
self._default_rcode = default_rcode
|
self._default_rcode = default_rcode
|
||||||
|
self._default_aa = default_aa
|
||||||
self._acknowledge_manual_dname_handling = acknowledge_manual_dname_handling
|
self._acknowledge_manual_dname_handling = acknowledge_manual_dname_handling
|
||||||
self._acknowledge_tsig_dnspython_hacks = acknowledge_tsig_dnspython_hacks
|
self._acknowledge_tsig_dnspython_hacks = acknowledge_tsig_dnspython_hacks
|
||||||
|
|
||||||
|
|
@ -1101,6 +1104,8 @@ class AsyncDnsServer(AsyncServer):
|
||||||
Yield response(s) either from response handlers or zone data.
|
Yield response(s) either from response handlers or zone data.
|
||||||
"""
|
"""
|
||||||
qctx.response.set_rcode(self._default_rcode)
|
qctx.response.set_rcode(self._default_rcode)
|
||||||
|
if self._default_aa:
|
||||||
|
qctx.response.flags |= dns.flags.AA
|
||||||
|
|
||||||
self._prepare_response_from_zone_data(qctx)
|
self._prepare_response_from_zone_data(qctx)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue