From fcb1a1a0a4e9c8d20afab39a8174258f21efa052 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Thu, 8 Dec 2022 13:14:03 +0100 Subject: [PATCH] rec: Document preoutquery limitations Fixes #10247 --- pdns/recursordist/docs/lua-scripting/hooks.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pdns/recursordist/docs/lua-scripting/hooks.rst b/pdns/recursordist/docs/lua-scripting/hooks.rst index 20926a8456..789f63aa8b 100644 --- a/pdns/recursordist/docs/lua-scripting/hooks.rst +++ b/pdns/recursordist/docs/lua-scripting/hooks.rst @@ -178,11 +178,22 @@ Interception Functions .. function:: preoutquery(dq) -> bool This hook is not called in response to a client packet, but fires when the Recursor wants to talk to an authoritative server. - When this hook sets the special result code -3, the whole DNS client query causing this outquery gets a `ServFail`. + + When this hook sets the special result code ``-3``, the whole DNS client query causing this outgoing query gets a ``ServFail``. However, this function can also return records like :func:`preresolve`. - :param DNSQuestion dq: The DNS question to handle + :param DNSQuestion dq: The DNS question to handle. + + In the case of :func:`preoutquery`, only a few attributes if the :class:`dq ` object are filled in: + + - :attr:`dq.remoteaddr ` containing the target nameserver address + - :attr:`dq.localaddr ` + - :attr:`dq.qname ` + - :attr:`dq.qtype ` + - :attr:`dq.isTcp ` + + Do not rely on other attributes having a value and do not call any method of the :class:`dq ` object apart from the recordset manipulation methods. .. function:: policyEventFilter(event) -> bool -- 2.47.2