]> 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)
committerOndřej Surý <ondrej@sury.org>
Tue, 29 Sep 2020 06:22:08 +0000 (08:22 +0200)
commit02f9e125c15f3fbf7eedd760f0a5468845029c9c
tree8a250ea643a2ce0348000806c3165a6edca0a6a2
parent12d6d13100c9b5b39d75342727710fdadb7df52f
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.
lib/dns/resolver.c