]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix invalid dns message state in resolver's logic
authorDiego Fronza <diego@isc.org>
Mon, 21 Sep 2020 20:32:39 +0000 (17:32 -0300)
committerMark Andrews <marka@isc.org>
Wed, 30 Sep 2020 01:34:57 +0000 (11:34 +1000)
commitdfa2b7a247d89475a11336bbb7412f1fc0729bce
treea4b4c087439b40dca3c5893585a5348f056f1760
parentda84f8d1fdfbe3b0187f94e70de571e5ed378404
Fix invalid dns message state in resolver's logic

The assertion failure REQUIRE(msg->state == DNS_SECTION_ANY), caused
by calling dns_message_setclass within function resquery_response()
in resolver.c, was happening due to wrong management of dns message_t
objects used to process responses to the queries issued by the
resolver.

Before the fix, a resolver's fetch context (fetchctx_t) would hold
a pointer to the message, this same reference would then be used
over all the attempts to resolve the query, trying next server,
etc... for this to work the message object would have it's state
reset between each iteration, marking it as ready for a new processing.

The problem arose in a scenario with many different forwarders
configured, managing the state of the dns_message_t object was
lacking better synchronization, which have led it to a invalid
dns_message_t state in resquery_response().

Instead of adding unnecessarily complex code to synchronize the
object, the dns_message_t object was moved from fetchctx_t structure
to the query structure, where it better belongs to, since each query
will produce a response, this way whenever a new query is created
an associated dns_messate_t is also created.

This commit deals mainly with moving the dns_message_t object from
fetchctx_t to the query structure.

(cherry picked from commit 02f9e125c15f3fbf7eedd760f0a5468845029c9c)
lib/dns/resolver.c