resolved: refuse queries with no suitable scope

In some cases there is no configured server to answer a given question,
because all scopes refused the query. In this case we currently return
rcode SERVFAIL.

In dns it is customary for authoritative nameservers to return REFUSED
where the question is outside of their authority. This is better than
SERVFAIL because it informs the client that they aren't likely to get an
answer out of us anytime soon, and either the configuration, or the
query, need to change.

Similar logic invites us to use use the rcode REFUSED on the stub if we
aren't configured with any suitable scope for this question.
This commit is contained in:
Ronan Pigott
2024-03-07 15:29:37 -07:00
parent 4e17de7fee
commit 4f2da49fcd
+4
View File
@@ -837,6 +837,10 @@ static void dns_stub_query_complete(DnsQuery *query) {
break;
case DNS_TRANSACTION_NO_SERVERS:
/* We're not configured to give answers for this question. Refuse it. */
(void) dns_stub_send_reply(q, DNS_RCODE_REFUSED);
break;
case DNS_TRANSACTION_INVALID_REPLY:
case DNS_TRANSACTION_ERRNO:
case DNS_TRANSACTION_ABORTED: