]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Assert on unknown isc_quota_attach() return values
authorMichał Kępień <michal@isc.org>
Tue, 14 Jun 2022 11:13:32 +0000 (13:13 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 14 Jun 2022 11:13:32 +0000 (13:13 +0200)
The only values that the isc_quota_attach() function (called from
check_recursionquota() via recursionquotatype_attach_soft()) can
currently return are: ISC_R_SUCCESS, ISC_R_SOFTQUOTA, and ISC_R_QUOTA.
Instead of just propagating any other (unexpected) error up the call
stack, assert immediately, so that if the isc_quota_* API gets updated
in the future to return values currently matching the "default"
statement, check_recursionquota() can be promptly updated to handle such
new return values as desired.

lib/ns/query.c

index 53e621c4dbc094d424a59b52b10c8cb516d73ed2..8ce90668f590799b9bd08f2519db4a181e3115b9 100644 (file)
@@ -6357,9 +6357,9 @@ check_recursionquota(ns_client_t *client, ns_query_rectype_t recursion_type) {
                                   "no more recursive clients (%u/%u/%u)",
                                   &client->manager->sctx->recursionquota);
                ns_client_killoldestquery(client);
-               FALLTHROUGH;
-       default:
                return (result);
+       default:
+               UNREACHABLE();
        }
 
        dns_message_clonebuffer(client->message);