]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Convert all categories and modules into static lists
authorOndřej Surý <ondrej@isc.org>
Wed, 14 Aug 2024 11:25:50 +0000 (13:25 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 20 Aug 2024 12:50:39 +0000 (12:50 +0000)
Remove the complicated mechanism that could be (in theory) used by
external libraries to register new categories and modules with
statically defined lists in <isc/log.h>.  This is similar to what we
have done for <isc/result.h> result codes.  All the libraries are now
internal to BIND 9, so we don't need to provide a mechanism to register
extra categories and modules.

122 files changed:
bin/check/check-tool.c
bin/check/named-checkconf.c
bin/check/named-checkzone.c
bin/delv/delv.c
bin/dig/dighost.c
bin/dnssec/dnssec-cds.c
bin/dnssec/dnssec-dsfromkey.c
bin/dnssec/dnssec-importkey.c
bin/dnssec/dnssec-keyfromlabel.c
bin/dnssec/dnssec-keygen.c
bin/dnssec/dnssec-settime.c
bin/dnssec/dnssec-signzone.c
bin/dnssec/dnssec-verify.c
bin/dnssec/dnssectool.c
bin/named/dlz_dlopen_driver.c
bin/named/fuzz.c
bin/named/include/named/globals.h
bin/named/include/named/log.h
bin/named/log.c
bin/named/logconf.c
bin/named/main.c
bin/named/zoneconf.c
bin/nsupdate/nsupdate.c
bin/plugins/filter-a.c
bin/plugins/filter-aaaa.c
bin/rndc/rndc.c
bin/tests/system/dyndb/driver/log.c
bin/tests/system/dyndb/driver/log.h
bin/tests/system/hooks/driver/test-async.c
bin/tests/system/makejournal.c
bin/tests/system/rsabigexponent/bigkey.c
bin/tools/named-journalprint.c
doc/dev/dev.md
doc/misc/cfg_test.c
lib/dns/Makefile.am
lib/dns/adb.c
lib/dns/cache.c
lib/dns/callbacks.c
lib/dns/db.c
lib/dns/diff.c
lib/dns/dispatch.c
lib/dns/dlz.c
lib/dns/dnssec.c
lib/dns/dnstap.c
lib/dns/dst_api.c
lib/dns/dst_internal.h
lib/dns/dst_openssl.h
lib/dns/dst_parse.c
lib/dns/dyndb.c
lib/dns/geoip2.c
lib/dns/gssapictx.c
lib/dns/include/dns/log.h [deleted file]
lib/dns/include/dns/message.h
lib/dns/include/dns/resolver.h
lib/dns/include/dns/zone.h
lib/dns/include/dst/dst.h
lib/dns/journal.c
lib/dns/kasp.c
lib/dns/keymgr.c
lib/dns/log.c [deleted file]
lib/dns/masterdump.c
lib/dns/message.c
lib/dns/nta.c
lib/dns/openssl_link.c
lib/dns/qp.c
lib/dns/qpcache.c
lib/dns/qpzone.c
lib/dns/rbt-cachedb.c
lib/dns/rbt-zonedb.c
lib/dns/rbt.c
lib/dns/rbtdb.c
lib/dns/request.c
lib/dns/resolver.c
lib/dns/rootns.c
lib/dns/rpz.c
lib/dns/rrl.c
lib/dns/sdlz.c
lib/dns/ssu_external.c
lib/dns/stats.c
lib/dns/tkey.c
lib/dns/tsig.c
lib/dns/update.c
lib/dns/validator.c
lib/dns/xfrin.c
lib/dns/zone.c
lib/dns/zoneverify.c
lib/dns/zt.c
lib/isc/backtrace.c
lib/isc/include/isc/backtrace.h
lib/isc/include/isc/log.h
lib/isc/include/isc/tls.h
lib/isc/include/isc/types.h
lib/isc/log.c
lib/isc/tls.c
lib/isccfg/Makefile.am
lib/isccfg/aclconf.c
lib/isccfg/check.c
lib/isccfg/include/isccfg/log.h [deleted file]
lib/isccfg/kaspconf.c
lib/isccfg/log.c [deleted file]
lib/isccfg/namedconf.c
lib/isccfg/parser.c
lib/ns/Makefile.am
lib/ns/client.c
lib/ns/hooks.c
lib/ns/include/ns/client.h
lib/ns/include/ns/log.h [deleted file]
lib/ns/interfacemgr.c
lib/ns/listenlist.c
lib/ns/log.c [deleted file]
lib/ns/notify.c
lib/ns/query.c
lib/ns/update.c
lib/ns/xfrout.c
tests/bench/qpmulti.c
tests/dns/qpmulti_test.c
tests/dns/rbt_test.c
tests/isccfg/duration_test.c
tests/isccfg/parser_test.c
tests/libtest/dns.c
tests/libtest/ns.c
util/check-categories.sh

index 503ecb8f42883e3a2a90de92e169af8abca950a7..59a8fd7a2d9480139f58a33c06eb61ee74fc3d39 100644 (file)
@@ -33,7 +33,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rdata.h>
 #include <dns/rdataclass.h>
 #include <dns/types.h>
 #include <dns/zone.h>
 
-#include <isccfg/log.h>
-
-#include <ns/log.h>
-
 #include "check-tool.h"
 
 #ifndef CHECK_SIBLING
@@ -97,13 +92,6 @@ dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
                             DNS_ZONEOPT_CHECKSVCB | DNS_ZONEOPT_CHECKWILDCARD |
                             DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
 
-/*
- * This needs to match the list in bin/named/log.c.
- */
-static isc_logcategory_t categories[] = { { "", 0 },
-                                         { "unmatched", 0 },
-                                         { NULL, 0 } };
-
 static isc_symtab_t *symtab = NULL;
 static isc_mem_t *sym_mctx;
 
@@ -550,24 +538,17 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
 
 isc_result_t
 setup_logging(FILE *errout) {
-       isc_logdestination_t destination;
-       isc_logconfig_t *logconfig = NULL;
-
-       isc_log_registercategories(categories);
-       dns_log_init();
-       cfg_log_init();
-       ns_log_init();
-
-       logconfig = isc_logconfig_get();
-       destination.file.stream = errout;
-       destination.file.name = NULL;
-       destination.file.versions = ISC_LOG_ROLLNEVER;
-       destination.file.maximum_size = 0;
+       isc_logconfig_t *logconfig = isc_logconfig_get();
+       isc_logdestination_t destination = {
+               .file.stream = errout,
+               .file.versions = ISC_LOG_ROLLNEVER,
+       };
        isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination, 0);
 
-       RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
-                     ISC_R_SUCCESS);
+       RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
+                                        ISC_LOGCATEGORY_ALL,
+                                        ISC_LOGMODULE_ALL) == ISC_R_SUCCESS);
 
        return (ISC_R_SUCCESS);
 }
index 3ac3c5e1d7dabf0c0ea7570fff35ed219b701fd2..37a827cba62e0a6f49ea2677f6a928a9ec97e82b 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <dns/db.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rdataclass.h>
 #include <dns/rootns.h>
index 598a524730d93fb5832be35513e60ac452c46a76..f96930d30c083d6ea5c0b43ab31ffe71d20087cf 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <dns/db.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/masterdump.h>
 #include <dns/name.h>
index 6627dd01bbcee7f3fe344ed0abc0df0c0f4d22a2..d31497095996b311db3f1f9e58bf9817cafd5a08 100644 (file)
@@ -52,7 +52,6 @@
 #include <dns/fixedname.h>
 #include <dns/keytable.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/message.h>
 #include <dns/name.h>
@@ -70,7 +69,6 @@
 
 #include <dst/dst.h>
 
-#include <isccfg/log.h>
 #include <isccfg/namedconf.h>
 
 #include <ns/client.h>
@@ -286,12 +284,6 @@ warn(const char *format, ...) {
        fprintf(stderr, "\n");
 }
 
-static isc_logcategory_t categories[] = { { "delv", 0 }, { NULL, 0 } };
-#define LOGCATEGORY_DEFAULT (&categories[0])
-#define LOGMODULE_DEFAULT   (&modules[0])
-
-static isc_logmodule_t modules[] = { { "delv", 0 }, { NULL, 0 } };
-
 static void
 delv_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
 
@@ -307,8 +299,8 @@ delv_log(int level, const char *fmt, ...) {
        va_start(ap, fmt);
 
        vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
-       isc_log_write(LOGCATEGORY_DEFAULT, LOGMODULE_DEFAULT, level, "%s",
-                     msgbuf);
+       isc_log_write(DELV_LOGCATEGORY_DEFAULT, DELV_LOGMODULE_DEFAULT, level,
+                     "%s", msgbuf);
        va_end(ap);
 }
 
@@ -317,20 +309,13 @@ static int loglevel = 0;
 static void
 setup_logging(FILE *errout) {
        isc_result_t result;
-       isc_logdestination_t destination;
-       isc_logconfig_t *logconfig = NULL;
        int packetlevel = 10;
 
-       isc_log_registercategories(categories);
-       isc_log_registermodules(modules);
-       dns_log_init();
-       cfg_log_init();
-
-       logconfig = isc_logconfig_get();
-       destination.file.stream = errout;
-       destination.file.name = NULL;
-       destination.file.versions = ISC_LOG_ROLLNEVER;
-       destination.file.maximum_size = 0;
+       isc_logconfig_t *logconfig = isc_logconfig_get();
+       isc_logdestination_t destination = {
+               .file.stream = errout,
+               .file.versions = ISC_LOG_ROLLNEVER,
+       };
        isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination,
                              ISC_LOG_PRINTPREFIX);
@@ -339,7 +324,7 @@ setup_logging(FILE *errout) {
        isc_log_settag(logconfig, ";; ");
 
        result = isc_log_usechannel(logconfig, "stderr",
-                                   ISC_LOGCATEGORY_DEFAULT, NULL);
+                                   ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_ALL);
        if (result != ISC_R_SUCCESS) {
                fatal("Couldn't attach to log channel 'stderr'");
        }
index f3b5b11a6cf425e7889617947145e9c1a32eadde..36bd07cc43f785b1aec501de7ec8bfc9b0ef04f6 100644 (file)
@@ -61,7 +61,6 @@
 
 #include <dns/byaddr.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/name.h>
 #include <dns/opcode.h>
@@ -1360,10 +1359,9 @@ setup_libs(void) {
 
        isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
 
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
-       result = isc_log_usechannel(logconfig, "default_debug", NULL, NULL);
+       result = isc_log_usechannel(logconfig, "default_debug",
+                                   ISC_LOGCATEGORY_ALL, ISC_LOGMODULE_ALL);
 
        check_result(result, "isc_log_usechannel");
 
index 6e22896c109ce6960749b578455fc9612b4fc76e..c44875252b72ceedcb7da9c0ba5ef3a498e4d67a 100644 (file)
@@ -29,6 +29,7 @@
 #include <isc/dir.h>
 #include <isc/file.h>
 #include <isc/hash.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/serial.h>
@@ -43,7 +44,6 @@
 #include <dns/ds.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/name.h>
 #include <dns/rdata.h>
index 143a07e0e3da65a884e40c5aea82f1763c1f7948..2ffd31b898180d468239ec45008ac2e82c93b68b 100644 (file)
@@ -22,6 +22,7 @@
 #include <isc/commandline.h>
 #include <isc/dir.h>
 #include <isc/hash.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -33,7 +34,6 @@
 #include <dns/ds.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/name.h>
 #include <dns/rdata.h>
index 1be060d0e148c7065aa06e3c5805ca8d41d26464..6fb11b1060584f1a8354e12a1780b96c38e7b241 100644 (file)
@@ -20,6 +20,7 @@
 #include <isc/buffer.h>
 #include <isc/commandline.h>
 #include <isc/hash.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -31,7 +32,6 @@
 #include <dns/ds.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/name.h>
 #include <dns/rdata.h>
index 4ca9bfbb6b3dc468a490ee54ec6828fa4640840d..35dacc3f310c48665eef858170b01c36195142ca 100644 (file)
@@ -21,6 +21,7 @@
 #include <isc/attributes.h>
 #include <isc/buffer.h>
 #include <isc/commandline.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/region.h>
 #include <isc/result.h>
@@ -30,7 +31,6 @@
 #include <dns/dnssec.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rdataclass.h>
 #include <dns/secalg.h>
index 75905ec108b76223bb000e4b6c31b9966220064d..5522662994978c017bd29b44ec528e57f4a1288c 100644 (file)
@@ -39,6 +39,7 @@
 #include <isc/buffer.h>
 #include <isc/commandline.h>
 #include <isc/fips.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/region.h>
 #include <isc/result.h>
@@ -49,7 +50,6 @@
 #include <dns/fixedname.h>
 #include <dns/kasp.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rdataclass.h>
 #include <dns/secalg.h>
index 46431f448ea83be42482eb9664555fc00567252c..6c83ee5272941bd8acfe92149584202df9316107 100644 (file)
@@ -25,6 +25,7 @@
 #include <isc/commandline.h>
 #include <isc/file.h>
 #include <isc/hash.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -32,7 +33,6 @@
 #include <isc/util.h>
 
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 
 #include <dst/dst.h>
 
index 17382033f9fbff75a82e6b990d111b29ef6b142f..1dc09d57bc57fc16ac7fbbc5543b7592eb46b256 100644 (file)
@@ -45,6 +45,7 @@
 #include <isc/fips.h>
 #include <isc/hash.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/managers.h>
 #include <isc/md.h>
@@ -70,7 +71,6 @@
 #include <dns/fixedname.h>
 #include <dns/kasp.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/masterdump.h>
 #include <dns/nsec.h>
index 4c3504e34e89e06ee0fdbdf689e93160c1f834c4..45c75d353128dd35e0459671e978d6be3d4c7720 100644 (file)
@@ -23,6 +23,7 @@
 #include <isc/file.h>
 #include <isc/hash.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
 #include <isc/os.h>
@@ -42,7 +43,6 @@
 #include <dns/ds.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/masterdump.h>
 #include <dns/nsec.h>
index 5fa03d79796a5ad530998639818939c6ebe7fcf9..a34d12685a6f34aeeafa0749a7f8f8df5f399612 100644 (file)
@@ -29,6 +29,7 @@
 #include <isc/file.h>
 #include <isc/heap.h>
 #include <isc/list.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -43,7 +44,6 @@
 #include <dns/fixedname.h>
 #include <dns/journal.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/nsec.h>
 #include <dns/nsec3.h>
@@ -152,8 +152,6 @@ setup_logging(void) {
                break;
        }
 
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
 
        isc_log_settag(logconfig, program);
@@ -172,8 +170,9 @@ setup_logging(void) {
                              &destination,
                              ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL);
 
-       RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
-                     ISC_R_SUCCESS);
+       RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
+                                        ISC_LOGCATEGORY_ALL,
+                                        ISC_LOGMODULE_ALL) == ISC_R_SUCCESS);
 }
 
 static isc_stdtime_t
index eedfceec264807ec86e9897f0e67a2bc6cbca9f0..21d1c30e3e54d13e1366c58c2ea67cfa20cd0e11 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/util.h>
 #include <isc/uv.h>
 
 #include <dns/dlz_dlopen.h>
-#include <dns/log.h>
 
 #include <dlz/dlz_dlopen_driver.h>
 #include <named/globals.h>
index b011aae0951c9a4803dac8c1ca8195705b7b2795..517a696cc021f08a2a5c64628526e7165a164d24 100644 (file)
 #include <unistd.h>
 
 #include <isc/condition.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mutex.h>
 #include <isc/thread.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
-
 #include <named/globals.h>
 #include <named/log.h>
 #include <named/server.h>
index 5d49d0da77d3536c9813fa5c9c00d5bb8c2d08ae..6b978d1eb8d78b940b252decffce20856f62dd45 100644 (file)
@@ -86,9 +86,8 @@ EXTERN named_server_t *named_g_server INIT(NULL);
 /*
  * Logging.
  */
-EXTERN isc_logcategory_t *named_g_categories INIT(NULL);
-EXTERN isc_logmodule_t *named_g_modules             INIT(NULL);
-EXTERN unsigned int named_g_debuglevel      INIT(0);
+EXTERN bool named_g_logging           INIT(false);
+EXTERN unsigned int named_g_debuglevel INIT(0);
 
 /*
  * Current configuration information.
index b6045bd979c986f6cc077926c47c6c853070af21..1008dd0f2edbfc55289e5e9dea0765a200d11912 100644 (file)
 #include <isc/log.h>
 #include <isc/types.h>
 
-#include <dns/log.h>
-
 #include <named/globals.h> /* Required for named_g_(categories|modules). */
 
-/* Unused slot 0. */
-#define NAMED_LOGCATEGORY_UNMATCHED (&named_g_categories[1])
-
-/*
- * Backwards compatibility.
- */
-#define NAMED_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
-
-#define NAMED_LOGMODULE_MAIN   (&named_g_modules[0])
-#define NAMED_LOGMODULE_SERVER (&named_g_modules[1])
-#define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
-
 isc_result_t
 named_log_init(bool safe);
 /*%
index 03629531730dc6ba19698d241b6b44863fa0bf08..3023b34ee03b22b1f96937494681796be0c024e9 100644 (file)
 
 #include <stdlib.h>
 
+#include <isc/log.h>
 #include <isc/result.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
-
-#include <isccfg/log.h>
-
-#include <ns/log.h>
-
 #include <named/log.h>
 
 #ifndef ISC_FACILITY
 #define ISC_FACILITY LOG_DAEMON
 #endif /* ifndef ISC_FACILITY */
 
-/*%
- * When adding a new category, be sure to add the appropriate
- * \#define to <named/log.h> and to update the list in
- * bin/check/check-tool.c.
- */
-static isc_logcategory_t categories[] = { { "", 0 },
-                                         { "unmatched", 0 },
-                                         { NULL, 0 } };
-
-/*%
- * When adding a new module, be sure to add the appropriate
- * \#define to <dns/log.h>.
- */
-static isc_logmodule_t modules[] = {
-       { "main", 0 }, { "server", 0 }, { "control", 0 }, { NULL, 0 }
-};
-
 isc_result_t
 named_log_init(bool safe) {
        isc_result_t result;
        isc_logconfig_t *lcfg = NULL;
 
-       named_g_categories = categories;
-       named_g_modules = modules;
-
-       /*
-        * named-checktool.c:setup_logging() needs to be kept in sync.
-        */
-       isc_log_registercategories(named_g_categories);
-       isc_log_registermodules(named_g_modules);
-       dns_log_init();
-       cfg_log_init();
-       ns_log_init();
-
        /*
         * This is not technically needed, as we are calling named_log_init()
         * only at the start of named process.  But since the named binary is
@@ -86,6 +52,8 @@ named_log_init(bool safe) {
        named_log_setdefaultsslkeylogfile(lcfg);
        rcu_read_unlock();
 
+       named_g_logging = true;
+
        return (ISC_R_SUCCESS);
 
 cleanup:
@@ -205,7 +173,8 @@ named_log_setdefaultsslkeylogfile(isc_logconfig_t *lcfg) {
        isc_log_createchannel(lcfg, "default_sslkeylogfile", ISC_LOG_TOFILE,
                              ISC_LOG_INFO, &destination, 0);
        result = isc_log_usechannel(lcfg, "default_sslkeylogfile",
-                                   ISC_LOGCATEGORY_SSLKEYLOG, NULL);
+                                   ISC_LOGCATEGORY_SSLKEYLOG,
+                                   ISC_LOGMODULE_ALL);
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
 }
 
@@ -214,7 +183,7 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
        isc_result_t result = ISC_R_SUCCESS;
 
        result = isc_log_usechannel(lcfg, "default_debug",
-                                   ISC_LOGCATEGORY_DEFAULT, NULL);
+                                   ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_ALL);
        if (result != ISC_R_SUCCESS) {
                goto cleanup;
        }
@@ -223,11 +192,11 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
                if (named_g_logfile != NULL) {
                        result = isc_log_usechannel(lcfg, "default_logfile",
                                                    ISC_LOGCATEGORY_DEFAULT,
-                                                   NULL);
+                                                   ISC_LOGMODULE_ALL);
                } else if (!named_g_nosyslog) {
                        result = isc_log_usechannel(lcfg, "default_syslog",
                                                    ISC_LOGCATEGORY_DEFAULT,
-                                                   NULL);
+                                                   ISC_LOGMODULE_ALL);
                }
        }
 
@@ -240,6 +209,6 @@ named_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
        isc_result_t result;
 
        result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
-                                   NULL);
+                                   ISC_LOGMODULE_ALL);
        return (result);
 }
index 04057f56c170205b4361b1d64ee6ca27f198a832..530b44b4816844a576f7f314db435689853832aa 100644 (file)
@@ -24,7 +24,6 @@
 #include <isc/util.h>
 
 #include <isccfg/cfg.h>
-#include <isccfg/log.h>
 
 #include <named/log.h>
 #include <named/logconf.h>
@@ -44,14 +43,14 @@ static isc_result_t
 category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
        isc_result_t result;
        const char *catname;
-       isc_logcategory_t *category;
-       isc_logmodule_t *module;
+       isc_logcategory_t category;
+       isc_logmodule_t module;
        const cfg_obj_t *destinations = NULL;
        const cfg_listelt_t *element = NULL;
 
        catname = cfg_obj_asstring(cfg_tuple_get(ccat, "name"));
        category = isc_log_categorybyname(catname);
-       if (category == NULL) {
+       if (category == ISC_LOGCATEGORY_INVALID) {
                cfg_obj_log(ccat, ISC_LOG_ERROR,
                            "unknown logging category '%s' ignored", catname);
                /*
@@ -64,7 +63,7 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
                return (ISC_R_SUCCESS);
        }
 
-       module = NULL;
+       module = ISC_LOGMODULE_ALL;
 
        destinations = cfg_tuple_get(ccat, "destinations");
        for (element = cfg_list_first(destinations); element != NULL;
index 4588249c316a8abb10df35995c0ee45f4c93e0f9..98418bfbe34a7831e32ca340d56ed571a74ddf00 100644 (file)
@@ -161,7 +161,7 @@ named_main_earlywarning(const char *format, ...) {
        va_list args;
 
        va_start(args, format);
-       if (named_g_categories != NULL) {
+       if (named_g_logging) {
                isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
                               ISC_LOG_WARNING, format, args);
        } else {
@@ -178,7 +178,7 @@ named_main_earlyfatal(const char *format, ...) {
        va_list args;
 
        va_start(args, format);
-       if (named_g_categories != NULL) {
+       if (named_g_logging) {
                isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
                               ISC_LOG_CRITICAL, format, args);
                isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
@@ -206,7 +206,7 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
         * Handle assertion failures.
         */
 
-       if (named_g_categories != NULL) {
+       if (named_g_logging) {
                /*
                 * Reset the assertion callback in case it is the log
                 * routines causing the assertion.
@@ -244,7 +244,7 @@ library_fatal_error(const char *file, int line, const char *func,
         * Handle isc_error_fatal() calls from our libraries.
         */
 
-       if (named_g_categories != NULL) {
+       if (named_g_logging) {
                /*
                 * Reset the error callback in case it is the log
                 * routines causing the assertion.
@@ -284,7 +284,7 @@ library_unexpected_error(const char *file, int line, const char *func,
         * Handle isc_error_unexpected() calls from our libraries.
         */
 
-       if (named_g_categories != NULL) {
+       if (named_g_logging) {
                isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
                              ISC_LOG_ERROR,
                              "%s:%d:%s(): unexpected error: ", file, line,
index 70d6f464d495f5d359fa432915d77c071a23321d..a78adae58a70cf12a8bc789a93434b6f2147b7a1 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <isc/buffer.h>
 #include <isc/file.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/stats.h>
@@ -28,7 +29,6 @@
 #include <dns/ipkeylist.h>
 #include <dns/journal.h>
 #include <dns/kasp.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/name.h>
 #include <dns/nsec3.h>
index 61062c173066a32c808a3111c3400346a4438722..e7162889aa5f8f418c355e96b787933efb9852fa 100644 (file)
@@ -52,7 +52,6 @@
 #include <dns/dispatch.h>
 #include <dns/dnssec.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/message.h>
 #include <dns/name.h>
@@ -811,10 +810,9 @@ setup_system(void *arg ISC_ATTR_UNUSED) {
 
        ddebug("setup_system()");
 
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
-       result = isc_log_usechannel(logconfig, "default_debug", NULL, NULL);
+       result = isc_log_usechannel(logconfig, "default_debug",
+                                   ISC_LOGCATEGORY_ALL, ISC_LOGMODULE_ALL);
        check_result(result, "isc_log_usechannel");
 
        isc_log_setdebuglevel(logdebuglevel);
index b710149e97d05a46480d85ab718d6b01668eb774..57e6fa72489351c9ae2aa717321c0c1c1ec85b4a 100644 (file)
@@ -32,7 +32,6 @@
 #include <dns/acl.h>
 #include <dns/db.h>
 #include <dns/enumtype.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/rdataset.h>
 #include <dns/types.h>
@@ -44,7 +43,6 @@
 
 #include <ns/client.h>
 #include <ns/hooks.h>
-#include <ns/log.h>
 #include <ns/query.h>
 #include <ns/types.h>
 
index f39ac91e47e0ab229d1f9dac84a492cb914226c6..ab5388e686dc8d826f218b9284c47e4ed86b5f1d 100644 (file)
@@ -32,7 +32,6 @@
 #include <dns/acl.h>
 #include <dns/db.h>
 #include <dns/enumtype.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/rdataset.h>
 #include <dns/types.h>
@@ -44,7 +43,6 @@
 
 #include <ns/client.h>
 #include <ns/hooks.h>
-#include <ns/log.h>
 #include <ns/query.h>
 #include <ns/types.h>
 
index e9ddc0c2790a56f283b86527c1fb502252028ec1..8f9e3cbe9f6be54307b6dd90041cd5a1051774c3 100644 (file)
@@ -963,7 +963,8 @@ main(int argc, char **argv) {
                              ISC_LOG_INFO, &logdest,
                              ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL);
        DO("enabling log channel",
-          isc_log_usechannel(logconfig, "stderr", NULL, NULL));
+          isc_log_usechannel(logconfig, "stderr", ISC_LOGCATEGORY_ALL,
+                             ISC_LOGMODULE_ALL));
 
        parse_config(rndc_mctx, keyname, &pctx, &config);
 
index 138158d027a18a431d664fb01468c15ec412bd89..a096932659f42d1e75932abb6ac809c84f588b7c 100644 (file)
 
 #include "log.h"
 
+#include <isc/log.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
-
 void
 log_write(int level, const char *format, ...) {
        va_list args;
index 375db2b46ad48bf4ab5573fd14e0952608c53bf4..30758dee48872d4afb91ab1c5f8012c481075b4b 100644 (file)
 #pragma once
 
 #include <isc/error.h>
+#include <isc/log.h>
 #include <isc/result.h>
 
-#include <dns/log.h>
-
 #define log_error_r(fmt, ...) \
        log_error(fmt ": %s", ##__VA_ARGS__, isc_result_totext(result))
 
index 6702a323172fdc90e83d177243c351b26b3580b0..c77d5f7a3affc794b2931692f22a5a2fadc8e7db 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <ns/client.h>
 #include <ns/hooks.h>
-#include <ns/log.h>
 #include <ns/query.h>
 #include <ns/types.h>
 
index d13a9b26a68ffc6c41e2cf1dd444d46414dfbcf2..4ebd534f0df08d169825d1bd07411ae27f9dda47 100644 (file)
 #include <dns/db.h>
 #include <dns/fixedname.h>
 #include <dns/journal.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/types.h>
 
 isc_mem_t *mctx = NULL;
 
-/*
- * Logging categories: this needs to match the list in bin/named/log.c.
- */
-static isc_logcategory_t categories[] = { { "", 0 },
-                                         { "client", 0 },
-                                         { "network", 0 },
-                                         { "update", 0 },
-                                         { "queries", 0 },
-                                         { "unmatched", 0 },
-                                         { "update-security", 0 },
-                                         { "query-errors", 0 },
-                                         { NULL, 0 } };
-
 static isc_result_t
 loadzone(dns_db_t **db, const char *origin, const char *filename) {
        isc_result_t result;
@@ -91,9 +77,6 @@ main(int argc, char **argv) {
        isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
        isc_mem_create(&mctx);
 
-       isc_log_registercategories(categories);
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
        destination.file.stream = stderr;
        destination.file.name = NULL;
@@ -102,7 +85,8 @@ main(int argc, char **argv) {
        isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination, 0);
 
-       result = isc_log_usechannel(logconfig, "stderr", NULL, NULL);
+       result = isc_log_usechannel(logconfig, "stderr", ISC_LOGCATEGORY_ALL,
+                                   ISC_LOGMODULE_ALL);
        if (result != ISC_R_SUCCESS) {
                goto cleanup;
        }
index 8b1d77d6b0938472f80dafdf9c78b3970ac4830b..707279a5fd33bab6dbb14a25f7e52af2d4a9f36f 100644 (file)
 #include <openssl/objects.h>
 #include <openssl/rsa.h>
 
+#include <isc/log.h>
 #include <isc/result.h>
 
 #include <dns/dnssec.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rdataclass.h>
 #include <dns/secalg.h>
index fb2c5af524b1f89b23938d24438c29868bfbb1b8..3b6203b631d13c468cd932b4e59087e2b4140e58 100644 (file)
@@ -22,7 +22,6 @@
 #include <isc/util.h>
 
 #include <dns/journal.h>
-#include <dns/log.h>
 #include <dns/types.h>
 
 const char *progname = NULL;
@@ -41,8 +40,6 @@ setup_logging(FILE *errout) {
        isc_logdestination_t destination;
        isc_logconfig_t *logconfig = NULL;
 
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
        destination.file.stream = errout;
        destination.file.name = NULL;
@@ -51,8 +48,9 @@ setup_logging(FILE *errout) {
        isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination, 0);
 
-       RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
-                     ISC_R_SUCCESS);
+       RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
+                                        ISC_LOGCATEGORY_ALL,
+                                        ISC_LOGMODULE_ALL) == ISC_R_SUCCESS);
 }
 
 int
index 358539cccb2ca840835cb8b2c1669d124cfe9e3a..e117ce17a8d6aaf09f42b18ac38d2182a1487155 100644 (file)
@@ -1076,7 +1076,7 @@ the following steps need to be taken to initialize it.
    the DNS library, include the following:
 
         #include <isc/log.h>
-        #include <dns/log.h>
+        log.h>/log.h>
 
 1. Initialize a logging context.  A logging context needs a valid
    memory context in order to work, so the following code snippet shows a
index c7cbc506ca91272c43160e1b88cf7e7b925fd9ec..d54d08cfc10a2f35b5a9db077f653a0adaf90ace 100644 (file)
 #include <stdbool.h>
 #include <stdlib.h>
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/string.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
-
 #include <isccfg/grammar.h>
 #include <isccfg/namedconf.h>
 
@@ -83,7 +82,8 @@ main(int argc, char **argv) {
        isc_log_createchannel(lcfg, "_default", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination, ISC_LOG_PRINTTIME);
 
-       result = isc_log_usechannel(lcfg, "_default", NULL, NULL);
+       result = isc_log_usechannel(lcfg, "_default", ISC_LOGCATEGORY_ALL,
+                                   ISC_LOGMODULE_ALL);
        check_result(result, "isc_log_usechannel()");
 
        /*
index 18c02d8f3d43799e771bf4316da689e6e74f9e63..d5e96faa5e7b64c4b4d1b3cce6b12e9a04e3caf4 100644 (file)
@@ -87,7 +87,6 @@ libdns_la_HEADERS =                   \
        include/dns/keytable.h          \
        include/dns/keyvalues.h         \
        include/dns/librpz.h            \
-       include/dns/log.h               \
        include/dns/master.h            \
        include/dns/masterdump.h        \
        include/dns/message.h           \
@@ -194,7 +193,6 @@ libdns_la_SOURCES =                 \
        keymgr.c                        \
        keystore.c                      \
        keytable.c                      \
-       log.c                           \
        master.c                        \
        masterdump.c                    \
        message.c                       \
index ae6a4ef8acc25f585d74033a5957364450191f2d..52568129f9d490924dac52885a84f575178d1170 100644 (file)
@@ -22,6 +22,7 @@
 #include <isc/hash.h>
 #include <isc/hashmap.h>
 #include <isc/list.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mutex.h>
 #include <isc/netaddr.h>
 
 #include <dns/adb.h>
 #include <dns/db.h>
-#include <dns/log.h>
 #include <dns/rdata.h>
-#include <dns/rdataset.h>
 #include <dns/rdatastruct.h>
 #include <dns/rdatatype.h>
-#include <dns/resolver.h>
 #include <dns/stats.h>
 #include <dns/transport.h>
 
index 24e2d4f20532838c1ed350ce3d0dbfadfa87dbdb..2ddae6acc23542534c535c748633129663f83612 100644 (file)
@@ -16,6 +16,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/refcount.h>
@@ -29,7 +30,6 @@
 #include <dns/cache.h>
 #include <dns/db.h>
 #include <dns/dbiterator.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/rdata.h>
 #include <dns/rdataset.h>
index 4f144f629bdf61bb3919f200820d76c445565092..9f68b09f546304a033161c674b504244124dd125 100644 (file)
 
 /*! \file */
 
+#include <isc/log.h>
 #include <isc/util.h>
 
 #include <dns/callbacks.h>
-#include <dns/log.h>
 
 static void
 stdio_error_warn_callback(dns_rdatacallbacks_t *, const char *, ...)
index 51c4bd04c40f96628777a02b30b9158500ee7d20..bc65ec3292641d0b1db7b70c3c04b5bf67c99794 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <isc/buffer.h>
 #include <isc/hash.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/once.h>
 #include <isc/result.h>
 #include <dns/callbacks.h>
 #include <dns/clientinfo.h>
 #include <dns/db.h>
-#include <dns/dbiterator.h>
-#include <dns/log.h>
 #include <dns/master.h>
-#include <dns/rdata.h>
 #include <dns/rdataset.h>
 #include <dns/rdatasetiter.h>
 
index 2d92cce224fe5734491bd015a0747807057fd13e..2a170146a567866918e91f348b6e27d30b33e5ac 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <isc/buffer.h>
 #include <isc/file.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -27,7 +28,6 @@
 #include <dns/callbacks.h>
 #include <dns/db.h>
 #include <dns/diff.h>
-#include <dns/log.h>
 #include <dns/rdataclass.h>
 #include <dns/rdatalist.h>
 #include <dns/rdataset.h>
index 1a4565723cbfbbfdb68bd1a2c3e6d920da3ab94d..6af073d36a3dd8a9cab1257e45596d95b112a235 100644 (file)
@@ -22,6 +22,7 @@
 #include <isc/async.h>
 #include <isc/hash.h>
 #include <isc/hashmap.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -39,7 +40,6 @@
 
 #include <dns/acl.h>
 #include <dns/dispatch.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/stats.h>
 #include <dns/transport.h>
index f7aa071a885acb9c64ffe318a78fa443e61f3825..d7452c9e0d2f2ab6b056faf68753c3a4ee9bc1c8 100644 (file)
@@ -56,6 +56,7 @@
 
 #include <isc/buffer.h>
 #include <isc/commandline.h>
+#include <isc/log.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <isc/netmgr.h>
@@ -68,7 +69,6 @@
 #include <dns/db.h>
 #include <dns/dlz.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/ssu.h>
 #include <dns/zone.h>
index 8b8554043a14720a476ea30f1e8f60bac61cc099..98657d8631d63cf6e755e48c906312a22f435cc4 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <isc/buffer.h>
 #include <isc/dir.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/serial.h>
 #include <dns/fixedname.h>
 #include <dns/kasp.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
-#include <dns/message.h>
 #include <dns/rdata.h>
 #include <dns/rdatalist.h>
-#include <dns/rdataset.h>
 #include <dns/rdatastruct.h>
 #include <dns/stats.h>
 #include <dns/tsig.h> /* for DNS_TSIG_FUDGE */
index 03298860ad9fc1175121f0e5bf97df6ab8064f68..8525db584eb3c524783e4c47692a0366739d8e63 100644 (file)
@@ -69,7 +69,6 @@
 #include <isc/util.h>
 
 #include <dns/dnstap.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/name.h>
 #include <dns/rdataset.h>
index a60b7fd61a720ff1b7b15b8e503c3ab69d8a240f..69ec9a88ff11768d25d3c6d7f617eaf96ca92eef 100644 (file)
@@ -250,7 +250,7 @@ dst_ds_digest_supported(unsigned int digest_type) {
 }
 
 isc_result_t
-dst_context_create(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t *category,
+dst_context_create(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t category,
                   bool useforsigning, int maxbits, dst_context_t **dctxp) {
        dst_context_t *dctx;
        isc_result_t result;
index f8a90f3ff59abb2759f74688249e2df96747b486..988d14cf9c23af696cc51de29c68563f14c25e41 100644 (file)
@@ -139,7 +139,7 @@ struct dst_context {
        dst_use_t use;
        dst_key_t *key;
        isc_mem_t *mctx;
-       isc_logcategory_t *category;
+       isc_logcategory_t category;
        union {
                void *generic;
                dst_gssapi_signverifyctx_t *gssctx;
index 55e54380cb31080632f77a7ff982d5b6be031d89..a7c796897eef73853aad50507cc8b7b8d1d8eaf7 100644 (file)
@@ -27,8 +27,9 @@
 
 ISC_LANG_BEGINDECLS
 
-#define dst__openssl_toresult(fallback) \
-       isc__tlserr2result(NULL, NULL, NULL, fallback, __FILE__, __LINE__)
+#define dst__openssl_toresult(fallback)                                    \
+       isc__tlserr2result(ISC_LOGCATEGORY_INVALID, ISC_LOGMODULE_INVALID, \
+                          NULL, fallback, __FILE__, __LINE__)
 #define dst__openssl_toresult2(funcname, fallback)                        \
        isc__tlserr2result(DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_CRYPTO, \
                           funcname, fallback, __FILE__, __LINE__)
index 414e9aff03b67371e3d6ae8aa5ced87eff48ec8a..e9f3832752a84bc46eef7a2f085c4b4c158495be 100644 (file)
 #include <isc/dir.h>
 #include <isc/file.h>
 #include <isc/lex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/stdtime.h>
 #include <isc/string.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
 #include <dns/time.h>
 
 #include "dst_internal.h"
index 43d37a0699c0f5db29b5adb5f27d699a59e3644b..99939f8e0fe6451c52e3a446e3d5e77d788b2d38 100644 (file)
@@ -14,6 +14,7 @@
 #include <string.h>
 
 #include <isc/buffer.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
 #include <isc/once.h>
@@ -24,7 +25,6 @@
 #include <isc/uv.h>
 
 #include <dns/dyndb.h>
-#include <dns/log.h>
 #include <dns/types.h>
 #include <dns/view.h>
 #include <dns/zone.h>
index a3b2206bc820773545a692695181ef7655f657a9..6c29c19158d41fc6217cfaf4424ff8afbd600e9e 100644 (file)
@@ -24,6 +24,7 @@
 #include <maxminddb.h>
 #include <netinet/in.h>
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/once.h>
 #include <isc/sockaddr.h>
@@ -33,7 +34,6 @@
 
 #include <dns/acl.h>
 #include <dns/geoip.h>
-#include <dns/log.h>
 
 /*
  * This structure preserves state from the previous GeoIP lookup,
@@ -46,9 +46,9 @@
  * the lookup was answered, and a copy of the request address.
  *
  * If the next geoip ACL lookup is for the same database and from the
- * same address, we can reuse the MMDB entry without repeating the lookup.
- * This is for the case when a single query has to process multiple
- * geoip ACLs: for example, when there are multiple views with
+ * same address, we can reuse the MMDB entry without repeating the
+ * lookup. This is for the case when a single query has to process
+ * multiple geoip ACLs: for example, when there are multiple views with
  * match-clients statements that search for different countries.
  *
  * (XXX: Currently the persistent state is stored in thread specific
index 91b90c84f682a89498540d9bd8e26543900f8a15..d4b8017bd02f37c04eb39ac60c695b054daf85a2 100644 (file)
@@ -40,6 +40,7 @@
 #include <isc/dir.h>
 #include <isc/file.h>
 #include <isc/lex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/once.h>
 #include <isc/random.h>
@@ -50,8 +51,6 @@
 
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
-#include <dns/name.h>
 #include <dns/rdata.h>
 #include <dns/rdataclass.h>
 #include <dns/types.h>
diff --git a/lib/dns/include/dns/log.h b/lib/dns/include/dns/log.h
deleted file mode 100644 (file)
index 8913147..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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 dns/log.h
- */
-
-#pragma once
-
-#include <isc/lang.h>
-#include <isc/log.h>
-
-extern isc_logcategory_t dns_categories[];
-extern isc_logmodule_t  dns_modules[];
-
-#define DNS_LOGCATEGORY_NOTIFY  (&dns_categories[0])
-#define DNS_LOGCATEGORY_DATABASE (&dns_categories[1])
-#define DNS_LOGCATEGORY_SECURITY (&dns_categories[2])
-/* DNS_LOGCATEGORY_CONFIG superseded by CFG_LOGCATEGORY_CONFIG */
-#define DNS_LOGCATEGORY_DNSSEC      (&dns_categories[4])
-#define DNS_LOGCATEGORY_RESOLVER     (&dns_categories[5])
-#define DNS_LOGCATEGORY_XFER_IN             (&dns_categories[6])
-#define DNS_LOGCATEGORY_XFER_OUT     (&dns_categories[7])
-#define DNS_LOGCATEGORY_DISPATCH     (&dns_categories[8])
-#define DNS_LOGCATEGORY_LAME_SERVERS (&dns_categories[9])
-/* #define DNS_LOGCATEGORY_DELEGATION_ONLY removed */
-#define DNS_LOGCATEGORY_EDNS_DISABLED (&dns_categories[10])
-#define DNS_LOGCATEGORY_RPZ          (&dns_categories[11])
-#define DNS_LOGCATEGORY_RRL          (&dns_categories[12])
-#define DNS_LOGCATEGORY_CNAME        (&dns_categories[13])
-#define DNS_LOGCATEGORY_SPILL        (&dns_categories[14])
-#define DNS_LOGCATEGORY_DNSTAP       (&dns_categories[15])
-#define DNS_LOGCATEGORY_ZONELOAD      (&dns_categories[16])
-#define DNS_LOGCATEGORY_NSID         (&dns_categories[17])
-#define DNS_LOGCATEGORY_RPZ_PASSTHRU  (&dns_categories[18])
-
-/* Backwards compatibility. */
-#define DNS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
-
-#define DNS_LOGMODULE_DB        (&dns_modules[0])
-#define DNS_LOGMODULE_RBTDB     (&dns_modules[1])
-#define DNS_LOGMODULE_RBT       (&dns_modules[2])
-#define DNS_LOGMODULE_RDATA     (&dns_modules[3])
-#define DNS_LOGMODULE_MASTER    (&dns_modules[4])
-#define DNS_LOGMODULE_MESSAGE   (&dns_modules[5])
-#define DNS_LOGMODULE_CACHE     (&dns_modules[6])
-#define DNS_LOGMODULE_CONFIG    (&dns_modules[7])
-#define DNS_LOGMODULE_RESOLVER  (&dns_modules[8])
-#define DNS_LOGMODULE_ZONE      (&dns_modules[9])
-#define DNS_LOGMODULE_JOURNAL   (&dns_modules[10])
-#define DNS_LOGMODULE_ADB       (&dns_modules[11])
-#define DNS_LOGMODULE_XFER_IN   (&dns_modules[12])
-#define DNS_LOGMODULE_XFER_OUT  (&dns_modules[13])
-#define DNS_LOGMODULE_ACL       (&dns_modules[14])
-#define DNS_LOGMODULE_VALIDATOR         (&dns_modules[15])
-#define DNS_LOGMODULE_DISPATCH  (&dns_modules[16])
-#define DNS_LOGMODULE_REQUEST   (&dns_modules[17])
-#define DNS_LOGMODULE_MASTERDUMP (&dns_modules[18])
-#define DNS_LOGMODULE_TSIG      (&dns_modules[19])
-#define DNS_LOGMODULE_TKEY      (&dns_modules[20])
-#define DNS_LOGMODULE_SDB       (&dns_modules[21])
-#define DNS_LOGMODULE_DIFF      (&dns_modules[22])
-#define DNS_LOGMODULE_HINTS     (&dns_modules[23])
-#define DNS_LOGMODULE_UNUSED1   (&dns_modules[24])
-#define DNS_LOGMODULE_DLZ       (&dns_modules[25])
-#define DNS_LOGMODULE_DNSSEC    (&dns_modules[26])
-#define DNS_LOGMODULE_CRYPTO    (&dns_modules[27])
-#define DNS_LOGMODULE_PACKETS   (&dns_modules[28])
-#define DNS_LOGMODULE_NTA       (&dns_modules[29])
-#define DNS_LOGMODULE_DYNDB     (&dns_modules[30])
-#define DNS_LOGMODULE_DNSTAP    (&dns_modules[31])
-#define DNS_LOGMODULE_SSU       (&dns_modules[32])
-#define DNS_LOGMODULE_QP        (&dns_modules[33])
-
-ISC_LANG_BEGINDECLS
-
-void
-dns_log_init(void);
-/*%
- * Make the libdns categories and modules available for use with the
- * ISC logging library.
- *
- * Requires:
- *\li  lctx is a valid logging context.
- *
- *\li  dns_log_init() is called only once.
- *
- * Ensures:
- * \li The categories and modules defined above are available for
- *     use by isc_log_usechannnel() and isc_log_write().
- */
-
-ISC_LANG_ENDDECLS
index 81c641dd848eafb518e13455a597f074e06dd15a..5970f61160cc23f2c2b22ecfc0975b56f79c64eb 100644 (file)
@@ -1413,14 +1413,13 @@ dns_message_gettimeadjust(dns_message_t *msg);
 
 void
 dns_message_logpacket(dns_message_t *message, const char *description,
-                     const isc_sockaddr_t *address,
-                     isc_logcategory_t *category, isc_logmodule_t *module,
-                     int level, isc_mem_t *mctx);
+                     const isc_sockaddr_t *address, isc_logcategory_t category,
+                     isc_logmodule_t module, int level, isc_mem_t *mctx);
 
 void
 dns_message_logfmtpacket(dns_message_t *message, const char *description,
                         const isc_sockaddr_t *address,
-                        isc_logcategory_t *category, isc_logmodule_t *module,
+                        isc_logcategory_t category, isc_logmodule_t module,
                         const dns_master_style_t *style, int level,
                         isc_mem_t *mctx);
 /*%<
index cf1c1e9ba4c63f836e37290949268c563989fe1b..75f92b63f7b0c2ae881bd670b15664857aae7e9c 100644 (file)
@@ -365,8 +365,8 @@ dns_resolver_destroyfetch(dns_fetch_t **fetchp);
  */
 
 void
-dns_resolver_logfetch(dns_fetch_t *fetch, isc_logcategory_t *category,
-                     isc_logmodule_t *module, int level, bool duplicateok);
+dns_resolver_logfetch(dns_fetch_t *fetch, isc_logcategory_t category,
+                     isc_logmodule_t module, int level, bool duplicateok);
 /*%<
  * Dump a log message on internal state at the completion of given 'fetch'.
  * 'lctx', 'category', 'module', and 'level' are used to write the log message.
index a394ddd72e034e5b62f261452c1214975372dcf2..5bbcaaa552829986e2887865f69a9643b2aac52f 100644 (file)
@@ -2108,7 +2108,7 @@ dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup);
  */
 
 void
-dns_zone_logv(dns_zone_t *zone, isc_logcategory_t *category, int level,
+dns_zone_logv(dns_zone_t *zone, isc_logcategory_t category, int level,
              const char *prefix, const char *msg, va_list ap);
 /*%<
  * Log the message 'msg...' at 'level' using log category 'category', including
@@ -2125,7 +2125,7 @@ dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...)
  */
 
 void
-dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
+dns_zone_logc(dns_zone_t *zone, isc_logcategory_t category, int level,
              const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
 /*%<
  * Log the message 'msg...' at 'level', including text that identifies
index 85f99ad63e485af08fd8b37a3bd025dcb9af3170..c63a743f81694efb23240e299e5d07c65e3151b2 100644 (file)
 #include <stdbool.h>
 
 #include <isc/lang.h>
+#include <isc/log.h>
 #include <isc/stdtime.h>
 
 #include <dns/ds.h>
 #include <dns/dsdigest.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/secalg.h>
 #include <dns/types.h>
@@ -37,9 +37,10 @@ ISC_LANG_BEGINDECLS
  ***/
 
 /*%
- * The dst_key structure is opaque.  Applications should use the accessor
- * functions provided to retrieve key attributes.  If an application needs
- * to set attributes, new accessor functions will be written.
+ * The dst_key structure is opaque.  Applications should use the
+ * accessor functions provided to retrieve key attributes.  If an
+ * application needs to set attributes, new accessor functions will be
+ * written.
  */
 
 typedef struct dst_key    dst_key_t;
@@ -219,7 +220,7 @@ dst_ds_digest_supported(unsigned int digest_type);
  */
 
 isc_result_t
-dst_context_create(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t *category,
+dst_context_create(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t category,
                   bool useforsigning, int maxbits, dst_context_t **dctxp);
 /*%<
  * Creates a context to be used for a sign or verify operation.
index e41df8d8e2bc96a61a7eb8bc437102345a4c4630..5a27cf7df227566a553573c9ca4e0a9a5b51c3e7 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <isc/dir.h>
 #include <isc/file.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/overflow.h>
 #include <isc/result.h>
 #include <dns/compress.h>
 #include <dns/db.h>
 #include <dns/dbiterator.h>
-#include <dns/diff.h>
 #include <dns/fixedname.h>
 #include <dns/journal.h>
-#include <dns/log.h>
 #include <dns/rdataset.h>
 #include <dns/rdatasetiter.h>
 #include <dns/soa.h>
index d31af74574d92eebbb21c72d8a9563cd1d590bd1..4a85a0170ea01526926d84639d9a87cef6a315de 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <dns/kasp.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 
 #include <dst/dst.h>
 
index baabe2dbba77833ea9150a99c625c9905b8160ee..35e3a835658543e89adcb4218d211c1dd56618da 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <isc/buffer.h>
 #include <isc/dir.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -30,7 +31,6 @@
 #include <dns/kasp.h>
 #include <dns/keymgr.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 
 #include <dst/dst.h>
 
diff --git a/lib/dns/log.c b/lib/dns/log.c
deleted file mode 100644 (file)
index 3e31ab1..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 <isc/util.h>
-
-#include <dns/log.h>
-
-/*%
- * When adding a new category, be sure to add the appropriate
- * \#define to <dns/log.h>.
- */
-isc_logcategory_t dns_categories[] = {
-       { "notify", 0 },        { "database", 0 },
-       { "security", 0 },      { "_placeholder", 0 },
-       { "dnssec", 0 },        { "resolver", 0 },
-       { "xfer-in", 0 },       { "xfer-out", 0 },
-       { "dispatch", 0 },      { "lame-servers", 0 },
-       { "edns-disabled", 0 }, { "rpz", 0 },
-       { "rate-limit", 0 },    { "cname", 0 },
-       { "spill", 0 },         { "dnstap", 0 },
-       { "zoneload", 0 },      { "nsid", 0 },
-       { "rpz-passthru", 0 },  { NULL, 0 }
-};
-
-/*%
- * When adding a new module, be sure to add the appropriate
- * \#define to <dns/log.h>.
- */
-isc_logmodule_t dns_modules[] = {
-       { "dns/db", 0 },         { "dns/rbtdb", 0 },    { "dns/rbt", 0 },
-       { "dns/rdata", 0 },      { "dns/master", 0 },   { "dns/message", 0 },
-       { "dns/cache", 0 },      { "dns/config", 0 },   { "dns/resolver", 0 },
-       { "dns/zone", 0 },       { "dns/journal", 0 },  { "dns/adb", 0 },
-       { "dns/xfrin", 0 },      { "dns/xfrout", 0 },   { "dns/acl", 0 },
-       { "dns/validator", 0 },  { "dns/dispatch", 0 }, { "dns/request", 0 },
-       { "dns/masterdump", 0 }, { "dns/tsig", 0 },     { "dns/tkey", 0 },
-       { "dns/sdb", 0 },        { "dns/diff", 0 },     { "dns/hints", 0 },
-       { "dns/unused1", 0 },    { "dns/dlz", 0 },      { "dns/dnssec", 0 },
-       { "dns/crypto", 0 },     { "dns/packets", 0 },  { "dns/nta", 0 },
-       { "dns/dyndb", 0 },      { "dns/dnstap", 0 },   { "dns/ssu", 0 },
-       { "dns/qp", 0 },         { NULL, 0 },
-};
-
-void
-dns_log_init(void) {
-       isc_log_registercategories(dns_categories);
-       isc_log_registermodules(dns_modules);
-}
index aff2290db60bf423a763a5d154d86115ec47a599..7f035b1699c7798d1f2fe844482c94935a8484f7 100644 (file)
@@ -21,6 +21,7 @@
 #include <isc/atomic.h>
 #include <isc/buffer.h>
 #include <isc/file.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/masterdump.h>
 #include <dns/ncache.h>
 #include <dns/rdata.h>
 #include <dns/rdataclass.h>
-#include <dns/rdataset.h>
 #include <dns/rdatasetiter.h>
 #include <dns/rdatatype.h>
 #include <dns/time.h>
index 222db0f7ca5559776a5553e8f13501b5f23f49c3..6f1938a3373fd9030317fcb3a67f7d38cf498489 100644 (file)
@@ -24,6 +24,7 @@
 #include <isc/buffer.h>
 #include <isc/hash.h>
 #include <isc/hashmap.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -33,7 +34,6 @@
 
 #include <dns/dnssec.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/message.h>
 #include <dns/opcode.h>
@@ -213,9 +213,9 @@ msgblock_free(isc_mem_t *, dns_msgblock_t *, unsigned int);
 
 static void
 logfmtpacket(dns_message_t *message, const char *description,
-            const isc_sockaddr_t *address, isc_logcategory_t *category,
-            isc_logmodule_t *module, const dns_master_style_t *style,
-            int level, isc_mem_t *mctx);
+            const isc_sockaddr_t *address, isc_logcategory_t category,
+            isc_logmodule_t module, const dns_master_style_t *style, int level,
+            isc_mem_t *mctx);
 
 /*
  * Allocate a new dns_msgblock_t, and return a pointer to it.  If no memory
@@ -4661,9 +4661,8 @@ dns_opcode_totext(dns_opcode_t opcode, isc_buffer_t *target) {
 
 void
 dns_message_logpacket(dns_message_t *message, const char *description,
-                     const isc_sockaddr_t *address,
-                     isc_logcategory_t *category, isc_logmodule_t *module,
-                     int level, isc_mem_t *mctx) {
+                     const isc_sockaddr_t *address, isc_logcategory_t category,
+                     isc_logmodule_t module, int level, isc_mem_t *mctx) {
        REQUIRE(address != NULL);
 
        logfmtpacket(message, description, address, category, module,
@@ -4673,7 +4672,7 @@ dns_message_logpacket(dns_message_t *message, const char *description,
 void
 dns_message_logfmtpacket(dns_message_t *message, const char *description,
                         const isc_sockaddr_t *address,
-                        isc_logcategory_t *category, isc_logmodule_t *module,
+                        isc_logcategory_t category, isc_logmodule_t module,
                         const dns_master_style_t *style, int level,
                         isc_mem_t *mctx) {
        REQUIRE(address != NULL);
@@ -4684,9 +4683,9 @@ dns_message_logfmtpacket(dns_message_t *message, const char *description,
 
 static void
 logfmtpacket(dns_message_t *message, const char *description,
-            const isc_sockaddr_t *address, isc_logcategory_t *category,
-            isc_logmodule_t *module, const dns_master_style_t *style,
-            int level, isc_mem_t *mctx) {
+            const isc_sockaddr_t *address, isc_logcategory_t category,
+            isc_logmodule_t module, const dns_master_style_t *style, int level,
+            isc_mem_t *mctx) {
        char addrbuf[ISC_SOCKADDR_FORMATSIZE] = { 0 };
        const char *newline = "\n";
        const char *space = " ";
index e977146a545d028b76ce753c080f4b8d4ce13727..91f322f341ee686c1674fc8d9775f7e5664b0997 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <dns/db.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/nta.h>
 #include <dns/qp.h>
index 6ae723646ff0f021c460f325278f2132f61ec09f..c94c8fb0a39425c79c451bf742d536e1f8f43ac1 100644 (file)
@@ -27,6 +27,7 @@
  * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
 #include <isc/mutexblock.h>
@@ -36,8 +37,6 @@
 #include <isc/tls.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
-
 #include "dst_internal.h"
 #include "dst_openssl.h"
 
index 3c454868b07ba7de00c16fab23a1b4756ab48de9..bab8db89b72d6f7f68b4ac038b146ad846816330 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <isc/atomic.h>
 #include <isc/buffer.h>
+#include <isc/log.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -41,7 +42,6 @@
 #include <isc/util.h>
 
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/qp.h>
 #include <dns/types.h>
index d7b23800cdf0dbfc415c6110ed083ed05aa8cca6..11fcff3f6dbfb835169aa729945133e38fd4d6eb 100644 (file)
@@ -25,6 +25,7 @@
 #include <isc/hashmap.h>
 #include <isc/heap.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -44,7 +45,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/nsec.h>
 #include <dns/qp.h>
 #define DNS_QPDB_EXPIRE_TTL_COUNT 10
 
 /*%
- * This is the structure that is used for each node in the qp trie of trees.
- * For now it is a copy of the dns_rbtnode structure.
+ * This is the structure that is used for each node in the qp trie of
+ * trees. For now it is a copy of the dns_rbtnode structure.
  */
 typedef struct qpcnode qpcnode_t;
 struct qpcnode {
index 2bf4ab2a2d4c3f3fe6ff593ff59243d0cd83f49a..0e6d0eb23d10fee9a138d6901a6fb20f64c95840 100644 (file)
@@ -23,6 +23,7 @@
 #include <isc/file.h>
 #include <isc/heap.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -42,7 +43,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/name.h>
 #include <dns/nsec.h>
index 4e9f2e04088e0b7e0214f474a5ee4b864d12cb82..d5e571d1e0237d04c443103e7eeeb30babd524a1 100644 (file)
@@ -25,6 +25,7 @@
 #include <isc/hashmap.h>
 #include <isc/heap.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -44,7 +45,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/nsec.h>
 #include <dns/nsec3.h>
 
 /*%
  * See if a given cache entry that is being reused needs to be updated
- * in the LRU-list.  From the LRU management point of view, this function is
- * expected to return true for almost all cases.  When used with threads,
- * however, this may cause a non-negligible performance penalty because a
- * writer lock will have to be acquired before updating the list.
- * If DNS_RBTDB_LIMITLRUUPDATE is defined to be non 0 at compilation time, this
- * function returns true if the entry has not been updated for some period of
- * time.  We differentiate the NS or glue address case and the others since
- * experiments have shown that the former tends to be accessed relatively
- * infrequently and the cost of cache miss is higher (e.g., a missing NS records
- * may cause external queries at a higher level zone, involving more
+ * in the LRU-list.  From the LRU management point of view, this
+ * function is expected to return true for almost all cases.  When used
+ * with threads, however, this may cause a non-negligible performance
+ * penalty because a writer lock will have to be acquired before
+ * updating the list. If DNS_RBTDB_LIMITLRUUPDATE is defined to be non 0
+ * at compilation time, this function returns true if the entry has not
+ * been updated for some period of time.  We differentiate the NS or
+ * glue address case and the others since experiments have shown that
+ * the former tends to be accessed relatively infrequently and the cost
+ * of cache miss is higher (e.g., a missing NS records may cause
+ * external queries at a higher level zone, involving more
  * transactions).
  *
  * Caller must hold the node (read or write) lock.
index 67e23aaf1a3d1b0ce2c41ccfd9c17929fdd5e93e..16636375a2be77426a96f6563a0ee4d88994e648 100644 (file)
@@ -25,6 +25,7 @@
 #include <isc/hashmap.h>
 #include <isc/heap.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -44,7 +45,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/nsec.h>
 #include <dns/nsec3.h>
index bbda64eb5c045f263cb735029ae126899fbe3d18..1c7cddc685783c694d86c60a1366eb9e6ec3000a 100644 (file)
 #include <inttypes.h>
 #include <stdbool.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include <isc/file.h>
 #include <isc/hash.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/once.h>
 #include <isc/refcount.h>
+#include <isc/result.h>
 #include <isc/stdio.h>
 #include <isc/string.h>
 #include <isc/util.h>
 
-/*%
- * This define is so dns/name.h (included by dns/fixedname.h) uses more
- * efficient macro calls instead of functions for a few operations.
- */
-#include <unistd.h>
-
-#include <isc/result.h>
-
 #include <dns/db.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/rbt.h>
 
 #define CHECK(x)                             \
index 5b971178b4158f3b806a98deb28a1b8c940cd5b7..a9832ffb9a31fdc0433eeee520bcd1d6f3ae3cc0 100644 (file)
@@ -25,6 +25,7 @@
 #include <isc/hashmap.h>
 #include <isc/heap.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/mem.h>
 #include <isc/mutex.h>
@@ -44,7 +45,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/masterdump.h>
 #include <dns/nsec.h>
 #include <dns/nsec3.h>
index 352df5b0e6e2cf5d8ed8627f8bf3ca3f753d0e88..e4db0e629045c8feb3195178a6f1db3f7c472c56 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdbool.h>
 
 #include <isc/async.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
@@ -29,7 +30,6 @@
 #include <dns/acl.h>
 #include <dns/compress.h>
 #include <dns/dispatch.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/rdata.h>
 #include <dns/rdatastruct.h>
index 9e052799e53c6dd61884114a0adca2d98bc79f07..ee0ca2ee2deead241d3f25e96d8fe1d9b6592f73 100644 (file)
@@ -50,7 +50,6 @@
 #include <dns/edns.h>
 #include <dns/forward.h>
 #include <dns/keytable.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/name.h>
 #include <dns/nametree.h>
 #define NS_PROCESSING_LIMIT 20
 
 STATIC_ASSERT(NS_PROCESSING_LIMIT > NS_RR_LIMIT,
-             "The maximum number of NS RRs processed for each delegation "
-             "(NS_PROCESSING_LIMIT) must be larger than the large delegation "
+             "The maximum number of NS RRs processed for each "
+             "delegation "
+             "(NS_PROCESSING_LIMIT) must be larger than the large "
+             "delegation "
              "threshold (NS_RR_LIMIT).");
 
 /* Hash table for zone counters */
@@ -10611,8 +10612,8 @@ dns_resolver_destroyfetch(dns_fetch_t **fetchp) {
 }
 
 void
-dns_resolver_logfetch(dns_fetch_t *fetch, isc_logcategory_t *category,
-                     isc_logmodule_t *module, int level, bool duplicateok) {
+dns_resolver_logfetch(dns_fetch_t *fetch, isc_logcategory_t category,
+                     isc_logmodule_t module, int level, bool duplicateok) {
        fetchctx_t *fctx = NULL;
 
        REQUIRE(DNS_FETCH_VALID(fetch));
index 0ff172133fd327ab8798e4a757e31cf2cabdd7c5..b8fedf22bf7bebc4fefcbca623fe4befdc15533f 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 
 #include <isc/buffer.h>
+#include <isc/log.h>
 #include <isc/result.h>
 #include <isc/string.h>
 #include <isc/util.h>
@@ -24,7 +25,6 @@
 #include <dns/db.h>
 #include <dns/dbiterator.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/rdata.h>
 #include <dns/rdataset.h>
index c25c9588e6331b2a6327d9324f49f0795165e597..9eda7378eab226d20f28ba86f9038b35b6e56505 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <isc/async.h>
 #include <isc/buffer.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
@@ -36,7 +37,6 @@
 #include <dns/dbiterator.h>
 #include <dns/dnsrps.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/qp.h>
 #include <dns/rdata.h>
 #include <dns/rdataset.h>
index fae2fe6cbb088846de011b6855072807ef0051d0..ca70a635bef1c3ae99775c3527da37105972a113 100644 (file)
@@ -22,6 +22,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/net.h>
 #include <isc/netaddr.h>
@@ -29,7 +30,6 @@
 #include <isc/result.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rcode.h>
 #include <dns/rdataclass.h>
index 3442060773e9198a41db97288f6c9589c176e09f..653ef48d344885c0a884e4a8373ecbeb0af9f180 100644 (file)
@@ -70,7 +70,6 @@
 #include <dns/dbiterator.h>
 #include <dns/dlz.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/rdata.h>
 #include <dns/rdatalist.h>
index c2c05e9bedcb15314e438b6611e0b5960d452c31..9a4a9e980a018edb5a9dfca4cfb895f1dcf56e66 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/un.h>
 #include <unistd.h>
 
+#include <isc/log.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <isc/netaddr.h>
@@ -33,7 +34,6 @@
 #include <isc/util.h>
 
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rdatatype.h>
 #include <dns/ssu.h>
index 4c430467ece9327141310ede79cd05b1a84394c3..26829a5906e9ad13d016669e7e1c9877671f822e 100644 (file)
 #include <inttypes.h>
 #include <stdbool.h>
 
+#include <isc/log.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <isc/refcount.h>
 #include <isc/stats.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
 #include <dns/opcode.h>
 #include <dns/rdatatype.h>
 #include <dns/stats.h>
index 3c3c35581a2fe90184986e1108f69d683fbab754..2f7a0192a87c8689bc6c1e0135d045939e4c285b 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <isc/buffer.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/md.h>
 #include <isc/mem.h>
 #include <isc/nonce.h>
@@ -35,7 +36,6 @@
 #include <dns/dnssec.h>
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/name.h>
 #include <dns/rdata.h>
index eb579d1055c82feb8097fab6c287aa9562838770..d4a4837bc7f424b6a9c1ea91b21b595fcb78743f 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <isc/buffer.h>
 #include <isc/hashmap.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/refcount.h>
 #include <isc/result.h>
@@ -29,7 +30,6 @@
 
 #include <dns/fixedname.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/rdata.h>
 #include <dns/rdatalist.h>
index cc0f545f3eece7498fe920c4894e9becf93aa7e7..659c199378bd9bb1d038adcc1d1d9b36fcabecbb 100644 (file)
@@ -36,7 +36,6 @@
 #include <dns/journal.h>
 #include <dns/kasp.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/nsec.h>
 #include <dns/nsec3.h>
index 5bd046c16801dafb32e1221c8223f920e9ca911c..62f60c7c42082660d8b5c4fd15d61c13d9c3a9c0 100644 (file)
@@ -18,6 +18,7 @@
 #include <isc/base32.h>
 #include <isc/counter.h>
 #include <isc/job.h>
+#include <isc/log.h>
 #include <isc/md.h>
 #include <isc/mem.h>
 #include <isc/refcount.h>
@@ -33,7 +34,6 @@
 #include <dns/ds.h>
 #include <dns/keytable.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/ncache.h>
 #include <dns/nsec.h>
@@ -75,7 +75,8 @@ enum valattr {
        VALATTR_COMPLETE = 1 << 3,           /*%< Completion event sent. */
        VALATTR_INSECURITY = 1 << 4,         /*%< Attempting proveunsecure. */
        VALATTR_MAXVALIDATIONS = 1 << 5,     /*%< Max validations quota */
-       VALATTR_MAXVALIDATIONFAILS = 1 << 6, /*%< Max validation fails quota */
+       VALATTR_MAXVALIDATIONFAILS = 1 << 6, /*%< Max validation fails
+                                               quota */
 
        /*!
         * NSEC proofs to be looked for.
@@ -139,8 +140,8 @@ static isc_result_t
 proveunsecure(dns_validator_t *val, bool have_ds, bool resume);
 
 static void
-validator_logv(dns_validator_t *val, isc_logcategory_t *category,
-              isc_logmodule_t *module, int level, const char *fmt, va_list ap)
+validator_logv(dns_validator_t *val, isc_logcategory_t category,
+              isc_logmodule_t module, int level, const char *fmt, va_list ap)
        ISC_FORMAT_PRINTF(5, 0);
 
 static void
@@ -3502,9 +3503,8 @@ dns_validator_shutdown(dns_validator_t *val) {
 }
 
 static void
-validator_logv(dns_validator_t *val, isc_logcategory_t *category,
-              isc_logmodule_t *module, int level, const char *fmt,
-              va_list ap) {
+validator_logv(dns_validator_t *val, isc_logcategory_t category,
+              isc_logmodule_t module, int level, const char *fmt, va_list ap) {
        char msgbuf[2048];
        static const char spaces[] = "        *";
        int depth = val->depth * 2;
index 6b81048243358031724b9f24090dadef6895f3ba..66a96a7fc0cd5a324a601dd3797ee335234edce9 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <isc/async.h>
 #include <isc/atomic.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/random.h>
 #include <isc/result.h>
@@ -31,7 +32,6 @@
 #include <dns/diff.h>
 #include <dns/dispatch.h>
 #include <dns/journal.h>
-#include <dns/log.h>
 #include <dns/message.h>
 #include <dns/peer.h>
 #include <dns/rdataclass.h>
 
 /*%
  * The states of the *XFR state machine.  We handle both IXFR and AXFR
- * with a single integrated state machine because they cannot be distinguished
- * immediately - an AXFR response to an IXFR request can only be detected
- * when the first two (2) response RRs have already been received.
+ * with a single integrated state machine because they cannot be
+ * distinguished immediately - an AXFR response to an IXFR request can
+ * only be detected when the first two (2) response RRs have already
+ * been received.
  */
 typedef enum {
        XFRST_SOAQUERY,
index 050ad77c190fa4704a587dc7be57ebf8ee82edb5..b68383eb22e26c887de0c7d240e4ea8efb5e95a7 100644 (file)
@@ -23,6 +23,7 @@
 #include <isc/hash.h>
 #include <isc/hashmap.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/md.h>
 #include <isc/mutex.h>
@@ -57,7 +58,6 @@
 #include <dns/keymgr.h>
 #include <dns/keytable.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/master.h>
 #include <dns/masterdump.h>
 #include <dns/message.h>
@@ -15733,7 +15733,7 @@ dns_zone_nameonly(dns_zone_t *zone, char *buf, size_t length) {
 }
 
 void
-dns_zone_logv(dns_zone_t *zone, isc_logcategory_t *category, int level,
+dns_zone_logv(dns_zone_t *zone, isc_logcategory_t category, int level,
              const char *prefix, const char *fmt, va_list ap) {
        char message[4096];
        const char *zstr;
@@ -15773,7 +15773,7 @@ notify_log(dns_zone_t *zone, int level, const char *fmt, ...) {
 }
 
 void
-dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
+dns_zone_logc(dns_zone_t *zone, isc_logcategory_t category, int level,
              const char *fmt, ...) {
        va_list ap;
 
index 3419ef1f9192a26cbb11c8de0f581fd477f49bc3..b52f651d8b6030fcda56ee4779a3f195a84e0bc7 100644 (file)
@@ -36,7 +36,6 @@
 #include <dns/fixedname.h>
 #include <dns/keytable.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/nsec.h>
 #include <dns/nsec3.h>
index 3d0b48176ab63f5e010b5c080109240610ae075d..b8001f68eea6a395a01ac75567aecea828f0f7b8 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <isc/atomic.h>
 #include <isc/file.h>
+#include <isc/log.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <isc/result.h>
@@ -25,7 +26,6 @@
 #include <isc/tid.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/qp.h>
 #include <dns/rdataclass.h>
index 0fa27edd89c1748146e38b9cca421f9a8c4af534..aace374f6c45ea77cfafbde90911889ec76a6825 100644 (file)
@@ -62,7 +62,7 @@ isc_backtrace_symbols_fd(void *const *buffer, int size, int fd) {
 }
 
 void
-isc_backtrace_log(isc_logcategory_t *category, isc_logmodule_t *module,
+isc_backtrace_log(isc_logcategory_t category, isc_logmodule_t module,
                  int level) {
        void *tracebuf[ISC_BACKTRACE_MAXFRAME];
        int nframes;
@@ -107,7 +107,7 @@ isc_backtrace_symbols_fd(void *const *buffer, int size, int fd) {
 }
 
 void
-isc_backtrace_log(isc_logcategory_t *category, isc_logmodule_t *module,
+isc_backtrace_log(isc_logcategory_t category, isc_logmodule_t module,
                  int level) {
        UNUSED(category);
        UNUSED(module);
index bfe887ce82600b51c48a87e480a4b52a79e74d7c..2198f2a408874e21a72a1dd01486d0aa80c510b5 100644 (file)
@@ -32,6 +32,7 @@
 /***
  ***   Imports
  ***/
+#include <isc/log.h>
 #include <isc/types.h>
 
 /*
@@ -105,7 +106,7 @@ isc_backtrace_symbols_fd(void *const *buffer, int size, int fd);
  */
 
 void
-isc_backtrace_log(isc_logcategory_t *category, isc_logmodule_t *module,
+isc_backtrace_log(isc_logcategory_t category, isc_logmodule_t module,
                  int level);
 /*
  * Write a backtrace to the log.
index 6b67e0a3dca5236d8c1510dd55584681c34446b0..0143bfa15fa3cc7431baf6ce9227bd5a3517a3c2 100644 (file)
@@ -15,6 +15,7 @@
 
 /*! \file isc/log.h */
 
+#include <inttypes.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -24,6 +25,8 @@
 #include <isc/lang.h>
 #include <isc/types.h>
 
+typedef struct isc_logconfig isc_logconfig_t; /*%< Log Configuration */
+
 /*@{*/
 /*!
  * \brief Severity levels, patterned after Unix's syslog levels.
@@ -100,17 +103,131 @@ typedef enum {
  * structures names each category, and the id value is initialized by calling
  * isc_log_registercategories.
  */
-struct isc_logcategory {
-       const char  *name;
-       unsigned int id;
+typedef enum isc_logcategory isc_logcategory_t; /*%< Log Category */
+enum isc_logcategory {
+       /*%
+        * Do not log directly to DEFAULT.  Use another category.
+        * When in doubt, use GENERAL.
+        */
+       ISC_LOGCATEGORY_ALL = -2,
+       ISC_LOGCATEGORY_INVALID = -1,
+       /* isc categories */
+       ISC_LOGCATEGORY_DEFAULT = 0,
+       ISC_LOGCATEGORY_GENERAL,
+       DNS_LOGCATEGORY_GENERAL = ISC_LOGCATEGORY_GENERAL,
+       NS_LOGCATEGORY_GENERAL = ISC_LOGCATEGORY_GENERAL,
+       NAMED_LOGCATEGORY_GENERAL = ISC_LOGCATEGORY_GENERAL,
+       ISC_LOGCATEGORY_SSLKEYLOG,
+       /* dns categories */
+       DNS_LOGCATEGORY_NOTIFY,
+       DNS_LOGCATEGORY_DATABASE,
+       DNS_LOGCATEGORY_SECURITY,
+       DNS_LOGCATEGORY_DNSSEC,
+       DNS_LOGCATEGORY_RESOLVER,
+       DNS_LOGCATEGORY_XFER_IN,
+       DNS_LOGCATEGORY_XFER_OUT,
+       DNS_LOGCATEGORY_DISPATCH,
+       DNS_LOGCATEGORY_LAME_SERVERS,
+       DNS_LOGCATEGORY_EDNS_DISABLED,
+       DNS_LOGCATEGORY_RPZ,
+       DNS_LOGCATEGORY_RRL,
+       DNS_LOGCATEGORY_CNAME,
+       DNS_LOGCATEGORY_SPILL,
+       DNS_LOGCATEGORY_DNSTAP,
+       DNS_LOGCATEGORY_ZONELOAD,
+       DNS_LOGCATEGORY_NSID,
+       DNS_LOGCATEGORY_RPZ_PASSTHRU,
+       /* ns categories */
+       NS_LOGCATEGORY_CLIENT,
+       NS_LOGCATEGORY_NETWORK,
+       NS_LOGCATEGORY_UPDATE,
+       NS_LOGCATEGORY_QUERIES,
+       NS_LOGCATEGORY_UPDATE_SECURITY,
+       NS_LOGCATEGORY_QUERY_ERRORS,
+       NS_LOGCATEGORY_TAT,
+       NS_LOGCATEGORY_SERVE_STALE,
+       /* cfg categories */
+       CFG_LOGCATEGORY_CONFIG,
+       /* named categories */
+       NAMED_LOGCATEGORY_UNMATCHED,
+       /* delv categories */
+       DELV_LOGCATEGORY_DEFAULT,
+
+       ISC_LOGCATEGORY_MAX, /*% The number of categories */
+       ISC_LOGCATEGORY_MAKE_ENUM_32BIT = INT32_MAX,
 };
 
 /*%
  * Similar to isc_logcategory, but for all the modules a library defines.
  */
-struct isc_logmodule {
-       const char  *name;
-       unsigned int id;
+typedef enum isc_logmodule isc_logmodule_t; /*%< Log Module */
+enum isc_logmodule {
+       ISC_LOGMODULE_ALL = -2,
+       ISC_LOGMODULE_INVALID = -1,
+       /* isc modules */
+       ISC_LOGMODULE_NONE = 0,
+       ISC_LOGMODULE_SOCKET,
+       ISC_LOGMODULE_TIME,
+       ISC_LOGMODULE_INTERFACE,
+       ISC_LOGMODULE_TIMER,
+       ISC_LOGMODULE_FILE,
+       ISC_LOGMODULE_NETMGR,
+       ISC_LOGMODULE_OTHER,
+       /* dns modules */
+       DNS_LOGMODULE_DB,
+       DNS_LOGMODULE_RBTDB,
+       DNS_LOGMODULE_RBT,
+       DNS_LOGMODULE_RDATA,
+       DNS_LOGMODULE_MASTER,
+       DNS_LOGMODULE_MESSAGE,
+       DNS_LOGMODULE_CACHE,
+       DNS_LOGMODULE_CONFIG,
+       DNS_LOGMODULE_RESOLVER,
+       DNS_LOGMODULE_ZONE,
+       DNS_LOGMODULE_JOURNAL,
+       DNS_LOGMODULE_ADB,
+       DNS_LOGMODULE_XFER_IN,
+       DNS_LOGMODULE_XFER_OUT,
+       DNS_LOGMODULE_ACL,
+       DNS_LOGMODULE_VALIDATOR,
+       DNS_LOGMODULE_DISPATCH,
+       DNS_LOGMODULE_REQUEST,
+       DNS_LOGMODULE_MASTERDUMP,
+       DNS_LOGMODULE_TSIG,
+       DNS_LOGMODULE_TKEY,
+       DNS_LOGMODULE_SDB,
+       DNS_LOGMODULE_DIFF,
+       DNS_LOGMODULE_HINTS,
+       DNS_LOGMODULE_UNUSED1,
+       DNS_LOGMODULE_DLZ,
+       DNS_LOGMODULE_DNSSEC,
+       DNS_LOGMODULE_CRYPTO,
+       DNS_LOGMODULE_PACKETS,
+       DNS_LOGMODULE_NTA,
+       DNS_LOGMODULE_DYNDB,
+       DNS_LOGMODULE_DNSTAP,
+       DNS_LOGMODULE_SSU,
+       DNS_LOGMODULE_QP,
+       /* ns modules */
+       NS_LOGMODULE_CLIENT,
+       NS_LOGMODULE_QUERY,
+       NS_LOGMODULE_INTERFACEMGR,
+       NS_LOGMODULE_UPDATE,
+       NS_LOGMODULE_XFER_IN,
+       NS_LOGMODULE_XFER_OUT,
+       NS_LOGMODULE_NOTIFY,
+       NS_LOGMODULE_HOOKS,
+       /* cfg modules */
+       CFG_LOGMODULE_PARSER,
+       /* named modules */
+       NAMED_LOGMODULE_MAIN,
+       NAMED_LOGMODULE_SERVER,
+       NAMED_LOGMODULE_CONTROL,
+       /* delv modules */
+       DELV_LOGMODULE_DEFAULT,
+
+       ISC_LOGMODULE_MAX, /*% The number of modules */
+       ISC_LOGMODULE_MAKE_ENUM_32BIT = INT32_MAX,
 };
 
 /*%
@@ -148,9 +265,20 @@ typedef struct isc_logfile {
  */
 typedef union isc_logdestination {
        isc_logfile_t file;
-       int           facility; /* XXXDCL NT */
+       int           facility;
 } isc_logdestination_t;
 
+#define ISC_LOGDESTINATION_STDERR                               \
+       (&(isc_logdestination_t){                               \
+               .file = {                                       \
+                       .stream = stderr,                       \
+                       .versions = ISC_LOG_ROLLNEVER,          \
+                       .suffix = isc_log_rollsuffix_increment, \
+               } })
+
+#define ISC_LOGDESTINATION_SYSLOG(f) \
+       (&(isc_logdestination_t){ .facility = (f) })
+
 /*@{*/
 /*%
  * The built-in categories of libisc.
@@ -163,24 +291,6 @@ extern isc_logcategory_t isc_categories[];
 extern isc_logmodule_t  isc_modules[];
 /*@}*/
 
-/*@{*/
-/*%
- * Do not log directly to DEFAULT.  Use another category.  When in doubt,
- * use GENERAL.
- */
-#define ISC_LOGCATEGORY_DEFAULT          (&isc_categories[0])
-#define ISC_LOGCATEGORY_GENERAL          (&isc_categories[1])
-#define ISC_LOGCATEGORY_SSLKEYLOG (&isc_categories[2])
-/*@}*/
-
-#define ISC_LOGMODULE_SOCKET   (&isc_modules[0])
-#define ISC_LOGMODULE_TIME     (&isc_modules[1])
-#define ISC_LOGMODULE_INTERFACE (&isc_modules[2])
-#define ISC_LOGMODULE_TIMER    (&isc_modules[3])
-#define ISC_LOGMODULE_FILE     (&isc_modules[4])
-#define ISC_LOGMODULE_NETMGR   (&isc_modules[5])
-#define ISC_LOGMODULE_OTHER    (&isc_modules[6])
-
 ISC_LANG_BEGINDECLS
 
 void
@@ -262,82 +372,6 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp);
  *\li  The configuration is marked as invalid.
  */
 
-void
-isc_log_registercategories(isc_logcategory_t categories[]);
-/*%<
- * Identify logging categories a library will use.
- *
- * Notes:
- *\li  A category should only be registered once, but no mechanism enforces
- *     this rule.
- *
- *\li  The end of the categories array is identified by a NULL name.
- *
- *\li  Because the name is used by #ISC_LOG_PRINTCATEGORY, it should not
- *     be altered or destroyed after isc_log_registercategories().
- *
- *\li  Because each element of the categories array is used by
- *     isc_log_categorybyname, it should not be altered or destroyed
- *     after registration.
- *
- *\li  The value of the id integer in each structure is overwritten
- *     by this function, and so id need not be initialized to any particular
- *     value prior to the function call.
- *
- *\li  A subsequent call to isc_log_registercategories with the same
- *     logging context (but new categories) will cause the last
- *     element of the categories array from the prior call to have
- *     its "name" member changed from NULL to point to the new
- *     categories array, and its "id" member set to UINT_MAX.
- *
- * Requires:
- *\li  lctx is a valid logging context.
- *\li  categories != NULL.
- *\li  categories[0].name != NULL.
- *
- * Ensures:
- * \li There are references to each category in the logging context,
- *     so they can be used with isc_log_usechannel() and isc_log_write().
- */
-
-void
-isc_log_registermodules(isc_logmodule_t modules[]);
-/*%<
- * Identify logging categories a library will use.
- *
- * Notes:
- *\li  A module should only be registered once, but no mechanism enforces
- *     this rule.
- *
- *\li  The end of the modules array is identified by a NULL name.
- *
- *\li  Because the name is used by #ISC_LOG_PRINTMODULE, it should not
- *     be altered or destroyed after isc_log_registermodules().
- *
- *\li  Because each element of the modules array is used by
- *     isc_log_modulebyname, it should not be altered or destroyed
- *     after registration.
- *
- *\li  The value of the id integer in each structure is overwritten
- *     by this function, and so id need not be initialized to any particular
- *     value prior to the function call.
- *
- *\li  A subsequent call to isc_log_registermodules with the same
- *     logging context (but new modules) will cause the last
- *     element of the modules array from the prior call to have
- *     its "name" member changed from NULL to point to the new
- *     modules array, and its "id" member set to UINT_MAX.
- *
- * Requires:
- *\li  lctx is a valid logging context.
- *\li  modules != NULL.
- *\li  modules[0].name != NULL;
- *
- * Ensures:
- *\li  Each module has a reference in the logging context, so they can be
- *     used with isc_log_usechannel() and isc_log_write().
- */
-
 void
 isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
                      unsigned int type, int level,
@@ -403,8 +437,8 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
 
 isc_result_t
 isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
-                  const isc_logcategory_t *category,
-                  const isc_logmodule_t   *module);
+                  const isc_logcategory_t category,
+                  const isc_logmodule_t   module);
 /*%<
  * Associate a named logging channel with a category and module that
  * will use it.
@@ -499,7 +533,7 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
  *     meaningful error.
  */
 void
-isc_log_write(isc_logcategory_t *category, isc_logmodule_t *module, int level,
+isc_log_write(isc_logcategory_t category, isc_logmodule_t module, int level,
              const char *format, ...)
 
        ISC_FORMAT_PRINTF(4, 5);
@@ -537,7 +571,7 @@ isc_log_write(isc_logcategory_t *category, isc_logmodule_t *module, int level,
  *     meaningful error.
  */
 void
-isc_log_vwrite(isc_logcategory_t *category, isc_logmodule_t *module, int level,
+isc_log_vwrite(isc_logcategory_t category, isc_logmodule_t module, int level,
               const char *format, va_list args)
 
        ISC_FORMAT_PRINTF(4, 0);
@@ -693,7 +727,7 @@ isc_log_closefilelogs(void);
  *     next needed.
  */
 
-isc_logcategory_t *
+isc_logcategory_t
 isc_log_categorybyname(const char *name);
 /*%<
  * Find a category by its name.
@@ -711,24 +745,6 @@ isc_log_categorybyname(const char *name);
  *\li  NULL if no category exists by that name.
  */
 
-isc_logmodule_t *
-isc_log_modulebyname(const char *name);
-/*%<
- * Find a module by its name.
- *
- * Notes:
- *\li  The string name of a module is not required to be unique.
- *
- * Requires:
- *\li  lctx is a valid context.
- *\li  name is not NULL.
- *
- * Returns:
- *\li  A pointer to the _first_ isc_logmodule_t structure used by "name".
- *
- *\li  NULL if no module exists by that name.
- */
-
 isc_result_t
 isc_logfile_roll(isc_logfile_t *file);
 /*%<
index 7d96dda4f0e2e45a51d120714dfbcded498d2385..e3bc16eb60145d094778257c07e419699143289a 100644 (file)
@@ -13,6 +13,7 @@
 
 #pragma once
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/region.h>
 #include <isc/result.h>
@@ -620,6 +621,6 @@ isc__tls_setdestroycheck(bool check);
        isc__tlserr2result(category, module, funcname, fallback, __FILE__, \
                           __LINE__)
 isc_result_t
-isc__tlserr2result(isc_logcategory_t *category, isc_logmodule_t *module,
+isc__tlserr2result(isc_logcategory_t category, isc_logmodule_t module,
                   const char *funcname, isc_result_t fallback,
                   const char *file, int line);
index 8ff41178532f4d3bc7a7c8a96301a0bb31bda6f6..21549e51d52528205d1606673265e11cd2b9da46 100644 (file)
@@ -49,9 +49,6 @@ typedef void(isc_httpdondestroy_t)(void *); /*%< Callback on destroying httpd */
 typedef struct isc_interface    isc_interface_t;     /*%< Interface */
 typedef struct isc_interfaceiter isc_interfaceiter_t; /*%< Interface Iterator */
 typedef struct isc_lex          isc_lex_t;           /*%< Lex */
-typedef struct isc_logcategory  isc_logcategory_t;   /*%< Log Category */
-typedef struct isc_logconfig    isc_logconfig_t;     /*%< Log Configuration */
-typedef struct isc_logmodule    isc_logmodule_t;     /*%< Log Module */
 typedef struct isc_loop                 isc_loop_t;          /*%< Event loop */
 typedef struct isc_loopmgr      isc_loopmgr_t;       /*%< Event loop manager */
 typedef struct isc_mem          isc_mem_t;           /*%< Memory */
index badb37e79f827650cc396055facd6e50d93a9291..eb9c4d0d7ab23423fcb6734959f1d272fcaa1dee 100644 (file)
@@ -86,7 +86,7 @@ struct isc_logchannel {
 typedef struct isc_logchannellist isc_logchannellist_t;
 
 struct isc_logchannellist {
-       const isc_logmodule_t *module;
+       isc_logmodule_t module;
        isc_logchannel_t *channel;
        ISC_LINK(isc_logchannellist_t) link;
 };
@@ -114,8 +114,7 @@ struct isc_logconfig {
        unsigned int magic;
        isc_log_t *lctx;
        ISC_LIST(isc_logchannel_t) channels;
-       ISC_LIST(isc_logchannellist_t) * channellists;
-       unsigned int channellist_count;
+       ISC_LIST(isc_logchannellist_t) channellists[ISC_LOGCATEGORY_MAX];
        int_fast32_t highest_level;
        char *tag;
        bool dynamic;
@@ -134,10 +133,6 @@ struct isc_log {
        /* Not locked. */
        unsigned int magic;
        isc_mem_t *mctx;
-       isc_logcategory_t *categories;
-       unsigned int category_count;
-       isc_logmodule_t *modules;
-       unsigned int module_count;
        atomic_int_fast32_t debug_level;
        /* RCU-protected pointer */
        isc_logconfig_t *logconfig;
@@ -169,20 +164,113 @@ static const int syslog_map[] = { LOG_DEBUG,   LOG_INFO, LOG_NOTICE,
  * be overridden.  Since the default is always looked up as the first
  * channellist in the log context, it must come first in isc_categories[].
  */
-isc_logcategory_t isc_categories[] = { { "default", 0 }, /* "default
-                                                           must come
-                                                           first. */
-                                      { "general", 0 },
-                                      { "sslkeylog", 0 },
-                                      { NULL, 0 } };
+static const char *categories_description[] = {
+       /* libisc categories */
+       [ISC_LOGCATEGORY_DEFAULT] = "default",
+       [ISC_LOGCATEGORY_GENERAL] = "general",
+       [ISC_LOGCATEGORY_SSLKEYLOG] = "sslkeylog",
+       /* dns categories */
+       [DNS_LOGCATEGORY_NOTIFY] = "notify",
+       [DNS_LOGCATEGORY_DATABASE] = "database",
+       [DNS_LOGCATEGORY_SECURITY] = "security",
+       [DNS_LOGCATEGORY_DNSSEC] = "dnssec",
+       [DNS_LOGCATEGORY_RESOLVER] = "resolver",
+       [DNS_LOGCATEGORY_XFER_IN] = "xfer-in",
+       [DNS_LOGCATEGORY_XFER_OUT] = "xfer-out",
+       [DNS_LOGCATEGORY_DISPATCH] = "dispatch",
+       [DNS_LOGCATEGORY_LAME_SERVERS] = "lame-servers",
+       [DNS_LOGCATEGORY_EDNS_DISABLED] = "edns-disabled",
+       [DNS_LOGCATEGORY_RPZ] = "rpz",
+       [DNS_LOGCATEGORY_RRL] = "rate-limit",
+       [DNS_LOGCATEGORY_CNAME] = "cname",
+       [DNS_LOGCATEGORY_SPILL] = "spill",
+       [DNS_LOGCATEGORY_DNSTAP] = "dnstap",
+       [DNS_LOGCATEGORY_ZONELOAD] = "zoneload",
+       [DNS_LOGCATEGORY_NSID] = "nsid",
+       [DNS_LOGCATEGORY_RPZ_PASSTHRU] = "rpz-passthru",
+       /* ns categories */
+       [NS_LOGCATEGORY_CLIENT] = "client",
+       [NS_LOGCATEGORY_NETWORK] = "network",
+       [NS_LOGCATEGORY_UPDATE] = "update",
+       [NS_LOGCATEGORY_QUERIES] = "queries",
+       [NS_LOGCATEGORY_UPDATE_SECURITY] = "update-security",
+       [NS_LOGCATEGORY_QUERY_ERRORS] = "query-errors",
+       [NS_LOGCATEGORY_TAT] = "trust-anchor-telemetry",
+       [NS_LOGCATEGORY_SERVE_STALE] = "serve-stale",
+       /* cfg categories */
+       [CFG_LOGCATEGORY_CONFIG] = "config",
+       /* named categories */
+       [NAMED_LOGCATEGORY_UNMATCHED] = "unmatched",
+       /* delv categories */
+       [DELV_LOGCATEGORY_DEFAULT] = "delv",
+};
 
 /*!
  * See above comment for categories, and apply it to modules.
  */
-isc_logmodule_t isc_modules[] = { { "socket", 0 },    { "time", 0 },
-                                 { "interface", 0 }, { "timer", 0 },
-                                 { "file", 0 },      { "netmgr", 0 },
-                                 { "other", 0 },     { NULL, 0 } };
+static const char *modules_description[] = {
+       /* isc modules */
+       [ISC_LOGMODULE_NONE] = "no_module",
+       [ISC_LOGMODULE_SOCKET] = "socket",
+       [ISC_LOGMODULE_TIME] = "time",
+       [ISC_LOGMODULE_INTERFACE] = "interface",
+       [ISC_LOGMODULE_TIMER] = "timer",
+       [ISC_LOGMODULE_FILE] = "file",
+       [ISC_LOGMODULE_NETMGR] = "netmgr",
+       [ISC_LOGMODULE_OTHER] = "other",
+       /* dns modules */
+       [DNS_LOGMODULE_DB] = "dns/db",
+       [DNS_LOGMODULE_RBTDB] = "dns/rbtdb",
+       [DNS_LOGMODULE_RBT] = "dns/rbt",
+       [DNS_LOGMODULE_RDATA] = "dns/rdata",
+       [DNS_LOGMODULE_MASTER] = "dns/master",
+       [DNS_LOGMODULE_MESSAGE] = "dns/message",
+       [DNS_LOGMODULE_CACHE] = "dns/cache",
+       [DNS_LOGMODULE_CONFIG] = "dns/config",
+       [DNS_LOGMODULE_RESOLVER] = "dns/resolver",
+       [DNS_LOGMODULE_ZONE] = "dns/zone",
+       [DNS_LOGMODULE_JOURNAL] = "dns/journal",
+       [DNS_LOGMODULE_ADB] = "dns/adb",
+       [DNS_LOGMODULE_XFER_IN] = "dns/xfrin",
+       [DNS_LOGMODULE_XFER_OUT] = "dns/xfrout",
+       [DNS_LOGMODULE_ACL] = "dns/acl",
+       [DNS_LOGMODULE_VALIDATOR] = "dns/validator",
+       [DNS_LOGMODULE_DISPATCH] = "dns/dispatch",
+       [DNS_LOGMODULE_REQUEST] = "dns/request",
+       [DNS_LOGMODULE_MASTERDUMP] = "dns/masterdump",
+       [DNS_LOGMODULE_TSIG] = "dns/tsig",
+       [DNS_LOGMODULE_TKEY] = "dns/tkey",
+       [DNS_LOGMODULE_SDB] = "dns/sdb",
+       [DNS_LOGMODULE_DIFF] = "dns/diff",
+       [DNS_LOGMODULE_HINTS] = "dns/hints",
+       [DNS_LOGMODULE_UNUSED1] = "dns/unused1",
+       [DNS_LOGMODULE_DLZ] = "dns/dlz",
+       [DNS_LOGMODULE_DNSSEC] = "dns/dnssec",
+       [DNS_LOGMODULE_CRYPTO] = "dns/crypto",
+       [DNS_LOGMODULE_PACKETS] = "dns/packets",
+       [DNS_LOGMODULE_NTA] = "dns/nta",
+       [DNS_LOGMODULE_DYNDB] = "dns/dyndb",
+       [DNS_LOGMODULE_DNSTAP] = "dns/dnstap",
+       [DNS_LOGMODULE_SSU] = "dns/ssu",
+       [DNS_LOGMODULE_QP] = "dns/qp",
+       /* ns modules */
+       [NS_LOGMODULE_CLIENT] = "ns/client",
+       [NS_LOGMODULE_QUERY] = "ns/query",
+       [NS_LOGMODULE_INTERFACEMGR] = "ns/interfacemgr",
+       [NS_LOGMODULE_UPDATE] = "ns/update",
+       [NS_LOGMODULE_XFER_IN] = "ns/xfer-in",
+       [NS_LOGMODULE_XFER_OUT] = "ns/xfer-out",
+       [NS_LOGMODULE_NOTIFY] = "ns/notify",
+       [NS_LOGMODULE_HOOKS] = "ns/hooks",
+       /* cfg modules */
+       [CFG_LOGMODULE_PARSER] = "isccfg/parser",
+       /* named modules */
+       [NAMED_LOGMODULE_MAIN] = "main",
+       [NAMED_LOGMODULE_SERVER] = "server",
+       [NAMED_LOGMODULE_CONTROL] = "control",
+       /* delv modules */
+       [DELV_LOGMODULE_DEFAULT] = "delv",
+};
 
 /*!
  * This essentially constant structure must be filled in at run time,
@@ -200,11 +288,8 @@ static isc_log_t *isc__lctx = NULL;
  * Forward declarations.
  */
 static void
-assignchannel(isc_logconfig_t *lcfg, unsigned int category_id,
-             const isc_logmodule_t *module, isc_logchannel_t *channel);
-
-static void
-sync_channellist(isc_logconfig_t *lcfg);
+assignchannel(isc_logconfig_t *lcfg, const isc_logcategory_t category,
+             const isc_logmodule_t module, isc_logchannel_t *channel);
 
 static void
 sync_highest_level(isc_logconfig_t *lcfg);
@@ -213,7 +298,7 @@ static isc_result_t
 greatest_version(isc_logfile_t *file, int versions, int *greatest);
 
 static void
-isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
+isc_log_doit(isc_logcategory_t category, isc_logmodule_t module, int level,
             const char *format, va_list args) ISC_FORMAT_PRINTF(4, 0);
 
 /*@{*/
@@ -239,7 +324,6 @@ isc_logconfig_create(isc_logconfig_t **lcfgp) {
        REQUIRE(lcfgp != NULL && *lcfgp == NULL);
        REQUIRE(VALID_CONTEXT(isc__lctx));
 
-       isc_logdestination_t destination;
        int level = ISC_LOG_INFO;
 
        isc_logconfig_t *lcfg = isc_mem_get(isc__lctx->mctx, sizeof(*lcfg));
@@ -255,17 +339,11 @@ isc_logconfig_create(isc_logconfig_t **lcfgp) {
         * Create the default channels:
         *      default_syslog, default_stderr, default_debug and null.
         */
-       destination.facility = LOG_DAEMON;
        isc_log_createchannel(lcfg, "default_syslog", ISC_LOG_TOSYSLOG, level,
-                             &destination, 0);
+                             ISC_LOGDESTINATION_SYSLOG(LOG_DAEMON), 0);
 
-       destination.file = (isc_logfile_t){
-               .stream = stderr,
-               .versions = ISC_LOG_ROLLNEVER,
-               .suffix = isc_log_rollsuffix_increment,
-       };
        isc_log_createchannel(lcfg, "default_stderr", ISC_LOG_TOFILEDESC, level,
-                             &destination, ISC_LOG_PRINTTIME);
+                             ISC_LOGDESTINATION_STDERR, ISC_LOG_PRINTTIME);
 
        /*
         * Set the default category's channel to default_stderr,
@@ -274,13 +352,9 @@ isc_logconfig_create(isc_logconfig_t **lcfgp) {
         */
        default_channel.channel = ISC_LIST_HEAD(lcfg->channels);
 
-       destination.file = (isc_logfile_t){
-               .stream = stderr,
-               .versions = ISC_LOG_ROLLNEVER,
-               .suffix = isc_log_rollsuffix_increment,
-       };
        isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TOFILEDESC,
-                             ISC_LOG_DYNAMIC, &destination, ISC_LOG_PRINTTIME);
+                             ISC_LOG_DYNAMIC, ISC_LOGDESTINATION_STDERR,
+                             ISC_LOG_PRINTTIME);
 
        isc_log_createchannel(lcfg, "null", ISC_LOG_TONULL, ISC_LOG_DYNAMIC,
                              NULL, 0);
@@ -301,13 +375,6 @@ isc_logconfig_set(isc_logconfig_t *lcfg) {
        REQUIRE(VALID_CONFIG(lcfg));
        REQUIRE(lcfg->lctx == isc__lctx);
 
-       /*
-        * Ensure that lcfg->channellist_count == lctx->category_count.
-        * They won't be equal if isc_log_usechannel has not been called
-        * since any call to isc_log_registercategories.
-        */
-       sync_channellist(lcfg);
-
        isc_logconfig_t *old_cfg = rcu_xchg_pointer(&isc__lctx->logconfig,
                                                    lcfg);
        sync_highest_level(lcfg);
@@ -324,7 +391,6 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp) {
        isc_mem_t *mctx;
        isc_logchannel_t *channel;
        char *filename;
-       unsigned int i;
 
        REQUIRE(lcfgp != NULL && VALID_CONFIG(*lcfgp));
 
@@ -365,19 +431,15 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp) {
                isc_mem_put(mctx, channel, sizeof(*channel));
        }
 
-       for (i = 0; i < lcfg->channellist_count; i++) {
-               isc_logchannellist_t *item;
-               while ((item = ISC_LIST_HEAD(lcfg->channellists[i])) != NULL) {
+       for (size_t i = 0; i < ARRAY_SIZE(lcfg->channellists); i++) {
+               isc_logchannellist_t *item = NULL, *next = NULL;
+               ISC_LIST_FOREACH_SAFE (lcfg->channellists[i], item, link, next)
+               {
                        ISC_LIST_UNLINK(lcfg->channellists[i], item, link);
                        isc_mem_put(mctx, item, sizeof(*item));
                }
        }
 
-       if (lcfg->channellist_count > 0) {
-               isc_mem_cput(mctx, lcfg->channellists, lcfg->channellist_count,
-                            sizeof(ISC_LIST(isc_logchannellist_t)));
-       }
-
        lcfg->dynamic = false;
        if (lcfg->tag != NULL) {
                isc_mem_free(lcfg->lctx->mctx, lcfg->tag);
@@ -389,144 +451,20 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp) {
        isc_mem_put(mctx, lcfg, sizeof(*lcfg));
 }
 
-void
-isc_log_registercategories(isc_logcategory_t categories[]) {
-       REQUIRE(VALID_CONTEXT(isc__lctx));
-       REQUIRE(categories != NULL && categories[0].name != NULL);
-
-       /*
-        * XXXDCL This somewhat sleazy situation of using the last pointer
-        * in one category array to point to the next array exists because
-        * this registration function returns void and I didn't want to have
-        * change everything that used it by making it return an isc_result_t.
-        * It would need to do that if it had to allocate memory to store
-        * pointers to each array passed in.
-        */
-       if (isc__lctx->categories == NULL) {
-               isc__lctx->categories = categories;
-       } else {
-               /*
-                * Adjust the last (NULL) pointer of the already registered
-                * categories to point to the incoming array.
-                */
-               isc_logcategory_t *catp = NULL;
-               for (catp = isc__lctx->categories; catp->name != NULL;) {
-                       if (catp->id == UINT_MAX) {
-                               /*
-                                * The name pointer points to the next array.
-                                * Ick.
-                                */
-                               catp = UNCONST(catp->name);
-                       } else {
-                               catp++;
-                       }
-               }
-
-               catp->name = (void *)categories;
-               catp->id = UINT_MAX;
-       }
-
-       /*
-        * Update the id number of the category with its new global id.
-        */
-       for (isc_logcategory_t *catp = categories; catp->name != NULL; catp++) {
-               catp->id = isc__lctx->category_count++;
-       }
-}
-
-isc_logcategory_t *
+isc_logcategory_t
 isc_log_categorybyname(const char *name) {
-       isc_logcategory_t *catp;
-
-       REQUIRE(VALID_CONTEXT(isc__lctx));
-       REQUIRE(name != NULL);
-
-       for (catp = isc__lctx->categories; catp->name != NULL;) {
-               if (catp->id == UINT_MAX) {
-                       /*
-                        * catp is neither modified nor returned to the
-                        * caller, so removing its const qualifier is ok.
-                        */
-                       catp = UNCONST(catp->name);
-               } else {
-                       if (strcmp(catp->name, name) == 0) {
-                               return (catp);
-                       }
-                       catp++;
-               }
-       }
-
-       return (NULL);
-}
-
-void
-isc_log_registermodules(isc_logmodule_t modules[]) {
-       REQUIRE(VALID_CONTEXT(isc__lctx));
-       REQUIRE(modules != NULL && modules[0].name != NULL);
-
-       /*
-        * XXXDCL This somewhat sleazy situation of using the last pointer
-        * in one category array to point to the next array exists because
-        * this registration function returns void and I didn't want to have
-        * change everything that used it by making it return an isc_result_t.
-        * It would need to do that if it had to allocate memory to store
-        * pointers to each array passed in.
-        */
-       if (isc__lctx->modules == NULL) {
-               isc__lctx->modules = modules;
-       } else {
-               /*
-                * Adjust the last (NULL) pointer of the already registered
-                * modules to point to the incoming array.
-                */
-               isc_logmodule_t *modp = NULL;
-               for (modp = isc__lctx->modules; modp->name != NULL;) {
-                       if (modp->id == UINT_MAX) {
-                               /*
-                                * The name pointer points to the next array.
-                                * Ick.
-                                */
-                               modp = UNCONST(modp->name);
-                       } else {
-                               modp++;
-                       }
-               }
-
-               modp->name = (void *)modules;
-               modp->id = UINT_MAX;
-       }
-
-       /*
-        * Update the id number of the module with its new global id.
-        */
-       for (isc_logmodule_t *modp = modules; modp->name != NULL; modp++) {
-               modp->id = isc__lctx->module_count++;
-       }
-}
-
-isc_logmodule_t *
-isc_log_modulebyname(const char *name) {
-       isc_logmodule_t *modp;
-
        REQUIRE(VALID_CONTEXT(isc__lctx));
        REQUIRE(name != NULL);
 
-       for (modp = isc__lctx->modules; modp->name != NULL;) {
-               if (modp->id == UINT_MAX) {
-                       /*
-                        * modp is neither modified nor returned to the
-                        * caller, so removing its const qualifier is ok.
-                        */
-                       modp = UNCONST(modp->name);
-               } else {
-                       if (strcmp(modp->name, name) == 0) {
-                               return (modp);
-                       }
-                       modp++;
+       for (isc_logcategory_t category = 0; category < ISC_LOGCATEGORY_MAX;
+            category++)
+       {
+               if (strcmp(categories_description[category], name) == 0) {
+                       return (category);
                }
        }
 
-       return (NULL);
+       return (ISC_LOGCATEGORY_INVALID);
 }
 
 void
@@ -610,15 +548,14 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
 
 isc_result_t
 isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
-                  const isc_logcategory_t *category,
-                  const isc_logmodule_t *module) {
+                  const isc_logcategory_t category,
+                  const isc_logmodule_t module) {
        REQUIRE(VALID_CONFIG(lcfg));
        REQUIRE(name != NULL);
-
-       isc_log_t *lctx = lcfg->lctx;
-
-       REQUIRE(category == NULL || category->id < lctx->category_count);
-       REQUIRE(module == NULL || module->id < lctx->module_count);
+       REQUIRE(category == ISC_LOGCATEGORY_ALL ||
+               (category >= 0 && category < ISC_LOGCATEGORY_MAX));
+       REQUIRE(module == ISC_LOGMODULE_ALL ||
+               (module >= 0 && module < ISC_LOGMODULE_MAX));
 
        isc_logchannel_t *channel;
        for (channel = ISC_LIST_HEAD(lcfg->channels); channel != NULL;
@@ -633,14 +570,14 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
                return (ISC_R_NOTFOUND);
        }
 
-       if (category != NULL) {
-               assignchannel(lcfg, category->id, module, channel);
+       if (category != ISC_LOGCATEGORY_ALL) {
+               assignchannel(lcfg, category, module, channel);
        } else {
                /*
                 * Assign to all categories.  Note that this includes
                 * the default channel.
                 */
-               for (size_t i = 0; i < lctx->category_count; i++) {
+               for (size_t i = 0; i < ISC_LOGCATEGORY_MAX; i++) {
                        assignchannel(lcfg, i, module, channel);
                }
        }
@@ -658,7 +595,7 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
 }
 
 void
-isc_log_write(isc_logcategory_t *category, isc_logmodule_t *module, int level,
+isc_log_write(isc_logcategory_t category, isc_logmodule_t module, int level,
              const char *format, ...) {
        va_list args;
 
@@ -672,7 +609,7 @@ isc_log_write(isc_logcategory_t *category, isc_logmodule_t *module, int level,
 }
 
 void
-isc_log_vwrite(isc_logcategory_t *category, isc_logmodule_t *module, int level,
+isc_log_vwrite(isc_logcategory_t category, isc_logmodule_t module, int level,
               const char *format, va_list args) {
        /*
         * Contract checking is done in isc_log_doit().
@@ -777,28 +714,24 @@ isc_log_closefilelogs(void) {
 ****/
 
 static void
-assignchannel(isc_logconfig_t *lcfg, unsigned int category_id,
-             const isc_logmodule_t *module, isc_logchannel_t *channel) {
+assignchannel(isc_logconfig_t *lcfg, const isc_logcategory_t category,
+             const isc_logmodule_t module, isc_logchannel_t *channel) {
        REQUIRE(VALID_CONFIG(lcfg));
        REQUIRE(channel != NULL);
 
        isc_log_t *lctx = lcfg->lctx;
 
-       REQUIRE(category_id < lctx->category_count);
-       REQUIRE(module == NULL || module->id < lctx->module_count);
-
-       /*
-        * Ensure lcfg->channellist_count == lctx->category_count.
-        */
-       sync_channellist(lcfg);
+       REQUIRE(category > ISC_LOGCATEGORY_INVALID &&
+               category < ISC_LOGCATEGORY_MAX);
+       REQUIRE(module == ISC_LOGMODULE_ALL ||
+               (module > ISC_LOGMODULE_INVALID && module < ISC_LOGMODULE_MAX));
 
        isc_logchannellist_t *new_item = isc_mem_get(lctx->mctx,
                                                     sizeof(*new_item));
 
        new_item->channel = channel;
        new_item->module = module;
-       ISC_LIST_INITANDPREPEND(lcfg->channellists[category_id], new_item,
-                               link);
+       ISC_LIST_INITANDPREPEND(lcfg->channellists[category], new_item, link);
 
        /*
         * Remember the highest logging level set by any channel in the
@@ -815,29 +748,6 @@ assignchannel(isc_logconfig_t *lcfg, unsigned int category_id,
        }
 }
 
-/*
- * This would ideally be part of isc_log_registercategories(), except then
- * that function would have to return isc_result_t instead of void.
- */
-static void
-sync_channellist(isc_logconfig_t *lcfg) {
-       REQUIRE(VALID_CONFIG(lcfg));
-
-       isc_log_t *lctx = lcfg->lctx;
-
-       REQUIRE(lctx->category_count != 0);
-
-       if (lctx->category_count == lcfg->channellist_count) {
-               return;
-       }
-
-       lcfg->channellists = isc_mem_creget(
-               lctx->mctx, lcfg->channellists, lcfg->channellist_count,
-               lctx->category_count, sizeof(ISC_LIST(isc_logchannellist_t)));
-
-       lcfg->channellist_count = lctx->category_count;
-}
-
 static void
 sync_highest_level(isc_logconfig_t *lcfg) {
        atomic_store(&isc__lctx->highest_level, lcfg->highest_level);
@@ -1329,7 +1239,7 @@ isc_log_wouldlog(int level) {
 }
 
 static void
-isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
+isc_log_doit(isc_logcategory_t category, isc_logmodule_t module, int level,
             const char *format, va_list args) {
        int syslog_level;
        const char *time_string;
@@ -1347,23 +1257,11 @@ isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
        isc_result_t result;
 
        REQUIRE(isc__lctx == NULL || VALID_CONTEXT(isc__lctx));
-       REQUIRE(category != NULL);
-       REQUIRE(module != NULL);
+       REQUIRE(category >= 0 && category < ISC_LOGCATEGORY_MAX);
+       REQUIRE(module >= 0 && module < ISC_LOGMODULE_MAX);
        REQUIRE(level != ISC_LOG_DYNAMIC);
        REQUIRE(format != NULL);
 
-       /*
-        * Programs can use libraries that use this logging code without
-        * wanting to do any logging, thus the log context is allowed to
-        * be non-existent.
-        */
-       if (isc__lctx == NULL) {
-               return;
-       }
-
-       REQUIRE(category->id < isc__lctx->category_count);
-       REQUIRE(module->id < isc__lctx->module_count);
-
        if (!isc_log_wouldlog(level)) {
                return;
        }
@@ -1382,12 +1280,8 @@ isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
                goto unlock;
        }
 
-       category_channels = ISC_LIST_HEAD(lcfg->channellists[category->id]);
+       category_channels = ISC_LIST_HEAD(lcfg->channellists[category]);
 
-       /*
-        * XXXDCL add duplicate filtering? (To not write multiple times
-        * to the same source via various channels).
-        */
        do {
                /*
                 * If the channel list end was reached and a match was
@@ -1417,7 +1311,7 @@ isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
                        category_channels = &default_channel;
                }
 
-               if (category_channels->module != NULL &&
+               if (category_channels->module != ISC_LOGMODULE_ALL &&
                    category_channels->module != module)
                {
                        category_channels = ISC_LIST_NEXT(category_channels,
@@ -1572,11 +1466,10 @@ isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
                                printtime ? time_string : "",
                                printtime ? " " : "", printtag ? lcfg->tag : "",
                                printcolon ? ": " : "",
-                               printcategory ? category->name : "",
+                               printcategory ? categories_description[category]
+                                             : "",
                                printcategory ? ": " : "",
-                               printmodule ? (module != NULL ? module->name
-                                                             : "no_module")
-                                           : "",
+                               printmodule ? modules_description[module] : "",
                                printmodule ? ": " : "",
                                printlevel ? level_string : "",
                                isc__lctx->buffer);
@@ -1620,11 +1513,10 @@ isc_log_doit(isc_logcategory_t *category, isc_logmodule_t *module, int level,
                                printtime ? time_string : "",
                                printtime ? " " : "", printtag ? lcfg->tag : "",
                                printcolon ? ": " : "",
-                               printcategory ? category->name : "",
+                               printcategory ? categories_description[category]
+                                             : "",
                                printcategory ? ": " : "",
-                               printmodule ? (module != NULL ? module->name
-                                                             : "no_module")
-                                           : "",
+                               printmodule ? modules_description[module] : "",
                                printmodule ? ": " : "",
                                printlevel ? level_string : "",
                                isc__lctx->buffer);
@@ -1660,13 +1552,9 @@ isc__log_initialize(void) {
 
        isc_mutex_init(&isc__lctx->lock);
 
-       isc_log_registercategories(isc_categories);
-       isc_log_registermodules(isc_modules);
-
        /* Create default logging configuration */
        isc_logconfig_t *lcfg = NULL;
        isc_logconfig_create(&lcfg);
-       sync_channellist(lcfg);
 
        atomic_init(&isc__lctx->highest_level, lcfg->highest_level);
        atomic_init(&isc__lctx->dynamic, lcfg->dynamic);
index 825cce13b5379233d0bbe93086f3aa99dd48d7f8..cab00f402fddb73b2fe97e72cd35069dda088923 100644 (file)
@@ -1687,12 +1687,17 @@ isc__tls_toresult(isc_result_t fallback) {
 }
 
 isc_result_t
-isc__tlserr2result(isc_logcategory_t *category, isc_logmodule_t *module,
+isc__tlserr2result(isc_logcategory_t category, isc_logmodule_t module,
                   const char *funcname, isc_result_t fallback,
                   const char *file, int line) {
        isc_result_t result = isc__tls_toresult(fallback);
 
-       if (category == NULL) {
+       /*
+        * This is an exception - normally, we don't allow this, but the
+        * compatibility shims in dst_openssl.h needs a call that just
+        * translates the error code and don't do any logging.
+        */
+       if (category == ISC_LOGCATEGORY_INVALID) {
                goto done;
        }
 
index 2b1f27e3dd32e3f0b2f6d94868d5cedaa92bbd83..cabf5805f1b7985cc57e3b5c4a4e09700cccf61e 100644 (file)
@@ -10,7 +10,6 @@ libisccfg_la_HEADERS =                        \
        include/isccfg/duration.h       \
        include/isccfg/grammar.h        \
        include/isccfg/kaspconf.h       \
-       include/isccfg/log.h            \
        include/isccfg/namedconf.h
 
 libisccfg_la_SOURCES =                 \
@@ -20,7 +19,6 @@ libisccfg_la_SOURCES =                        \
        dnsconf.c                       \
        duration.c                      \
        kaspconf.c                      \
-       log.c                           \
        namedconf.c                     \
        parser.c
 
index ebe18b6dbe9f3e489d0434bd2e4e733ea9561314..daf012d0ed01223f37171298a4914c2e8d79111f 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/string.h>
 #include <isc/util.h>
@@ -22,7 +23,6 @@
 #include <dns/acl.h>
 #include <dns/fixedname.h>
 #include <dns/iptable.h>
-#include <dns/log.h>
 
 #include <isccfg/aclconf.h>
 #include <isccfg/namedconf.h>
index f5fa78e14a6a4713c2eb49353a32c1f5afc0560e..87c85921db10290b491c6b9c315522fa60971320 100644 (file)
@@ -5888,7 +5888,8 @@ check_logging(const cfg_obj_t *config, isc_mem_t *mctx) {
        {
                category = cfg_listelt_value(element);
                catname = cfg_obj_asstring(cfg_tuple_get(category, "name"));
-               if (isc_log_categorybyname(catname) == NULL) {
+               if (isc_log_categorybyname(catname) == ISC_LOGCATEGORY_INVALID)
+               {
                        cfg_obj_log(category, ISC_LOG_ERROR,
                                    "undefined category: '%s'", catname);
                        result = ISC_R_FAILURE;
diff --git a/lib/isccfg/include/isccfg/log.h b/lib/isccfg/include/isccfg/log.h
deleted file mode 100644 (file)
index 53bc2a4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 isccfg/log.h */
-
-#include <isc/lang.h>
-#include <isc/log.h>
-
-extern isc_logcategory_t cfg_categories[];
-extern isc_logmodule_t  cfg_modules[];
-
-#define CFG_LOGCATEGORY_CONFIG (&cfg_categories[0])
-
-#define CFG_LOGMODULE_PARSER (&cfg_modules[0])
-
-ISC_LANG_BEGINDECLS
-
-void
-cfg_log_init(void);
-/*%<
- * Make the libisccfg categories and modules available for use with the
- * ISC logging library.
- *
- * Requires:
- *\li  cfg_log_init() is called only once.
- *
- * Ensures:
- * \li The categories and modules defined above are available for
- *     use by isc_log_usechannnel() and isc_log_write().
- */
-
-ISC_LANG_ENDDECLS
index 7dad436449f5ed62b0c721674b956d6259c2500d..98a49f7004fc2ad7a10ccbd1af0951f685952031 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 
 #include <isc/fips.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/region.h>
 #include <isc/result.h>
@@ -26,7 +27,6 @@
 #include <dns/kasp.h>
 #include <dns/keystore.h>
 #include <dns/keyvalues.h>
-#include <dns/log.h>
 #include <dns/nsec3.h>
 #include <dns/secalg.h>
 #include <dns/ttl.h>
diff --git a/lib/isccfg/log.c b/lib/isccfg/log.c
deleted file mode 100644 (file)
index 54ec3ad..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 <isc/util.h>
-
-#include <isccfg/log.h>
-
-/*%
- * When adding a new category, be sure to add the appropriate
- * \#define to <isccfg/log.h>.
- */
-isc_logcategory_t cfg_categories[] = { { "config", 0 }, { NULL, 0 } };
-
-/*%
- * When adding a new module, be sure to add the appropriate
- * \#define to <isccfg/log.h>.
- */
-isc_logmodule_t cfg_modules[] = { { "isccfg/parser", 0 }, { NULL, 0 } };
-
-void
-cfg_log_init(void) {
-       isc_log_registercategories(cfg_categories);
-       isc_log_registermodules(cfg_modules);
-}
index a1b9dc3d1fdbb7fb2d1e671273481843f3e0e443..21496e0bc7267b4b4b681b824ca0f90b82ca5542 100644 (file)
@@ -19,6 +19,7 @@
 #include <string.h>
 
 #include <isc/lex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -28,7 +29,6 @@
 
 #include <isccfg/cfg.h>
 #include <isccfg/grammar.h>
-#include <isccfg/log.h>
 #include <isccfg/namedconf.h>
 
 #define TOKEN_STRING(pctx) (pctx->token.value.as_textregion.base)
index 3cd8308dece01f07a4320c9ab4cd3ad1e4ebc5ea..e882eb9b8f03167df3f69868e65cc387b2bc5977 100644 (file)
@@ -67,7 +67,6 @@
 
 #include <isccfg/cfg.h>
 #include <isccfg/grammar.h>
-#include <isccfg/log.h>
 
 /* Shorthand */
 #define CAT CFG_LOGCATEGORY_CONFIG
index 39b64a76b3728eb4f52b5c737076875486738fe5..a1533c9db2b0b9e447bef1ff1df1236b4ea696f2 100644 (file)
@@ -12,7 +12,6 @@ libns_la_HEADERS =                    \
        include/ns/hooks.h              \
        include/ns/interfacemgr.h       \
        include/ns/listenlist.h         \
-       include/ns/log.h                \
        include/ns/notify.h             \
        include/ns/query.h              \
        include/ns/server.h             \
@@ -28,7 +27,6 @@ libns_la_SOURCES =            \
        hooks.c                 \
        interfacemgr.c          \
        listenlist.c            \
-       log.c                   \
        notify.c                \
        probes.d                \
        query.c                 \
index 7bbe6fa7863c9e7860306f4883df38368265b29b..cc76632f0b31727347755f33a02ee9a909b70032 100644 (file)
@@ -58,7 +58,6 @@
 
 #include <ns/client.h>
 #include <ns/interfacemgr.h>
-#include <ns/log.h>
 #include <ns/notify.h>
 #include <ns/server.h>
 #include <ns/stats.h>
@@ -2749,9 +2748,8 @@ ns_client_name(ns_client_t *client, char *peerbuf, size_t len) {
 }
 
 void
-ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
-              isc_logmodule_t *module, int level, const char *fmt,
-              va_list ap) {
+ns_client_logv(ns_client_t *client, isc_logcategory_t category,
+              isc_logmodule_t module, int level, const char *fmt, va_list ap) {
        char msgbuf[4096];
        char signerbuf[DNS_NAME_FORMATSIZE], qnamebuf[DNS_NAME_FORMATSIZE];
        char peerbuf[ISC_SOCKADDR_FORMATSIZE];
@@ -2799,8 +2797,8 @@ ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
 }
 
 void
-ns_client_log(ns_client_t *client, isc_logcategory_t *category,
-             isc_logmodule_t *module, int level, const char *fmt, ...) {
+ns_client_log(ns_client_t *client, isc_logcategory_t category,
+             isc_logmodule_t module, int level, const char *fmt, ...) {
        va_list ap;
 
        if (!isc_log_wouldlog(level)) {
index a14cda0071831065d0c0d983a9a6364ae3a2b7b4..aaf9d07dd8864e527f44d9ebccd9d54e57f9835d 100644 (file)
@@ -30,7 +30,6 @@
 #include <dns/view.h>
 
 #include <ns/hooks.h>
-#include <ns/log.h>
 #include <ns/query.h>
 
 #define CHECK(op)                              \
index 89ee79a67c928c8d889740ed3b66885f2074f12e..bfb4f3a76dc084154d2ac4074f15980549fb96a1 100644 (file)
@@ -405,13 +405,13 @@ ns_client_checkacl(ns_client_t *client, isc_sockaddr_t *sockaddr,
  */
 
 void
-ns_client_log(ns_client_t *client, isc_logcategory_t *category,
-             isc_logmodule_t *module, int level, const char *fmt, ...)
+ns_client_log(ns_client_t *client, isc_logcategory_t category,
+             isc_logmodule_t module, int level, const char *fmt, ...)
        ISC_FORMAT_PRINTF(5, 6);
 
 void
-ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
-              isc_logmodule_t *module, int level, const char *fmt, va_list ap)
+ns_client_logv(ns_client_t *client, isc_logcategory_t category,
+              isc_logmodule_t module, int level, const char *fmt, va_list ap)
        ISC_FORMAT_PRINTF(5, 0);
 
 void
diff --git a/lib/ns/include/ns/log.h b/lib/ns/include/ns/log.h
deleted file mode 100644 (file)
index 884a045..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 */
-
-#include <isc/log.h>
-#include <isc/types.h>
-
-extern isc_logcategory_t ns_categories[];
-extern isc_logmodule_t  ns_modules[];
-
-#define NS_LOGCATEGORY_CLIENT         (&ns_categories[0])
-#define NS_LOGCATEGORY_NETWORK        (&ns_categories[1])
-#define NS_LOGCATEGORY_UPDATE         (&ns_categories[2])
-#define NS_LOGCATEGORY_QUERIES        (&ns_categories[3])
-#define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_categories[4])
-#define NS_LOGCATEGORY_QUERY_ERRORS    (&ns_categories[5])
-#define NS_LOGCATEGORY_TAT            (&ns_categories[6])
-#define NS_LOGCATEGORY_SERVE_STALE     (&ns_categories[7])
-
-/*
- * Backwards compatibility.
- */
-#define NS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
-
-#define NS_LOGMODULE_CLIENT      (&ns_modules[0])
-#define NS_LOGMODULE_QUERY       (&ns_modules[1])
-#define NS_LOGMODULE_INTERFACEMGR (&ns_modules[2])
-#define NS_LOGMODULE_UPDATE      (&ns_modules[3])
-#define NS_LOGMODULE_XFER_IN     (&ns_modules[4])
-#define NS_LOGMODULE_XFER_OUT    (&ns_modules[5])
-#define NS_LOGMODULE_NOTIFY      (&ns_modules[6])
-#define NS_LOGMODULE_HOOKS       (&ns_modules[7])
-
-void
-ns_log_init(void);
-/*%<
- * Make the libns categories and modules available for use with the
- * ISC logging library.
- *
- * Requires:
- *\li  lctx is a valid logging context.
- *
- *\li  ns_log_init() is called only once.
- *
- * Ensures:
- *\li  The categories and modules defined above are available for
- *     use by isc_log_usechannnel() and isc_log_write().
- */
index 9c952ee928a85014f0b28c17d91e99556121785c..6f227143d6a27d595e5434b03399377c9ab0d205 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 
 #include <isc/interfaceiter.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/netmgr.h>
 #include <isc/os.h>
@@ -29,7 +30,6 @@
 
 #include <ns/client.h>
 #include <ns/interfacemgr.h>
-#include <ns/log.h>
 #include <ns/server.h>
 #include <ns/stats.h>
 
index acaaece2d19f7df94a3cd116cd34cefac1bb9606..8e04c4f2ac1d7e5fdac65f1b34864c60248f99fb 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <stdbool.h>
 
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/netmgr.h>
 #include <isc/util.h>
@@ -22,7 +23,6 @@
 #include <dns/acl.h>
 
 #include <ns/listenlist.h>
-#include <ns/log.h>
 
 static void
 destroy(ns_listenlist_t *list);
diff --git a/lib/ns/log.c b/lib/ns/log.c
deleted file mode 100644 (file)
index 6083085..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 <isc/result.h>
-#include <isc/util.h>
-
-#include <ns/log.h>
-
-#ifndef ISC_FACILITY
-#define ISC_FACILITY LOG_DAEMON
-#endif /* ifndef ISC_FACILITY */
-
-/*%
- * When adding a new category, be sure to add the appropriate
- * \#define to <ns/log.h>
- */
-isc_logcategory_t ns_categories[] = { { "client", 0 },
-                                     { "network", 0 },
-                                     { "update", 0 },
-                                     { "queries", 0 },
-                                     { "update-security", 0 },
-                                     { "query-errors", 0 },
-                                     { "trust-anchor-telemetry", 0 },
-                                     { "serve-stale", 0 },
-                                     { NULL, 0 } };
-
-/*%
- * When adding a new module, be sure to add the appropriate
- * \#define to <ns/log.h>.
- */
-isc_logmodule_t ns_modules[] = {
-       { "ns/client", 0 }, { "ns/query", 0 },   { "ns/interfacemgr", 0 },
-       { "ns/update", 0 }, { "ns/xfer-in", 0 }, { "ns/xfer-out", 0 },
-       { "ns/notify", 0 }, { "ns/hooks", 0 },   { NULL, 0 }
-};
-
-void
-ns_log_init(void) {
-       isc_log_registercategories(ns_categories);
-       isc_log_registermodules(ns_modules);
-}
index f2ae6e5f8406d567914cf4f110c62342c76e7687..b973f288c67f6643b703089ecabd8cc26244e214 100644 (file)
@@ -22,7 +22,6 @@
 #include <dns/zone.h>
 #include <dns/zt.h>
 
-#include <ns/log.h>
 #include <ns/notify.h>
 #include <ns/types.h>
 
index dfd7cc60fc653015e4802c34c86512f2c7683c34..e7fce1b10176af831d00c5f3e67da3d649f488bc 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <isc/async.h>
 #include <isc/hex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/once.h>
 #include <isc/random.h>
@@ -67,7 +68,6 @@
 #include <ns/client.h>
 #include <ns/hooks.h>
 #include <ns/interfacemgr.h>
-#include <ns/log.h>
 #include <ns/server.h>
 #include <ns/sortlist.h>
 #include <ns/stats.h>
@@ -1195,9 +1195,9 @@ rpz_log_rewrite(ns_client_t *client, bool disabled, dns_rpz_policy_t policy,
        dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf));
 
        /* It's possible to have a separate log channel for rpz passthru. */
-       isc_logcategory_t *log_cat = (policy == DNS_RPZ_POLICY_PASSTHRU)
-                                            ? DNS_LOGCATEGORY_RPZ_PASSTHRU
-                                            : DNS_LOGCATEGORY_RPZ;
+       isc_logcategory_t log_cat = (policy == DNS_RPZ_POLICY_PASSTHRU)
+                                           ? DNS_LOGCATEGORY_RPZ_PASSTHRU
+                                           : DNS_LOGCATEGORY_RPZ;
 
        ns_client_log(client, log_cat, NS_LOGMODULE_QUERY, DNS_RPZ_INFO_LEVEL,
                      "%srpz %s %s rewrite %s/%s/%s via %s%s%s%s",
@@ -6211,7 +6211,7 @@ fetch_callback(void *arg) {
        ns_client_t *client = resp->arg;
        dns_fetch_t *fetch = NULL;
        bool fetch_canceled = false;
-       isc_logcategory_t *logcategory = NS_LOGCATEGORY_QUERY_ERRORS;
+       isc_logcategory_t logcategory = NS_LOGCATEGORY_QUERY_ERRORS;
        isc_result_t result;
        int errorloglevel;
        query_ctx_t qctx;
index ceeecbbf4dbd844c8d13af823e0fae862fca587a..dbc2a1590c4bdcf719a6d70e967d5d7efadf0f02 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdbool.h>
 
 #include <isc/async.h>
+#include <isc/log.h>
 #include <isc/netaddr.h>
 #include <isc/serial.h>
 #include <isc/stats.h>
@@ -48,7 +49,6 @@
 
 #include <ns/client.h>
 #include <ns/interfacemgr.h>
-#include <ns/log.h>
 #include <ns/server.h>
 #include <ns/stats.h>
 #include <ns/update.h>
index 85c04d8863a9f8f02caf053e2dde009111920201..35a08c38aa5e397bf872ed64d19dfd5ebfa76907 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdbool.h>
 
 #include <isc/formatcheck.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/netmgr.h>
 #include <isc/result.h>
@@ -41,7 +42,6 @@
 #include <dns/zt.h>
 
 #include <ns/client.h>
-#include <ns/log.h>
 #include <ns/server.h>
 #include <ns/stats.h>
 #include <ns/xfrout.h>
index 6713ecf4c53de46bdbb151004f9177acf8b3573a..6c3678bb35d926f03177d4906d11fd2cbd7a9ad8 100644 (file)
@@ -37,7 +37,6 @@
 #include <isc/util.h>
 #include <isc/uv.h>
 
-#include <dns/log.h>
 #include <dns/qp.h>
 #include <dns/types.h>
 
@@ -158,8 +157,6 @@ init_logging(void) {
        isc_logdestination_t destination;
        isc_logconfig_t *logconfig = NULL;
 
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
        destination.file.stream = stderr;
        destination.file.name = NULL;
@@ -174,7 +171,7 @@ init_logging(void) {
 #endif
 
        result = isc_log_usechannel(logconfig, "stderr",
-                                   ISC_LOGCATEGORY_DEFAULT, NULL);
+                                   ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_ALL);
        INSIST(result == ISC_R_SUCCESS);
 }
 
index 1718e86825bf82c4fd7e022c4926b9cdb25f38d0..04392c0b680b5cf74f60ad64ac43d16693c0aa37 100644 (file)
@@ -33,7 +33,6 @@
 #include <isc/urcu.h>
 #include <isc/util.h>
 
-#include <dns/log.h>
 #include <dns/qp.h>
 #include <dns/types.h>
 
@@ -72,8 +71,6 @@ setup_logging(void) {
        isc_logdestination_t destination;
        isc_logconfig_t *logconfig = NULL;
 
-       dns_log_init();
-
        logconfig = isc_logconfig_get();
        destination.file.stream = stderr;
        destination.file.name = NULL;
@@ -89,7 +86,7 @@ setup_logging(void) {
 #endif
 
        result = isc_log_usechannel(logconfig, "stderr",
-                                   ISC_LOGCATEGORY_DEFAULT, NULL);
+                                   ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_ALL);
        assert_int_equal(result, ISC_R_SUCCESS);
 }
 
index 57f45926f6a4aaef24ba81256e695ce3c682ee94..9e1604230ed948ab26e16a14e4239c1c5a23a929 100644 (file)
@@ -30,6 +30,7 @@
 #include <isc/buffer.h>
 #include <isc/file.h>
 #include <isc/hash.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/os.h>
 #include <isc/random.h>
@@ -43,7 +44,6 @@
 
 #include <dns/compress.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/rbt.h>
 
index ca4193760b06aa0d18ae06f6fc96d694f6c27f1f..37e8b79c3bb2e622f988d9db46a6c1035407dff3 100644 (file)
 
 #include <tests/isc.h>
 
-static isc_logcategory_t categories[] = { { "", 0 },
-                                         { "client", 0 },
-                                         { "network", 0 },
-                                         { "update", 0 },
-                                         { "queries", 0 },
-                                         { "unmatched", 0 },
-                                         { "update-security", 0 },
-                                         { "query-errors", 0 },
-                                         { NULL, 0 } };
-
 ISC_SETUP_TEST_IMPL(group) {
        isc_result_t result;
-       isc_logdestination_t destination;
-       isc_logconfig_t *logconfig = NULL;
-
-       isc_log_registercategories(categories);
 
-       logconfig = isc_logconfig_get();
-       destination.file.stream = stderr;
-       destination.file.name = NULL;
-       destination.file.versions = ISC_LOG_ROLLNEVER;
-       destination.file.maximum_size = 0;
+       isc_logconfig_t *logconfig = isc_logconfig_get();
+       isc_logdestination_t destination = {
+               .file.stream = stderr,
+               .file.versions = ISC_LOG_ROLLNEVER,
+       };
        isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination, 0);
-       result = isc_log_usechannel(logconfig, "stderr", NULL, NULL);
 
+       result = isc_log_usechannel(logconfig, "stderr", ISC_LOGCATEGORY_ALL,
+                                   ISC_LOGMODULE_ALL);
        if (result != ISC_R_SUCCESS) {
                return (-1);
        }
index 0e9e3bf7558a7721b42134ab8975e27ec5af9b67..1181f2fcde06db9ccde0943c37e2489c0442ae9f 100644 (file)
 
 #include <tests/isc.h>
 
-static isc_logcategory_t categories[] = { { "", 0 },
-                                         { "client", 0 },
-                                         { "network", 0 },
-                                         { "update", 0 },
-                                         { "queries", 0 },
-                                         { "unmatched", 0 },
-                                         { "update-security", 0 },
-                                         { "query-errors", 0 },
-                                         { NULL, 0 } };
-
 ISC_SETUP_TEST_IMPL(group) {
        isc_result_t result;
-       isc_logdestination_t destination;
-       isc_logconfig_t *logconfig = NULL;
-
-       isc_log_registercategories(categories);
-
-       logconfig = isc_logconfig_get();
-       destination.file.stream = stderr;
-       destination.file.name = NULL;
-       destination.file.versions = ISC_LOG_ROLLNEVER;
-       destination.file.maximum_size = 0;
+       isc_logconfig_t *logconfig = isc_logconfig_get();
+       isc_logdestination_t destination = {
+               .file.stream = stderr,
+               .file.versions = ISC_LOG_ROLLNEVER,
+       };
        isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
                              ISC_LOG_DYNAMIC, &destination, 0);
-       result = isc_log_usechannel(logconfig, "stderr", NULL, NULL);
+       result = isc_log_usechannel(logconfig, "stderr", ISC_LOGCATEGORY_ALL,
+                                   ISC_LOGMODULE_ALL);
 
        if (result != ISC_R_SUCCESS) {
                return (-1);
index e4ba0e39a67eeda78b6810ec6febb16525528337..2d75700b1d53c59d4978d6b9abddb396f4cf259c 100644 (file)
@@ -29,6 +29,7 @@
 #include <isc/hash.h>
 #include <isc/hex.h>
 #include <isc/lex.h>
+#include <isc/log.h>
 #include <isc/managers.h>
 #include <isc/mem.h>
 #include <isc/netmgr.h>
@@ -44,7 +45,6 @@
 #include <dns/db.h>
 #include <dns/dispatch.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/view.h>
 #include <dns/zone.h>
index f45c35c22054f137116aa28d2463540eaeb06b48..10038fc0592d39b657b7d7d41c1c90a029254345 100644 (file)
@@ -23,6 +23,7 @@
 #include <isc/file.h>
 #include <isc/hash.h>
 #include <isc/job.h>
+#include <isc/log.h>
 #include <isc/loop.h>
 #include <isc/managers.h>
 #include <isc/mem.h>
@@ -39,7 +40,6 @@
 #include <dns/db.h>
 #include <dns/dispatch.h>
 #include <dns/fixedname.h>
-#include <dns/log.h>
 #include <dns/name.h>
 #include <dns/view.h>
 #include <dns/zone.h>
index 170aea9543ad250dc5df81058e1b9a04236cc498..2f5909181ff1682589aaf9a11541db622b940bd1 100644 (file)
 # information regarding copyright ownership.
 
 list1=$(
-  grep LOGCATEGORY lib/*/include/*/*.h bin/named/include/named/*.h \
-    | grep "#define.*(&" \
+  grep -h LOGCATEGORY lib/*/include/*/*.h bin/named/include/named/*.h \
+    | grep -E "^[[:space:]]+[^[:space:]]+_LOGCATEGORY_[^[:space:]]+([[:space:]]+=[[:space:]]+[-0-9]+)?," \
+    | grep -Ev "ISC_LOGCATEGORY_(MAX|INVALID)" \
     | sed -e 's/.*LOGCATEGORY_\([A-Z_]*\).*/\1/' -e 's/^RRL$/rate-limit/' \
-    | tr '[A-Z]' '[a-z]' \
+    | tr 'A-Z' 'a-z' \
     | tr _ - \
     | sed 's/^tat$/trust-anchor-telemetry/' \
     | sort -u