]> git.ipfire.org Git - thirdparty/bind9.git/commit
Set up stale response lookup before query_done() is called
authorMichał Kępień <michal@isc.org>
Mon, 8 Oct 2018 10:47:28 +0000 (12:47 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 8 Oct 2018 10:47:28 +0000 (12:47 +0200)
commitcb48d410d89929bbc161a16ab95fb53fd311e5a9
tree9b0b2e55f12792db491aff2d4f76675375457f91
parente8f66bcfa36b89586319372a7fe626fbf4e49a03
Set up stale response lookup before query_done() is called

When something goes wrong while recursing for an answer to a query,
query_gotanswer() sets a flag (qctx->want_stale) in the query context.
query_done() is subsequently called and it can either set up a stale
response lookup (if serve-stale is enabled) or conclude that a SERVFAIL
response should be sent.  This may cause confusion when looking at query
error logs since the QUERY_ERROR() line responsible for setting the
response's RCODE to SERVFAIL is not in a catch-all branch of a switch
statement inside query_gotanswer() (like it is for authoritative
responses) but rather in a code branch which appears to have something
to do with serve-stale, even when the latter is not enabled.

Extract the part of query_done() responsible for checking serve-stale
configuration and optionally setting up a stale response lookup into a
separate function, query_usestale(), shifting the responsibility for
setting the response's RCODE to SERVFAIL to the same QUERY_ERROR() line
in query_gotanswer() which is evaluated for authoritative responses.
lib/ns/query.c