#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
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;
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);
}
#include <dns/db.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rootns.h>
#include <dns/db.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/name.h>
#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>
#include <dst/dst.h>
-#include <isccfg/log.h>
#include <isccfg/namedconf.h>
#include <ns/client.h>
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);
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);
}
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);
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'");
}
#include <dns/byaddr.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/opcode.h>
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");
#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>
#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>
#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>
#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>
#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>
#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>
#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>
#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>
#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>
#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>
#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>
#include <isc/util.h>
#include <dns/keyvalues.h>
-#include <dns/log.h>
#include <dst/dst.h>
#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>
#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>
#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>
#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>
#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>
#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>
break;
}
- dns_log_init();
-
logconfig = isc_logconfig_get();
isc_log_settag(logconfig, program);
&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
#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>
#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>
/*
* 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.
#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);
/*%
#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
named_log_setdefaultsslkeylogfile(lcfg);
rcu_read_unlock();
+ named_g_logging = true;
+
return (ISC_R_SUCCESS);
cleanup:
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);
}
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;
}
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);
}
}
isc_result_t result;
result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
- NULL);
+ ISC_LOGMODULE_ALL);
return (result);
}
#include <isc/util.h>
#include <isccfg/cfg.h>
-#include <isccfg/log.h>
#include <named/log.h>
#include <named/logconf.h>
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);
/*
return (ISC_R_SUCCESS);
}
- module = NULL;
+ module = ISC_LOGMODULE_ALL;
destinations = cfg_tuple_get(ccat, "destinations");
for (element = cfg_list_first(destinations); element != NULL;
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 {
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,
* 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.
* 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.
* 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,
#include <isc/buffer.h>
#include <isc/file.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/stats.h>
#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>
#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>
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);
#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>
#include <ns/client.h>
#include <ns/hooks.h>
-#include <ns/log.h>
#include <ns/query.h>
#include <ns/types.h>
#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>
#include <ns/client.h>
#include <ns/hooks.h>
-#include <ns/log.h>
#include <ns/query.h>
#include <ns/types.h>
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);
#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;
#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))
#include <ns/client.h>
#include <ns/hooks.h>
-#include <ns/log.h>
#include <ns/query.h>
#include <ns/types.h>
#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;
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;
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;
}
#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>
#include <isc/util.h>
#include <dns/journal.h>
-#include <dns/log.h>
#include <dns/types.h>
const char *progname = NULL;
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
- dns_log_init();
-
logconfig = isc_logconfig_get();
destination.file.stream = errout;
destination.file.name = NULL;
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
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
#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>
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()");
/*
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 \
keymgr.c \
keystore.c \
keytable.c \
- log.c \
master.c \
masterdump.c \
message.c \
#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>
#include <inttypes.h>
#include <stdbool.h>
+#include <isc/log.h>
#include <isc/loop.h>
#include <isc/mem.h>
#include <isc/refcount.h>
#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>
/*! \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 *, ...)
#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>
#include <isc/buffer.h>
#include <isc/file.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#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>
#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>
#include <dns/acl.h>
#include <dns/dispatch.h>
-#include <dns/log.h>
#include <dns/message.h>
#include <dns/stats.h>
#include <dns/transport.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
+#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#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>
#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 */
#include <isc/util.h>
#include <dns/dnstap.h>
-#include <dns/log.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/rdataset.h>
}
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;
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;
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__)
#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"
#include <string.h>
#include <isc/buffer.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/once.h>
#include <isc/uv.h>
#include <dns/dyndb.h>
-#include <dns/log.h>
#include <dns/types.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <maxminddb.h>
#include <netinet/in.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/sockaddr.h>
#include <dns/acl.h>
#include <dns/geoip.h>
-#include <dns/log.h>
/*
* This structure preserves state from the previous GeoIP lookup,
* 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
#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>
#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>
+++ /dev/null
-/*
- * 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
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);
/*%<
*/
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.
*/
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
*/
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
#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>
***/
/*%
- * 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;
*/
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.
#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>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
-#include <dns/log.h>
#include <dst/dst.h>
#include <isc/buffer.h>
#include <isc/dir.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#include <dns/kasp.h>
#include <dns/keymgr.h>
#include <dns/keyvalues.h>
-#include <dns/log.h>
#include <dst/dst.h>
+++ /dev/null
-/*
- * 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);
-}
#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>
#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>
#include <dns/dnssec.h>
#include <dns/keyvalues.h>
-#include <dns/log.h>
#include <dns/masterdump.h>
#include <dns/message.h>
#include <dns/opcode.h>
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
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,
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);
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 = " ";
#include <dns/db.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/nta.h>
#include <dns/qp.h>
* 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>
#include <isc/tls.h>
#include <isc/util.h>
-#include <dns/log.h>
-
#include "dst_internal.h"
#include "dst_openssl.h"
#include <isc/atomic.h>
#include <isc/buffer.h>
+#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/util.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/qp.h>
#include <dns/types.h>
#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>
#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 {
#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>
#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>
#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>
#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.
#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>
#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>
#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) \
#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>
#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>
#include <stdbool.h>
#include <isc/async.h>
+#include <isc/log.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <isc/mem.h>
#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>
#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 */
}
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));
#include <stdbool.h>
#include <isc/buffer.h>
+#include <isc/log.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
#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>
#include <isc/async.h>
#include <isc/buffer.h>
+#include <isc/log.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <isc/mem.h>
#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>
#include <inttypes.h>
#include <stdbool.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netaddr.h>
#include <isc/result.h>
#include <isc/util.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/rcode.h>
#include <dns/rdataclass.h>
#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>
#include <sys/un.h>
#include <unistd.h>
+#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/util.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdatatype.h>
#include <dns/ssu.h>
#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>
#include <isc/buffer.h>
#include <isc/hex.h>
+#include <isc/log.h>
#include <isc/md.h>
#include <isc/mem.h>
#include <isc/nonce.h>
#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>
#include <isc/buffer.h>
#include <isc/hashmap.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/refcount.h>
#include <isc/result.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
-#include <dns/log.h>
#include <dns/message.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#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>
#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>
#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>
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.
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
}
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;
#include <isc/async.h>
#include <isc/atomic.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/random.h>
#include <isc/result.h>
#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,
#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>
#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>
}
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;
}
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;
#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>
#include <isc/atomic.h>
#include <isc/file.h>
+#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/tid.h>
#include <isc/util.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/qp.h>
#include <dns/rdataclass.h>
}
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;
}
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);
/***
*** Imports
***/
+#include <isc/log.h>
#include <isc/types.h>
/*
*/
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.
/*! \file isc/log.h */
+#include <inttypes.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#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.
* 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,
};
/*%
*/
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.
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
*\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,
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.
* 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);
* 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);
* next needed.
*/
-isc_logcategory_t *
+isc_logcategory_t
isc_log_categorybyname(const char *name);
/*%<
* Find a category by its 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);
/*%<
#pragma once
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/region.h>
#include <isc/result.h>
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);
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 */
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;
};
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;
/* 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;
* 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,
* 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);
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);
/*@{*/
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));
* 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,
*/
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);
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);
isc_mem_t *mctx;
isc_logchannel_t *channel;
char *filename;
- unsigned int i;
REQUIRE(lcfgp != NULL && VALID_CONFIG(*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);
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
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;
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);
}
}
}
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;
}
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().
****/
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
}
}
-/*
- * 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);
}
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;
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;
}
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
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,
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);
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);
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);
}
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;
}
include/isccfg/duration.h \
include/isccfg/grammar.h \
include/isccfg/kaspconf.h \
- include/isccfg/log.h \
include/isccfg/namedconf.h
libisccfg_la_SOURCES = \
dnsconf.c \
duration.c \
kaspconf.c \
- log.c \
namedconf.c \
parser.c
#include <stdbool.h>
#include <stdlib.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/fixedname.h>
#include <dns/iptable.h>
-#include <dns/log.h>
#include <isccfg/aclconf.h>
#include <isccfg/namedconf.h>
{
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;
+++ /dev/null
-/*
- * 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
#include <stdlib.h>
#include <isc/fips.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/region.h>
#include <isc/result.h>
#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>
+++ /dev/null
-/*
- * 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);
-}
#include <string.h>
#include <isc/lex.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#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)
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
-#include <isccfg/log.h>
/* Shorthand */
#define CAT CFG_LOGCATEGORY_CONFIG
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 \
hooks.c \
interfacemgr.c \
listenlist.c \
- log.c \
notify.c \
probes.d \
query.c \
#include <ns/client.h>
#include <ns/interfacemgr.h>
-#include <ns/log.h>
#include <ns/notify.h>
#include <ns/server.h>
#include <ns/stats.h>
}
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];
}
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)) {
#include <dns/view.h>
#include <ns/hooks.h>
-#include <ns/log.h>
#include <ns/query.h>
#define CHECK(op) \
*/
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
+++ /dev/null
-/*
- * 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().
- */
#include <stdbool.h>
#include <isc/interfaceiter.h>
+#include <isc/log.h>
#include <isc/loop.h>
#include <isc/netmgr.h>
#include <isc/os.h>
#include <ns/client.h>
#include <ns/interfacemgr.h>
-#include <ns/log.h>
#include <ns/server.h>
#include <ns/stats.h>
#include <stdbool.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <ns/listenlist.h>
-#include <ns/log.h>
static void
destroy(ns_listenlist_t *list);
+++ /dev/null
-/*
- * 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);
-}
#include <dns/zone.h>
#include <dns/zt.h>
-#include <ns/log.h>
#include <ns/notify.h>
#include <ns/types.h>
#include <isc/async.h>
#include <isc/hex.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/random.h>
#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>
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",
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;
#include <stdbool.h>
#include <isc/async.h>
+#include <isc/log.h>
#include <isc/netaddr.h>
#include <isc/serial.h>
#include <isc/stats.h>
#include <ns/client.h>
#include <ns/interfacemgr.h>
-#include <ns/log.h>
#include <ns/server.h>
#include <ns/stats.h>
#include <ns/update.h>
#include <stdbool.h>
#include <isc/formatcheck.h>
+#include <isc/log.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/result.h>
#include <dns/zt.h>
#include <ns/client.h>
-#include <ns/log.h>
#include <ns/server.h>
#include <ns/stats.h>
#include <ns/xfrout.h>
#include <isc/util.h>
#include <isc/uv.h>
-#include <dns/log.h>
#include <dns/qp.h>
#include <dns/types.h>
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
- dns_log_init();
-
logconfig = isc_logconfig_get();
destination.file.stream = stderr;
destination.file.name = NULL;
#endif
result = isc_log_usechannel(logconfig, "stderr",
- ISC_LOGCATEGORY_DEFAULT, NULL);
+ ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_ALL);
INSIST(result == ISC_R_SUCCESS);
}
#include <isc/urcu.h>
#include <isc/util.h>
-#include <dns/log.h>
#include <dns/qp.h>
#include <dns/types.h>
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
- dns_log_init();
-
logconfig = isc_logconfig_get();
destination.file.stream = stderr;
destination.file.name = NULL;
#endif
result = isc_log_usechannel(logconfig, "stderr",
- ISC_LOGCATEGORY_DEFAULT, NULL);
+ ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_ALL);
assert_int_equal(result, ISC_R_SUCCESS);
}
#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>
#include <dns/compress.h>
#include <dns/fixedname.h>
-#include <dns/log.h>
#include <dns/name.h>
#include <dns/rbt.h>
#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);
}
#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);
#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>
#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>
#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>
#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>
# 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