diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 26c3106547..e0210cfbd3 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index db5289d1e3..998171662c 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include #include #include diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c index 31cfe21aa5..a6526268b4 100644 --- a/bin/confgen/rndc-confgen.c +++ b/bin/confgen/rndc-confgen.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include +#include #include #include diff --git a/bin/confgen/tsig-keygen.c b/bin/confgen/tsig-keygen.c index 9dede3e3cf..ee6470d9e9 100644 --- a/bin/confgen/tsig-keygen.c +++ b/bin/confgen/tsig-keygen.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ #include #include +#include #include #include diff --git a/bin/delv/delv.c b/bin/delv/delv.c index 64bbfa7d42..2088088d46 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 67056ec490..eb4290a0dd 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dig/host.c b/bin/dig/host.c index 6ecf441e8d..1f93d8eb72 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index bef5822b37..ca36291881 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-cds.c b/bin/dnssec/dnssec-cds.c index 70f8f477c7..fbf319c356 100644 --- a/bin/dnssec/dnssec-cds.c +++ b/bin/dnssec/dnssec-cds.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index 8a8b03c2d9..00c1bab86e 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c index 6e9f3e3af1..95ac0256ba 100644 --- a/bin/dnssec/dnssec-importkey.c +++ b/bin/dnssec/dnssec-importkey.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index c302528c77..3b8899960b 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 849327e61d..36ed720ec8 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-ksr.c b/bin/dnssec/dnssec-ksr.c index 0a929ee3b2..95b1e4b7e5 100644 --- a/bin/dnssec/dnssec-ksr.c +++ b/bin/dnssec/dnssec-ksr.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-revoke.c b/bin/dnssec/dnssec-revoke.c index 603ec000e4..5f54ad297c 100644 --- a/bin/dnssec/dnssec-revoke.c +++ b/bin/dnssec/dnssec-revoke.c @@ -23,12 +23,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c index e70e95cbda..7f14e0fc38 100644 --- a/bin/dnssec/dnssec-settime.c +++ b/bin/dnssec/dnssec-settime.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +#include #include diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 748f28f3bc..8461134e67 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +72,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c index 2c22e3f8cf..14a19277b0 100644 --- a/bin/dnssec/dnssec-verify.c +++ b/bin/dnssec/dnssec-verify.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/named/main.c b/bin/named/main.c index c7547da9c9..81af56c153 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include +#include #include #include #include diff --git a/bin/named/server.c b/bin/named/server.c index 14bf29d826..2310b167ec 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -7912,7 +7912,7 @@ load_configuration(const char *filename, named_server_t *server, /* * Shut down all dyndb instances. */ - dns_dyndb_cleanup(false); + dns_dyndb_cleanup(); /* * Parse the global default pseudo-config file. @@ -9591,7 +9591,7 @@ shutdown_server(void *arg) { /* * Shut down all dyndb instances. */ - dns_dyndb_cleanup(true); + dns_dyndb_cleanup(); while ((nsc = ISC_LIST_HEAD(server->cachelist)) != NULL) { ISC_LIST_UNLINK(server->cachelist, nsc, link); diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 8b1a1cd91c..4df131de2f 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -97,7 +97,7 @@ typedef struct stats_dumparg { isc_result_t result; } stats_dumparg_t; -static isc_once_t once = ISC_ONCE_INIT; +static isc_once_t once = ISC_ONCE_INITIALIZER; #if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C) #define EXTENDED_STATS diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 524c9ac3f3..93e05a30fa 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 38b1caf775..1e9e1f0d1a 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ #include #include +#include #include #include diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c index 11481f3bbb..f39922dcbc 100644 --- a/bin/tests/system/feature-test.c +++ b/bin/tests/system/feature-test.c @@ -24,12 +24,14 @@ #endif #include +#include #include #include #include #include #include +#include #include diff --git a/bin/tests/system/makejournal.c b/bin/tests/system/makejournal.c index 1cbe75b699..94a92b9a73 100644 --- a/bin/tests/system/makejournal.c +++ b/bin/tests/system/makejournal.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/bin/tests/system/pipelined/pipequeries.c b/bin/tests/system/pipelined/pipequeries.c index c9b7f6a119..fcfb50ccd0 100644 --- a/bin/tests/system/pipelined/pipequeries.c +++ b/bin/tests/system/pipelined/pipequeries.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +#include #include #include #include diff --git a/bin/tests/system/rsabigexponent/bigkey.c b/bin/tests/system/rsabigexponent/bigkey.c index a8d4241c2a..2ae0f3dec0 100644 --- a/bin/tests/system/rsabigexponent/bigkey.c +++ b/bin/tests/system/rsabigexponent/bigkey.c @@ -15,12 +15,15 @@ #include #include +#include #include #include #include #include #include +#include + #define DST_KEY_INTERNAL #include diff --git a/bin/tests/test_client.c b/bin/tests/test_client.c index 25a341d177..4d737bc054 100644 --- a/bin/tests/test_client.c +++ b/bin/tests/test_client.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/bin/tests/test_server.c b/bin/tests/test_server.c index beb723a65c..b26ea20dab 100644 --- a/bin/tests/test_server.c +++ b/bin/tests/test_server.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/bin/tests/wire_test.c b/bin/tests/wire_test.c index 26a84c4bac..bf130c7fc3 100644 --- a/bin/tests/wire_test.c +++ b/bin/tests/wire_test.c @@ -18,11 +18,13 @@ #include #include #include +#include #include #include #include #include +#include #include int parseflags = 0; diff --git a/bin/tools/arpaname.c b/bin/tools/arpaname.c index 5428c97672..bf47f601b6 100644 --- a/bin/tools/arpaname.c +++ b/bin/tools/arpaname.c @@ -13,6 +13,7 @@ #include +#include #include #define UNUSED(x) (void)(x) diff --git a/bin/tools/dnstap-read.c b/bin/tools/dnstap-read.c index 9127fba967..501d70ad96 100644 --- a/bin/tools/dnstap-read.c +++ b/bin/tools/dnstap-read.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include +#include #include #include #include diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index c4880041a9..58d60b42b5 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/tools/named-journalprint.c b/bin/tools/named-journalprint.c index f5eb1e2368..c8fcc2b75e 100644 --- a/bin/tools/named-journalprint.c +++ b/bin/tools/named-journalprint.c @@ -16,12 +16,14 @@ #include #include +#include #include #include #include #include #include +#include #include const char *progname = NULL; diff --git a/bin/tools/named-nzd2nzf.c b/bin/tools/named-nzd2nzf.c index 42be33f7fc..18a5791ea8 100644 --- a/bin/tools/named-nzd2nzf.c +++ b/bin/tools/named-nzd2nzf.c @@ -19,6 +19,9 @@ #include #include +#include + +/* Included just to get DNS_LMDB_FLAGS definition */ #include int diff --git a/bin/tools/named-rrchecker.c b/bin/tools/named-rrchecker.c index d856756a5c..2de1d31bf8 100644 --- a/bin/tools/named-rrchecker.c +++ b/bin/tools/named-rrchecker.c @@ -19,12 +19,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/bin/tools/nsec3hash.c b/bin/tools/nsec3hash.c index dbba2d91b4..0ddc6fa067 100644 --- a/bin/tools/nsec3hash.c +++ b/bin/tools/nsec3hash.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/doc/misc/cfg_test.c b/doc/misc/cfg_test.c index e0df72edb4..64c64d2700 100644 --- a/doc/misc/cfg_test.c +++ b/doc/misc/cfg_test.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/fuzz/main.c b/fuzz/main.c index 9863df52f2..86fa159e33 100644 --- a/fuzz/main.c +++ b/fuzz/main.c @@ -20,6 +20,10 @@ #include #include +#include + +#include + #include "fuzz.h" #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION diff --git a/lib/dns/Makefile.am b/lib/dns/Makefile.am index 1733fdccf4..a93feaebfb 100644 --- a/lib/dns/Makefile.am +++ b/lib/dns/Makefile.am @@ -86,6 +86,7 @@ libdns_la_HEADERS = \ include/dns/keystore.h \ include/dns/keytable.h \ include/dns/keyvalues.h \ + include/dns/lib.h \ include/dns/master.h \ include/dns/masterdump.h \ include/dns/message.h \ @@ -153,6 +154,7 @@ libdns_la_SOURCES = \ $(dst_HEADERS) \ $(irs_HEADERS) \ acl.c \ + acl_p.h \ adb.c \ badcache.c \ byaddr.c \ @@ -168,6 +170,7 @@ libdns_la_SOURCES = \ diff.c \ dispatch.c \ dlz.c \ + dlz_p.h \ dns64.c \ dnssec.c \ ds.c \ @@ -177,6 +180,7 @@ libdns_la_SOURCES = \ dst_parse.c \ dst_parse.h \ dyndb.c \ + dyndb_p.h \ ecs.c \ ede.c \ fixedname.c \ @@ -192,6 +196,7 @@ libdns_la_SOURCES = \ keymgr.c \ keystore.c \ keytable.c \ + lib.c \ master.c \ masterdump.c \ message.c \ diff --git a/lib/dns/acl.c b/lib/dns/acl.c index 244995c995..c0e51f55a7 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -25,6 +25,8 @@ #include #include +#include "acl_p.h" + #define DNS_ACLENV_MAGIC ISC_MAGIC('a', 'c', 'n', 'v') #define VALID_ACLENV(a) ISC_MAGIC_VALID(a, DNS_ACLENV_MAGIC) @@ -507,15 +509,19 @@ ISC_REFCOUNT_TRACE_IMPL(dns_acl, dns__acl_destroy); ISC_REFCOUNT_IMPL(dns_acl, dns__acl_destroy); #endif -static isc_once_t insecure_prefix_once = ISC_ONCE_INIT; static isc_mutex_t insecure_prefix_lock; static bool insecure_prefix_found; -static void -initialize_action(void) { +void +dns__acl_initialize(void) { isc_mutex_init(&insecure_prefix_lock); } +void +dns__acl_shutdown(void) { + isc_mutex_destroy(&insecure_prefix_lock); +} + /* * Called via isc_radix_process() to find IP table nodes that are * insecure. @@ -566,8 +572,6 @@ dns_acl_isinsecure(const dns_acl_t *a) { unsigned int i; bool insecure; - isc_once_do(&insecure_prefix_once, initialize_action); - /* * Walk radix tree to find out if there are any non-negated, * non-loopback prefixes. diff --git a/lib/dns/acl_p.h b/lib/dns/acl_p.h new file mode 100644 index 0000000000..8ab305ff3b --- /dev/null +++ b/lib/dns/acl_p.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#pragma once + +/*! \file */ + +void +dns__acl_initialize(void); +void +dns__acl_shutdown(void); diff --git a/lib/dns/db.c b/lib/dns/db.c index 8add76f644..90ac276bc5 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -69,13 +68,12 @@ unsigned int dns_pps = 0U; static ISC_LIST(dns_dbimplementation_t) implementations; static isc_rwlock_t implock; -static isc_once_t once = ISC_ONCE_INIT; static dns_dbimplementation_t qpimp; static dns_dbimplementation_t qpzoneimp; -static void -initialize(void) { +void +dns__db_initialize(void) { isc_rwlock_init(&implock); ISC_LIST_INIT(implementations); @@ -96,6 +94,11 @@ initialize(void) { ISC_LIST_APPEND(implementations, &qpzoneimp, link); } +void +dns__db_shutdown(void) { + isc_rwlock_destroy(&implock); +} + static dns_dbimplementation_t * impfind(const char *name) { dns_dbimplementation_t *imp; @@ -123,8 +126,6 @@ dns_db_create(isc_mem_t *mctx, const char *db_type, const dns_name_t *origin, char *argv[], dns_db_t **dbp) { dns_dbimplementation_t *impinfo = NULL; - isc_once_do(&once, initialize); - /* * Create a new database using implementation 'db_type'. */ @@ -831,8 +832,6 @@ dns_db_register(const char *name, dns_dbcreatefunc_t create, void *driverarg, REQUIRE(name != NULL); REQUIRE(dbimp != NULL && *dbimp == NULL); - isc_once_do(&once, initialize); - RWLOCK(&implock, isc_rwlocktype_write); imp = impfind(name); if (imp != NULL) { @@ -861,8 +860,6 @@ dns_db_unregister(dns_dbimplementation_t **dbimp) { REQUIRE(dbimp != NULL && *dbimp != NULL); - isc_once_do(&once, initialize); - imp = *dbimp; *dbimp = NULL; RWLOCK(&implock, isc_rwlocktype_write); diff --git a/lib/dns/db_p.h b/lib/dns/db_p.h index 132f8e0464..2db152ec1f 100644 --- a/lib/dns/db_p.h +++ b/lib/dns/db_p.h @@ -193,3 +193,11 @@ dns__db_logtoomanyrecords(dns_db_t *db, const dns_name_t *name, * 'maxrrperset' limit. 'op' is 'adding' or 'updating' depending on whether * the addition is to create a new rdataset or to merge to an existing one. */ + +/*% + * Internal dns_db constructor and destructor. + */ +void +dns__db_initialize(void); +void +dns__db_shutdown(void); diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c index 1525db56b6..b6d41678ed 100644 --- a/lib/dns/dlz.c +++ b/lib/dns/dlz.c @@ -60,7 +60,6 @@ #include #include #include -#include #include #include #include @@ -73,20 +72,26 @@ #include #include +#include "dlz_p.h" + /*** *** Supported DLZ DB Implementations Registry ***/ static ISC_LIST(dns_dlzimplementation_t) dlz_implementations; static isc_rwlock_t dlz_implock; -static isc_once_t once = ISC_ONCE_INIT; -static void -dlz_initialize(void) { +void +dns__dlz_initialize(void) { isc_rwlock_init(&dlz_implock); ISC_LIST_INIT(dlz_implementations); } +void +dns__dlz_shutdown(void) { + isc_rwlock_destroy(&dlz_implock); +} + /*% * Searches the dlz_implementations list for a driver matching name. */ @@ -162,12 +167,6 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername, isc_result_t result; dns_dlzdb_t *db = NULL; - /* - * initialize the dlz_implementations list, this is guaranteed - * to only really happen once. - */ - isc_once_do(&once, dlz_initialize); - /* * Performs checks to make sure data is as we expect it to be. */ @@ -291,12 +290,6 @@ dns_dlzregister(const char *drivername, const dns_dlzmethods_t *methods, REQUIRE(mctx != NULL); REQUIRE(dlzimp != NULL && *dlzimp == NULL); - /* - * initialize the dlz_implementations list, this is guaranteed - * to only really happen once. - */ - isc_once_do(&once, dlz_initialize); - /* lock the dlz_implementations list so we can modify it. */ RWLOCK(&dlz_implock, isc_rwlocktype_write); @@ -372,12 +365,6 @@ dns_dlzunregister(dns_dlzimplementation_t **dlzimp) { */ REQUIRE(dlzimp != NULL && *dlzimp != NULL); - /* - * initialize the dlz_implementations list, this is guaranteed - * to only really happen once. - */ - isc_once_do(&once, dlz_initialize); - dlz_imp = *dlzimp; /* lock the dlz_implementations list so we can modify it. */ diff --git a/lib/dns/dlz_p.h b/lib/dns/dlz_p.h new file mode 100644 index 0000000000..030aa5d624 --- /dev/null +++ b/lib/dns/dlz_p.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#pragma once + +/*! \file */ + +void +dns__dlz_initialize(void); +void +dns__dlz_shutdown(void); diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index 4db3ea2901..5920987337 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -190,12 +190,7 @@ addsuffix(char *filename, int len, const char *dirname, const char *ofilename, static isc_mem_t *dst__mctx = NULL; void -dst__lib_init(void) ISC_CONSTRUCTOR; -void -dst__lib_destroy(void) ISC_DESTRUCTOR; - -void -dst__lib_init(void) { +dst__lib_initialize(void) { isc_mem_create(&dst__mctx); dst__hmacmd5_init(&dst_t_func[DST_ALG_HMACMD5]); @@ -224,7 +219,7 @@ dst__lib_init(void) { } void -dst__lib_destroy(void) { +dst__lib_shutdown(void) { for (size_t i = 0; i < DST_MAX_ALGS; i++) { if (dst_t_func[i] != NULL && dst_t_func[i]->cleanup != NULL) { dst_t_func[i]->cleanup(); diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h index cc57468f4f..731d4b8602 100644 --- a/lib/dns/dst_internal.h +++ b/lib/dns/dst_internal.h @@ -224,4 +224,12 @@ dst_key_close(char *tmpname, FILE *fp, char *filename); isc_result_t dst_key_cleanup(char *tmpname, FILE *fp); +/*% + * Library constructor and destructor. + */ +void +dst__lib_initialize(void); +void +dst__lib_shutdown(void); + /*! \file */ diff --git a/lib/dns/dyndb.c b/lib/dns/dyndb.c index 6535c1d045..b4ead8dcfa 100644 --- a/lib/dns/dyndb.c +++ b/lib/dns/dyndb.c @@ -11,13 +11,10 @@ * information regarding copyright ownership. */ -#include - #include #include #include #include -#include #include #include #include @@ -29,6 +26,8 @@ #include #include +#include "dyndb_p.h" + #define CHECK(op) \ do { \ result = (op); \ @@ -57,14 +56,18 @@ static LIST(dyndb_implementation_t) dyndb_implementations; /* Locks dyndb_implementations. */ static isc_mutex_t dyndb_lock; -static isc_once_t once = ISC_ONCE_INIT; -static void -dyndb_initialize(void) { +void +dns__dyndb_initialize(void) { isc_mutex_init(&dyndb_lock); INIT_LIST(dyndb_implementations); } +void +dns__dyndb_shutdown(void) { + isc_mutex_destroy(&dyndb_lock); +} + static dyndb_implementation_t * impfind(const char *name) { dyndb_implementation_t *imp; @@ -211,8 +214,6 @@ dns_dyndb_load(const char *libname, const char *name, const char *parameters, REQUIRE(DNS_DYNDBCTX_VALID(dctx)); REQUIRE(name != NULL); - isc_once_do(&once, dyndb_initialize); - LOCK(&dyndb_lock); /* duplicate instance names are not allowed */ @@ -239,12 +240,10 @@ cleanup: } void -dns_dyndb_cleanup(bool exiting) { +dns_dyndb_cleanup(void) { dyndb_implementation_t *elem; dyndb_implementation_t *prev; - isc_once_do(&once, dyndb_initialize); - LOCK(&dyndb_lock); elem = TAIL(dyndb_implementations); while (elem != NULL) { @@ -259,10 +258,6 @@ dns_dyndb_cleanup(bool exiting) { elem = prev; } UNLOCK(&dyndb_lock); - - if (exiting) { - isc_mutex_destroy(&dyndb_lock); - } } void diff --git a/lib/dns/dyndb_p.h b/lib/dns/dyndb_p.h new file mode 100644 index 0000000000..09bd7dbd34 --- /dev/null +++ b/lib/dns/dyndb_p.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#pragma once + +/*! \file */ + +void +dns__dyndb_initialize(void); +void +dns__dyndb_shutdown(void); diff --git a/lib/dns/include/dns/dyndb.h b/lib/dns/include/dns/dyndb.h index a54f710533..fe90baf177 100644 --- a/lib/dns/include/dns/dyndb.h +++ b/lib/dns/include/dns/dyndb.h @@ -117,12 +117,9 @@ dns_dyndb_load(const char *libname, const char *name, const char *parameters, */ void -dns_dyndb_cleanup(bool exiting); +dns_dyndb_cleanup(void); /*% * Shut down and destroy all running dyndb modules. - * - * 'exiting' indicates whether the server is shutting down, - * as opposed to merely being reconfigured. */ void diff --git a/lib/dns/include/dns/lib.h b/lib/dns/include/dns/lib.h new file mode 100644 index 0000000000..cb88744bbe --- /dev/null +++ b/lib/dns/include/dns/lib.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#pragma once + +#include + +#include +#include + +void +dns__lib_initialize(void); +void +dns__lib_shutdown(void); + +void +dns_lib_initialize(void) __attribute__((__constructor__)); +void +dns_lib_shutdown(void) __attribute__((__destructor__)); + +void +dns_lib_initialize(void) { + isc__lib_initialize(); + dns__lib_initialize(); +} +void +dns_lib_shutdown(void) { + dns__lib_shutdown(); + isc__lib_shutdown(); +} diff --git a/lib/dns/include/dst/dst.h b/lib/dns/include/dst/dst.h index 5eb6038059..4bcb026b1c 100644 --- a/lib/dns/include/dst/dst.h +++ b/lib/dns/include/dst/dst.h @@ -1226,7 +1226,7 @@ dst_key_setdirectory(dst_key_t *key, const char *dir); const char * dst_hmac_algorithm_totext(dst_algorithm_t alg); -/*$< +/*%< * Return the name associtated with the HMAC algorithm 'alg' * or return "unknown". */ diff --git a/lib/dns/lib.c b/lib/dns/lib.c new file mode 100644 index 0000000000..4825e37487 --- /dev/null +++ b/lib/dns/lib.c @@ -0,0 +1,63 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include +#include + +#include "acl_p.h" +#include "db_p.h" +#include "dlz_p.h" +#include "dst_internal.h" +#include "dyndb_p.h" +#include "qp_p.h" + +/*** + *** Functions + ***/ + +static isc_refcount_t dns__lib_references = 0; + +void +dns__lib_initialize(void); +void +dns__lib_shutdown(void); + +void +dns__lib_initialize(void) { + if (isc_refcount_increment0(&dns__lib_references) > 0) { + return; + } + + dst__lib_initialize(); + dns__acl_initialize(); + dns__dlz_initialize(); + dns__db_initialize(); + dns__dyndb_initialize(); + dns__qp_initialize(); +} + +void +dns__lib_shutdown(void) { + if (isc_refcount_decrement(&dns__lib_references) > 1) { + return; + } + + dns__qp_shutdown(); + dns__dyndb_shutdown(); + dns__db_shutdown(); + dns__dlz_shutdown(); + dns__acl_shutdown(); + dst__lib_shutdown(); +} diff --git a/lib/dns/qp.c b/lib/dns/qp.c index 888d8f5653..f7f38afb25 100644 --- a/lib/dns/qp.c +++ b/lib/dns/qp.c @@ -135,8 +135,6 @@ uint8_t dns_qp_byte_for_bit[SHIFT_OFFSET] = { 0 }; * Fill in the lookup tables at program startup. (It doesn't matter * when this is initialized relative to other startup code.) */ -static void -initialize_bits_for_byte(void) ISC_CONSTRUCTOR; /* * The bit positions for bytes inside labels have to be between @@ -153,8 +151,8 @@ initialize_bits_for_byte(void) ISC_CONSTRUCTOR; * After filling the table we ensure that the bit positions for * hostname characters and escape characters all fit. */ -static void -initialize_bits_for_byte(void) { +void +dns__qp_initialize(void) { /* zero common character marker not a valid shift position */ INSIST(0 < SHIFT_BITMAP); /* first bit is common byte or escape byte */ @@ -193,6 +191,11 @@ initialize_bits_for_byte(void) { ENSURE(bit_one < SHIFT_OFFSET); } +void +dns__qp_shutdown(void) { + /* Nothing */ +} + /* * Convert a DNS name into a trie lookup key. * diff --git a/lib/dns/qp_p.h b/lib/dns/qp_p.h index d7c65131e7..0206c5fd56 100644 --- a/lib/dns/qp_p.h +++ b/lib/dns/qp_p.h @@ -19,6 +19,8 @@ #pragma once +#include + /*********************************************************************** * * interior node basics @@ -925,3 +927,8 @@ extern uint16_t dns_qp_bits_for_byte[]; extern uint8_t dns_qp_byte_for_bit[]; /**********************************************************************/ + +void +dns__qp_initialize(void); +void +dns__qp_shutdown(void); diff --git a/lib/dns/rdata/in_1/wks_11.c b/lib/dns/rdata/in_1/wks_11.c index 4d6f22db9a..23eb3b032a 100644 --- a/lib/dns/rdata/in_1/wks_11.c +++ b/lib/dns/rdata/in_1/wks_11.c @@ -58,7 +58,7 @@ mygetservbyname(const char *name, const char *proto, long *port) { static isc_result_t fromtext_in_wks(ARGS_FROMTEXT) { - static isc_once_t once = ISC_ONCE_INIT; + static isc_once_t once = ISC_ONCE_INITIALIZER; isc_token_t token; isc_region_t region; struct in_addr addr; diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am index d60ccd03b1..7cdca91b47 100644 --- a/lib/isc/Makefile.am +++ b/lib/isc/Makefile.am @@ -42,6 +42,7 @@ libisc_la_HEADERS = \ include/isc/iterated_hash.h \ include/isc/job.h \ include/isc/lex.h \ + include/isc/lib.h \ include/isc/list.h \ include/isc/log.h \ include/isc/loop.h \ diff --git a/lib/isc/include/isc/lib.h b/lib/isc/include/isc/lib.h new file mode 100644 index 0000000000..ee918e7899 --- /dev/null +++ b/lib/isc/include/isc/lib.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#pragma once + +#include + +void +isc__lib_initialize(void); +void +isc__lib_shutdown(void); + +void +isc_lib_initialize(void) __attribute__((__constructor__)); +void +isc_lib_shutdown(void) __attribute__((__destructor__)); + +void +isc_lib_initialize(void) { + isc__lib_initialize(); +} + +void +isc_lib_shutdown(void) { + isc__lib_shutdown(); +} diff --git a/lib/isc/include/isc/once.h b/lib/isc/include/isc/once.h index 4771b5cb5e..d5cb73f2d7 100644 --- a/lib/isc/include/isc/once.h +++ b/lib/isc/include/isc/once.h @@ -21,7 +21,7 @@ typedef pthread_once_t isc_once_t; -#define ISC_ONCE_INIT PTHREAD_ONCE_INIT +#define ISC_ONCE_INITIALIZER PTHREAD_ONCE_INIT #define isc_once_do(op, f) \ { \ diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 5eec716ea2..6d0b537c0e 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -61,14 +61,6 @@ #define ISC_NONSTRING #endif /* __GNUC__ */ -#if HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR && HAVE_FUNC_ATTRIBUTE_DESTRUCTOR -#define ISC_CONSTRUCTOR __attribute__((constructor)) -#define ISC_DESTRUCTOR __attribute__((destructor)) -#else -#define ISC_CONSTRUCTOR -#define ISC_DESTRUCTOR -#endif - /*% * The opposite: silent warnings about stored values which are never read. */ diff --git a/lib/isc/lib.c b/lib/isc/lib.c index 9f1c6492df..4553f4a3b5 100644 --- a/lib/isc/lib.c +++ b/lib/isc/lib.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -29,21 +30,24 @@ #include "mutex_p.h" #include "os_p.h" -#ifndef ISC_CONSTRUCTOR -#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9. -#endif - /*** *** Functions ***/ -void -isc__initialize(void) ISC_CONSTRUCTOR; -void -isc__shutdown(void) ISC_DESTRUCTOR; +static isc_refcount_t isc__lib_references = 0; void -isc__initialize(void) { +isc__lib_initialize(void); +void +isc__lib_shutdown(void); + +void +isc__lib_initialize(void) { + if (isc_refcount_increment0(&isc__lib_references) > 0) { + return; + } + + rcu_register_thread(); isc__os_initialize(); isc__mutex_initialize(); isc__mem_initialize(); @@ -54,11 +58,14 @@ isc__initialize(void) { isc__hash_initialize(); isc__iterated_hash_initialize(); (void)isc_os_ncpus(); - rcu_register_thread(); } void -isc__shutdown(void) { +isc__lib_shutdown(void) { + if (isc_refcount_decrement(&isc__lib_references) > 1) { + return; + } + isc__iterated_hash_shutdown(); isc__xml_shutdown(); isc__uv_shutdown(); diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 8a23b0f46a..2651c503ab 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -112,8 +111,6 @@ struct element { static ISC_LIST(isc_mem_t) contexts; -static isc_once_t init_once = ISC_ONCE_INIT; -static isc_once_t shut_once = ISC_ONCE_INIT; static isc_mutex_t contextslock; struct isc_mem { @@ -413,8 +410,8 @@ mem_jemalloc_arena_destroy(unsigned int arenano) { #endif /* JEMALLOC_API_SUPPORTED */ } -static void -mem_initialize(void) { +void +isc__mem_initialize(void) { /* * Check if the values copied from jemalloc still match */ @@ -427,12 +424,7 @@ mem_initialize(void) { } void -isc__mem_initialize(void) { - isc_once_do(&init_once, mem_initialize); -} - -static void -mem_shutdown(void) { +isc__mem_shutdown(void) { bool empty; isc__mem_checkdestroyed(); @@ -446,11 +438,6 @@ mem_shutdown(void) { } } -void -isc__mem_shutdown(void) { - isc_once_do(&shut_once, mem_shutdown); -} - static void mem_create(isc_mem_t **ctxp, unsigned int debugging, unsigned int flags, unsigned int jemalloc_flags) { diff --git a/lib/isc/mutex.c b/lib/isc/mutex.c index e31ba1339c..ad1c4ce2cc 100644 --- a/lib/isc/mutex.c +++ b/lib/isc/mutex.c @@ -28,10 +28,9 @@ #include "mutex_p.h" pthread_mutexattr_t isc__mutex_init_attr; -static isc_once_t init_once = ISC_ONCE_INIT; -static void -mutex_initialize(void) { +void +isc__mutex_initialize(void) { RUNTIME_CHECK(pthread_mutexattr_init(&isc__mutex_init_attr) == 0); #if ISC_MUTEX_ERROR_CHECK RUNTIME_CHECK(pthread_mutexattr_settype(&isc__mutex_init_attr, @@ -43,11 +42,6 @@ mutex_initialize(void) { #endif } -void -isc__mutex_initialize(void) { - isc_once_do(&init_once, mutex_initialize); -} - void isc__mutex_shutdown(void) { /* noop */; diff --git a/tests/bench/ascii.c b/tests/bench/ascii.c index e2123cb294..4379e846c2 100644 --- a/tests/bench/ascii.c +++ b/tests/bench/ascii.c @@ -17,9 +17,12 @@ #include #include +#include #include #include +#include + #define SIZE (1024 * 1024) typedef void diff --git a/tests/bench/compress.c b/tests/bench/compress.c index 0df6abd22d..0660785ddc 100644 --- a/tests/bench/compress.c +++ b/tests/bench/compress.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,7 @@ #include #include +#include #include static void diff --git a/tests/bench/dns_name_fromwire.c b/tests/bench/dns_name_fromwire.c index a1d25b156a..ef7d393661 100644 --- a/tests/bench/dns_name_fromwire.c +++ b/tests/bench/dns_name_fromwire.c @@ -17,12 +17,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include "old.h" diff --git a/tests/bench/iterated_hash.c b/tests/bench/iterated_hash.c index 7d11c93a4c..1cc5755e8f 100644 --- a/tests/bench/iterated_hash.c +++ b/tests/bench/iterated_hash.c @@ -17,9 +17,11 @@ #include #include +#include #include #include +#include #include static void diff --git a/tests/bench/load-names.c b/tests/bench/load-names.c index b4790961b7..86772841ad 100644 --- a/tests/bench/load-names.c +++ b/tests/bench/load-names.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include +#include #include #include diff --git a/tests/bench/qp-dump.c b/tests/bench/qp-dump.c index 795fb3a662..5356511a13 100644 --- a/tests/bench/qp-dump.c +++ b/tests/bench/qp-dump.c @@ -17,10 +17,12 @@ #include #include #include +#include #include #include #include +#include #include #include diff --git a/tests/bench/qplookups.c b/tests/bench/qplookups.c index fd478f3e6f..12421c22f8 100644 --- a/tests/bench/qplookups.c +++ b/tests/bench/qplookups.c @@ -17,11 +17,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include diff --git a/tests/bench/qpmulti.c b/tests/bench/qpmulti.c index ec4d3e4244..13aded4098 100644 --- a/tests/bench/qpmulti.c +++ b/tests/bench/qpmulti.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include +#include #include #include diff --git a/tests/bench/siphash.c b/tests/bench/siphash.c index 8c1238537b..c6a6f4d88b 100644 --- a/tests/bench/siphash.c +++ b/tests/bench/siphash.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/tests/dns/acl_test.c b/tests/dns/acl_test.c index 443dd62748..85a08b0c23 100644 --- a/tests/dns/acl_test.c +++ b/tests/dns/acl_test.c @@ -24,10 +24,12 @@ #define UNIT_TESTING #include +#include #include #include #include +#include #include diff --git a/tests/dns/badcache_test.c b/tests/dns/badcache_test.c index 2e2695b0b7..07baa49e90 100644 --- a/tests/dns/badcache_test.c +++ b/tests/dns/badcache_test.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -38,6 +39,7 @@ #include #include #include +#include #include #include diff --git a/tests/dns/db_test.c b/tests/dns/db_test.c index f3be8a6614..d9b7a1047a 100644 --- a/tests/dns/db_test.c +++ b/tests/dns/db_test.c @@ -22,9 +22,12 @@ #define UNIT_TESTING #include +#include + #include #include #include +#include #include #include diff --git a/tests/dns/dbdiff_test.c b/tests/dns/dbdiff_test.c index f0fb8804f8..3c3f7ddd90 100644 --- a/tests/dns/dbdiff_test.c +++ b/tests/dns/dbdiff_test.c @@ -23,11 +23,13 @@ #define UNIT_TESTING #include +#include #include #include #include #include +#include #include #include diff --git a/tests/dns/dbiterator_test.c b/tests/dns/dbiterator_test.c index 30980700b9..67e19c71e5 100644 --- a/tests/dns/dbiterator_test.c +++ b/tests/dns/dbiterator_test.c @@ -23,10 +23,12 @@ #define UNIT_TESTING #include +#include #include #include #include +#include #include #include diff --git a/tests/dns/dbversion_test.c b/tests/dns/dbversion_test.c index 690cca8036..4ec3063f04 100644 --- a/tests/dns/dbversion_test.c +++ b/tests/dns/dbversion_test.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include #include #include diff --git a/tests/dns/diff_test.c b/tests/dns/diff_test.c index 66d6d9b015..ec93bb8c29 100644 --- a/tests/dns/diff_test.c +++ b/tests/dns/diff_test.c @@ -24,7 +24,10 @@ #define UNIT_TESTING #include +#include + #include +#include #include diff --git a/tests/dns/dispatch_test.c b/tests/dns/dispatch_test.c index 20530e9e91..7eecbc8bac 100644 --- a/tests/dns/dispatch_test.c +++ b/tests/dns/dispatch_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include +#include #include #include diff --git a/tests/dns/dns64_test.c b/tests/dns/dns64_test.c index ad547ae060..82b92c6517 100644 --- a/tests/dns/dns64_test.c +++ b/tests/dns/dns64_test.c @@ -23,12 +23,14 @@ #define UNIT_TESTING #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/tests/dns/dnstap_test.c b/tests/dns/dnstap_test.c index 45bdf2005f..a7156b7ba9 100644 --- a/tests/dns/dnstap_test.c +++ b/tests/dns/dnstap_test.c @@ -28,11 +28,13 @@ #include #include +#include #include #include #include #include +#include #include #include diff --git a/tests/dns/dst_test.c b/tests/dns/dst_test.c index 2121e3883e..871a4931ce 100644 --- a/tests/dns/dst_test.c +++ b/tests/dns/dst_test.c @@ -33,11 +33,14 @@ #include #include #include +#include #include #include #include #include +#include + #include #include "dst_internal.h" diff --git a/tests/dns/ede_test.c b/tests/dns/ede_test.c index 76761cfb8f..bbfad7d844 100644 --- a/tests/dns/ede_test.c +++ b/tests/dns/ede_test.c @@ -24,9 +24,11 @@ #define UNIT_TESTING #include +#include #include #include +#include #include "../../lib/dns/ede.c" diff --git a/tests/dns/geoip_test.c b/tests/dns/geoip_test.c index 89a7fc6e30..defca69c8f 100644 --- a/tests/dns/geoip_test.c +++ b/tests/dns/geoip_test.c @@ -26,11 +26,13 @@ #include #include +#include #include #include #include #include +#include #include "geoip2.c" diff --git a/tests/dns/keytable_test.c b/tests/dns/keytable_test.c index 581e161b80..5b0ba19a3a 100644 --- a/tests/dns/keytable_test.c +++ b/tests/dns/keytable_test.c @@ -26,11 +26,13 @@ #include #include +#include #include #include #include #include +#include #include #include #include diff --git a/tests/dns/master_test.c b/tests/dns/master_test.c index 5c1a9bcc0b..0de8a9e02e 100644 --- a/tests/dns/master_test.c +++ b/tests/dns/master_test.c @@ -25,12 +25,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/tests/dns/name_test.c b/tests/dns/name_test.c index 4cb3b9cce7..8f159b9d27 100644 --- a/tests/dns/name_test.c +++ b/tests/dns/name_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +#include #include #include diff --git a/tests/dns/nametree_test.c b/tests/dns/nametree_test.c index 71197ba345..e0384d0c85 100644 --- a/tests/dns/nametree_test.c +++ b/tests/dns/nametree_test.c @@ -26,10 +26,12 @@ #include #include +#include #include #include #include +#include #include #include diff --git a/tests/dns/nsec3_test.c b/tests/dns/nsec3_test.c index dd772d1cff..957237e5cb 100644 --- a/tests/dns/nsec3_test.c +++ b/tests/dns/nsec3_test.c @@ -23,10 +23,12 @@ #define UNIT_TESTING #include +#include #include #include #include +#include #include #include diff --git a/tests/dns/nsec3param_test.c b/tests/dns/nsec3param_test.c index 0892d931a3..35e3ce0343 100644 --- a/tests/dns/nsec3param_test.c +++ b/tests/dns/nsec3param_test.c @@ -24,11 +24,13 @@ #include #include +#include #include #include #include #include +#include #include #include "zone_p.h" diff --git a/tests/dns/private_test.c b/tests/dns/private_test.c index c40bd7f23c..2bd8b366fb 100644 --- a/tests/dns/private_test.c +++ b/tests/dns/private_test.c @@ -24,8 +24,10 @@ #include #include +#include #include +#include #include #include #include diff --git a/tests/dns/qp_test.c b/tests/dns/qp_test.c index f8c0954bee..8abfdd11fd 100644 --- a/tests/dns/qp_test.c +++ b/tests/dns/qp_test.c @@ -23,6 +23,7 @@ #define UNIT_TESTING #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include +#include #include #include diff --git a/tests/dns/qpdb_test.c b/tests/dns/qpdb_test.c index 6adac9faca..73931889df 100644 --- a/tests/dns/qpdb_test.c +++ b/tests/dns/qpdb_test.c @@ -23,8 +23,10 @@ #define UNIT_TESTING #include +#include #include +#include #include #include #include diff --git a/tests/dns/qpmulti_test.c b/tests/dns/qpmulti_test.c index 90d246ec7a..11ff466e34 100644 --- a/tests/dns/qpmulti_test.c +++ b/tests/dns/qpmulti_test.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +#include #include #include diff --git a/tests/dns/qpzone_test.c b/tests/dns/qpzone_test.c index 13a885016f..e3c693d4a9 100644 --- a/tests/dns/qpzone_test.c +++ b/tests/dns/qpzone_test.c @@ -23,8 +23,10 @@ #define UNIT_TESTING #include +#include #include +#include #include #include #include diff --git a/tests/dns/rdata_test.c b/tests/dns/rdata_test.c index 85ed8056ed..8a22fb9e4c 100644 --- a/tests/dns/rdata_test.c +++ b/tests/dns/rdata_test.c @@ -30,10 +30,12 @@ #include #include #include +#include #include #include #include +#include #include #include "../isc/openssl_shim.c" diff --git a/tests/dns/rdataset_test.c b/tests/dns/rdataset_test.c index fc21b29f9d..bd5674446c 100644 --- a/tests/dns/rdataset_test.c +++ b/tests/dns/rdataset_test.c @@ -23,8 +23,10 @@ #define UNIT_TESTING #include +#include #include +#include #include #include diff --git a/tests/dns/rdatasetstats_test.c b/tests/dns/rdatasetstats_test.c index 8cfbebcc9a..57acff6ac1 100644 --- a/tests/dns/rdatasetstats_test.c +++ b/tests/dns/rdatasetstats_test.c @@ -24,8 +24,10 @@ #define UNIT_TESTING #include +#include #include +#include #include #include diff --git a/tests/dns/resconf_test.c b/tests/dns/resconf_test.c index dae666a6a5..33e6aa8b47 100644 --- a/tests/dns/resconf_test.c +++ b/tests/dns/resconf_test.c @@ -24,9 +24,12 @@ #define UNIT_TESTING #include +#include #include #include +#include + #include #include diff --git a/tests/dns/resolver_test.c b/tests/dns/resolver_test.c index 200c20e1c1..86c5931f78 100644 --- a/tests/dns/resolver_test.c +++ b/tests/dns/resolver_test.c @@ -23,12 +23,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/tests/dns/rsa_test.c b/tests/dns/rsa_test.c index f634621943..c1d44fa3f5 100644 --- a/tests/dns/rsa_test.c +++ b/tests/dns/rsa_test.c @@ -31,8 +31,11 @@ #define UNIT_TESTING #include +#include #include +#include + #include "dst_internal.h" #include diff --git a/tests/dns/sigs_test.c b/tests/dns/sigs_test.c index f5679d9832..277d4e9db7 100644 --- a/tests/dns/sigs_test.c +++ b/tests/dns/sigs_test.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/dns/skr_test.c b/tests/dns/skr_test.c index c00baaa5ee..a0038c6ddc 100644 --- a/tests/dns/skr_test.c +++ b/tests/dns/skr_test.c @@ -26,12 +26,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/tests/dns/time_test.c b/tests/dns/time_test.c index f6e19481f4..8002c0ed21 100644 --- a/tests/dns/time_test.c +++ b/tests/dns/time_test.c @@ -23,8 +23,10 @@ #define UNIT_TESTING #include +#include #include +#include #include #include diff --git a/tests/dns/transport_test.c b/tests/dns/transport_test.c index 5bf07a149f..e2186971d4 100644 --- a/tests/dns/transport_test.c +++ b/tests/dns/transport_test.c @@ -24,9 +24,11 @@ #define UNIT_TESTING #include +#include #include #include +#include #include #include diff --git a/tests/dns/tsig_test.c b/tests/dns/tsig_test.c index 5dd7a423b5..7a52f7d2f5 100644 --- a/tests/dns/tsig_test.c +++ b/tests/dns/tsig_test.c @@ -23,11 +23,13 @@ #define UNIT_TESTING #include +#include #include #include #include #include +#include #include #include #include diff --git a/tests/dns/update_test.c b/tests/dns/update_test.c index 653f34ebbe..37cad32890 100644 --- a/tests/dns/update_test.c +++ b/tests/dns/update_test.c @@ -24,10 +24,12 @@ #define UNIT_TESTING #include +#include #include #include #include +#include #include #define KEEP_BEFORE diff --git a/tests/dns/zonemgr_test.c b/tests/dns/zonemgr_test.c index 0424e911d5..fff8322482 100644 --- a/tests/dns/zonemgr_test.c +++ b/tests/dns/zonemgr_test.c @@ -24,9 +24,11 @@ #include #include +#include #include #include +#include #include #include #include diff --git a/tests/dns/zt_test.c b/tests/dns/zt_test.c index 3e4dc37b06..eea991afd6 100644 --- a/tests/dns/zt_test.c +++ b/tests/dns/zt_test.c @@ -26,12 +26,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/tests/isc/ascii_test.c b/tests/isc/ascii_test.c index f49b64b9e2..141eae4c64 100644 --- a/tests/isc/ascii_test.c +++ b/tests/isc/ascii_test.c @@ -22,6 +22,7 @@ #include #include +#include #include diff --git a/tests/isc/async_test.c b/tests/isc/async_test.c index bfc417362d..ea8d543919 100644 --- a/tests/isc/async_test.c +++ b/tests/isc/async_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/buffer_test.c b/tests/isc/buffer_test.c index fe6d2bcc27..3edc8dd1b2 100644 --- a/tests/isc/buffer_test.c +++ b/tests/isc/buffer_test.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/counter_test.c b/tests/isc/counter_test.c index 594d948f47..f9654e4e0c 100644 --- a/tests/isc/counter_test.c +++ b/tests/isc/counter_test.c @@ -23,6 +23,7 @@ #include #include +#include #include #include diff --git a/tests/isc/dnsstream_utils_test.c b/tests/isc/dnsstream_utils_test.c index 68a0133eae..d46c9727fe 100644 --- a/tests/isc/dnsstream_utils_test.c +++ b/tests/isc/dnsstream_utils_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/doh_test.c b/tests/isc/doh_test.c index 339f4559d1..9ccc11f777 100644 --- a/tests/isc/doh_test.c +++ b/tests/isc/doh_test.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/isc/errno_test.c b/tests/isc/errno_test.c index fbfe56ad4e..cdb44270b2 100644 --- a/tests/isc/errno_test.c +++ b/tests/isc/errno_test.c @@ -24,6 +24,7 @@ #include #include +#include #include #include diff --git a/tests/isc/file_test.c b/tests/isc/file_test.c index 6b75ba2490..c569dbd9cd 100644 --- a/tests/isc/file_test.c +++ b/tests/isc/file_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/tests/isc/hash_test.c b/tests/isc/hash_test.c index 6d04943866..996d355cc7 100644 --- a/tests/isc/hash_test.c +++ b/tests/isc/hash_test.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/isc/hashmap_test.c b/tests/isc/hashmap_test.c index 7ff9327351..c03a572492 100644 --- a/tests/isc/hashmap_test.c +++ b/tests/isc/hashmap_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/heap_test.c b/tests/isc/heap_test.c index eba2b6b97a..b6757c14b4 100644 --- a/tests/isc/heap_test.c +++ b/tests/isc/heap_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/tests/isc/histo_test.c b/tests/isc/histo_test.c index 88c322f160..ff586ca599 100644 --- a/tests/isc/histo_test.c +++ b/tests/isc/histo_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include diff --git a/tests/isc/hmac_test.c b/tests/isc/hmac_test.c index 5784a8aec1..75c604b50d 100644 --- a/tests/isc/hmac_test.c +++ b/tests/isc/hmac_test.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include diff --git a/tests/isc/ht_test.c b/tests/isc/ht_test.c index 2303def008..40a6ef6c68 100644 --- a/tests/isc/ht_test.c +++ b/tests/isc/ht_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/job_test.c b/tests/isc/job_test.c index 6376bcc135..9b5315575c 100644 --- a/tests/isc/job_test.c +++ b/tests/isc/job_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/lex_test.c b/tests/isc/lex_test.c index ee0a084341..ce35f382e6 100644 --- a/tests/isc/lex_test.c +++ b/tests/isc/lex_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/tests/isc/loop_test.c b/tests/isc/loop_test.c index f7e1d28e8b..b41c4f804d 100644 --- a/tests/isc/loop_test.c +++ b/tests/isc/loop_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/md_test.c b/tests/isc/md_test.c index 69051b93c9..4ef72383df 100644 --- a/tests/isc/md_test.c +++ b/tests/isc/md_test.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/isc/mem_test.c b/tests/isc/mem_test.c index cdf2546656..ddb655440d 100644 --- a/tests/isc/mem_test.c +++ b/tests/isc/mem_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/mutex_test.c b/tests/isc/mutex_test.c index d45c694aba..7b4ca86a3c 100644 --- a/tests/isc/mutex_test.c +++ b/tests/isc/mutex_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/netaddr_test.c b/tests/isc/netaddr_test.c index 2394e11166..3d2d2363bf 100644 --- a/tests/isc/netaddr_test.c +++ b/tests/isc/netaddr_test.c @@ -24,6 +24,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/parse_test.c b/tests/isc/parse_test.c index a5b516a027..19e453b76f 100644 --- a/tests/isc/parse_test.c +++ b/tests/isc/parse_test.c @@ -26,6 +26,7 @@ #define UNIT_TESTING #include +#include #include #include diff --git a/tests/isc/proxyheader_test.c b/tests/isc/proxyheader_test.c index 1f15dd6394..670dc4d238 100644 --- a/tests/isc/proxyheader_test.c +++ b/tests/isc/proxyheader_test.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/proxystream_test.c b/tests/isc/proxystream_test.c index 295f63718c..03fca07d8f 100644 --- a/tests/isc/proxystream_test.c +++ b/tests/isc/proxystream_test.c @@ -28,6 +28,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/proxyudp_test.c b/tests/isc/proxyudp_test.c index 2e5bcfce34..9ebd499fb2 100644 --- a/tests/isc/proxyudp_test.c +++ b/tests/isc/proxyudp_test.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/quota_test.c b/tests/isc/quota_test.c index 1f802e06ee..6b9677978d 100644 --- a/tests/isc/quota_test.c +++ b/tests/isc/quota_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/radix_test.c b/tests/isc/radix_test.c index def5e9cf58..23671d1454 100644 --- a/tests/isc/radix_test.c +++ b/tests/isc/radix_test.c @@ -22,6 +22,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/random_test.c b/tests/isc/random_test.c index 21a33167d9..eb4ff1dcaf 100644 --- a/tests/isc/random_test.c +++ b/tests/isc/random_test.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/ratelimiter_test.c b/tests/isc/ratelimiter_test.c index 4183fb23a7..542d257ca3 100644 --- a/tests/isc/ratelimiter_test.c +++ b/tests/isc/ratelimiter_test.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/regex_test.c b/tests/isc/regex_test.c index 379dfdcc15..2cc4d9e8d9 100644 --- a/tests/isc/regex_test.c +++ b/tests/isc/regex_test.c @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/tests/isc/result_test.c b/tests/isc/result_test.c index cec195bef4..bc8f86b81f 100644 --- a/tests/isc/result_test.c +++ b/tests/isc/result_test.c @@ -23,6 +23,7 @@ #define UNIT_TESTING #include +#include #include #include diff --git a/tests/isc/rwlock_test.c b/tests/isc/rwlock_test.c index dee4e382f3..74f9e4ca22 100644 --- a/tests/isc/rwlock_test.c +++ b/tests/isc/rwlock_test.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/isc/safe_test.c b/tests/isc/safe_test.c index a3f01fe9af..d91b30cf0f 100644 --- a/tests/isc/safe_test.c +++ b/tests/isc/safe_test.c @@ -24,6 +24,7 @@ #define UNIT_TESTING #include +#include #include #include diff --git a/tests/isc/siphash_test.c b/tests/isc/siphash_test.c index 6970ca98a7..9645c953ae 100644 --- a/tests/isc/siphash_test.c +++ b/tests/isc/siphash_test.c @@ -22,6 +22,7 @@ #define UNIT_TESTING #include +#include #include #include diff --git a/tests/isc/sockaddr_test.c b/tests/isc/sockaddr_test.c index 4dd70602a8..210efb0a87 100644 --- a/tests/isc/sockaddr_test.c +++ b/tests/isc/sockaddr_test.c @@ -24,6 +24,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/spinlock_test.c b/tests/isc/spinlock_test.c index 89db288774..273e33cebe 100644 --- a/tests/isc/spinlock_test.c +++ b/tests/isc/spinlock_test.c @@ -23,6 +23,8 @@ #define UNIT_TESTING #include +#include + #ifdef HAVE_PTHREAD_SPIN_INIT #define HAD_PTHREAD_SPIN_INIT 1 #undef HAVE_PTHREAD_SPIN_INIT diff --git a/tests/isc/stats_test.c b/tests/isc/stats_test.c index 4bc541f33c..8942f0d21e 100644 --- a/tests/isc/stats_test.c +++ b/tests/isc/stats_test.c @@ -22,6 +22,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/symtab_test.c b/tests/isc/symtab_test.c index 24da351bc8..87d7f58bc2 100644 --- a/tests/isc/symtab_test.c +++ b/tests/isc/symtab_test.c @@ -23,6 +23,7 @@ #define UNIT_TESTING #include +#include #include #include diff --git a/tests/isc/tcp_test.c b/tests/isc/tcp_test.c index 2538907e04..05f9316ae3 100644 --- a/tests/isc/tcp_test.c +++ b/tests/isc/tcp_test.c @@ -29,6 +29,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/tcpdns_test.c b/tests/isc/tcpdns_test.c index f2d3eed9dd..b0d213f4bd 100644 --- a/tests/isc/tcpdns_test.c +++ b/tests/isc/tcpdns_test.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/time_test.c b/tests/isc/time_test.c index 3b5113b844..2bd85a636e 100644 --- a/tests/isc/time_test.c +++ b/tests/isc/time_test.c @@ -23,6 +23,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/timer_test.c b/tests/isc/timer_test.c index 66fbbc7d7a..4a6ee8045c 100644 --- a/tests/isc/timer_test.c +++ b/tests/isc/timer_test.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/isc/tls_test.c b/tests/isc/tls_test.c index 425a767651..9a4df5becd 100644 --- a/tests/isc/tls_test.c +++ b/tests/isc/tls_test.c @@ -29,6 +29,7 @@ #define UNIT_TESTING #include +#include #include #include #include diff --git a/tests/isc/tlsdns_test.c b/tests/isc/tlsdns_test.c index e8da5b04fd..831c8c1d26 100644 --- a/tests/isc/tlsdns_test.c +++ b/tests/isc/tlsdns_test.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/udp_test.c b/tests/isc/udp_test.c index 610139b96a..aaacd6d383 100644 --- a/tests/isc/udp_test.c +++ b/tests/isc/udp_test.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/tests/isc/work_test.c b/tests/isc/work_test.c index 3c126ee613..046cccb1b9 100644 --- a/tests/isc/work_test.c +++ b/tests/isc/work_test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/tests/isccfg/duration_test.c b/tests/isccfg/duration_test.c index 660a278e48..8808b0d085 100644 --- a/tests/isccfg/duration_test.c +++ b/tests/isccfg/duration_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/tests/isccfg/grammar_test.c b/tests/isccfg/grammar_test.c index e276287b59..d2424b2afe 100644 --- a/tests/isccfg/grammar_test.c +++ b/tests/isccfg/grammar_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/tests/isccfg/parser_test.c b/tests/isccfg/parser_test.c index 403b3176db..d7fdba0d86 100644 --- a/tests/isccfg/parser_test.c +++ b/tests/isccfg/parser_test.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/tests/ns/notify_test.c b/tests/ns/notify_test.c index 806470a624..03d78c3abb 100644 --- a/tests/ns/notify_test.c +++ b/tests/ns/notify_test.c @@ -24,10 +24,12 @@ #define UNIT_TESTING #include +#include #include #include #include +#include #include #include diff --git a/tests/ns/plugin_test.c b/tests/ns/plugin_test.c index 92b9b78b8d..a7427c4c85 100644 --- a/tests/ns/plugin_test.c +++ b/tests/ns/plugin_test.c @@ -26,11 +26,14 @@ #include #include +#include #include #include #include #include +#include + #include #include diff --git a/tests/ns/query_test.c b/tests/ns/query_test.c index 812c23350d..18801bc742 100644 --- a/tests/ns/query_test.c +++ b/tests/ns/query_test.c @@ -23,10 +23,12 @@ #define UNIT_TESTING #include +#include #include #include #include +#include #include #include