summaryrefslogtreecommitdiff
path: root/src/libknot
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-04-13 17:14:49 +0200
committerOndřej Surý <ondrej@sury.org>2012-04-13 17:14:49 +0200
commitc5e123fb66dfd412a0d89293f893871f9a2e7d12 (patch)
treee4351340a850ae861ce99a4e7824f2f1bd0660a6 /src/libknot
parentb5c64fe14e2b779a715756d47d7d4c7e8e5729ea (diff)
downloadknot-c5e123fb66dfd412a0d89293f893871f9a2e7d12.tar.gz
Imported Upstream version 1.0.2upstream/1.0.2
Diffstat (limited to 'src/libknot')
-rw-r--r--src/libknot/dname.c55
-rw-r--r--src/libknot/dname.h3
-rw-r--r--src/libknot/hash/cuckoo-hash-table.c18
-rw-r--r--src/libknot/nameserver/name-server.c2
-rw-r--r--src/libknot/nameserver/name-server.h1
-rw-r--r--src/libknot/updates/xfr-in.c108
-rw-r--r--src/libknot/util/debug.h183
7 files changed, 246 insertions, 124 deletions
diff --git a/src/libknot/dname.c b/src/libknot/dname.c
index 0ab3d11..7a6ea5a 100644
--- a/src/libknot/dname.c
+++ b/src/libknot/dname.c
@@ -163,8 +163,7 @@ static int knot_dname_str_to_wire(const char *name, uint size,
return -1;
}
- dbg_dname("Allocated space for wire format of dname: %p\n",
- wire);
+ dbg_dname("Allocated space for wire format of dname: %p\n", wire);
if (root) {
*wire = '\0';
@@ -399,13 +398,22 @@ knot_dname_t *knot_dname_new_from_str(const char *name, uint size,
return NULL;
}
- knot_dname_str_to_wire(name, size, dname);
- dbg_dname("Created dname with size: %d\n", dname->size);
- dbg_dname("Label offsets: ");
+ /*! \todo The function should return error codes. */
+ int ret = knot_dname_str_to_wire(name, size, dname);
+ if (ret != 0) {
+ dbg_dname("Failed to create domain name from string.\n");
+ knot_dname_free(&dname);
+ return NULL;
+ }
+
+dbg_dname_exec_verb(
+ dbg_dname_verb("Created dname with size: %d\n", dname->size);
+ dbg_dname_verb("Label offsets: ");
for (int i = 0; i < dname->label_count; ++i) {
- dbg_dname("%d, ", dname->labels[i]);
+ dbg_dname_verb("%d, ", dname->labels[i]);
}
- dbg_dname("\n");
+ dbg_dname_verb("\n");
+);
if (dname->size <= 0) {
dbg_dname("Could not parse domain name "
@@ -467,6 +475,7 @@ knot_dname_t *knot_dname_new_from_wire(const uint8_t *name, uint size,
dname->size = size;
if (knot_dname_find_labels(dname, 1) != 0) {
+ dbg_dname("Could not find labels in dname (new from wire).\n");
knot_dname_free(&dname);
return NULL;
}
@@ -567,6 +576,7 @@ knot_dname_t *knot_dname_parse_from_wire(const uint8_t *wire,
memcpy(dname->name, name, i + 1);
dname->size = i + 1;
+ /*! \todo Why l + 1 ?? */
dname->labels = (uint8_t *)malloc((l + 1) * sizeof(uint8_t));
if (dname->labels == NULL) {
ERR_ALLOC_FAILED;
@@ -603,8 +613,35 @@ int knot_dname_from_wire(const uint8_t *name, uint size,
knot_dname_t *knot_dname_deep_copy(const knot_dname_t *dname)
{
- return knot_dname_new_from_wire(dname->name, dname->size,
- dname->node);
+ //return knot_dname_new_from_wire(dname->name, dname->size, dname->node);
+ /* dname_new_from_wire() does not accept non-FQDN dnames, so we
+ * do the copy by hand. It's faster anyway */
+
+ knot_dname_t *copy = knot_dname_new();
+ CHECK_ALLOC(copy, NULL);
+
+ copy->labels = (uint8_t *)(malloc(dname->label_count));
+
+ if (copy->labels == NULL) {
+ knot_dname_free(&copy);
+ return NULL;
+ }
+
+ copy->name = (uint8_t *)(malloc(dname->size));
+ if (copy->name == NULL) {
+ knot_dname_free(&copy);
+ return NULL;
+ }
+
+ memcpy(copy->labels, dname->labels, dname->label_count);
+ copy->label_count = dname->label_count;
+
+ memcpy(copy->name, dname->name, dname->size);
+ copy->size = dname->size;
+
+ copy->node = dname->node;
+
+ return copy;
}
/*----------------------------------------------------------------------------*/
diff --git a/src/libknot/dname.h b/src/libknot/dname.h
index 5a182ae..473bca7 100644
--- a/src/libknot/dname.h
+++ b/src/libknot/dname.h
@@ -116,6 +116,9 @@ knot_dname_t *knot_dname_new_from_str(const char *name, unsigned int size,
* e.g. to knot_dname_to_str() may result in crash. Decide whether it
* is OK to retain this and check the data in other functions before
* calling this one, or if it should verify the given data.
+ *
+ * \warning Actually, right now this function does not accept non-FQDN dnames.
+ * For some reason there is a check for this.
*/
knot_dname_t *knot_dname_new_from_wire(const uint8_t *name,
unsigned int size,
diff --git a/src/libknot/hash/cuckoo-hash-table.c b/src/libknot/hash/cuckoo-hash-table.c
index 831aef8..50a7a0f 100644
--- a/src/libknot/hash/cuckoo-hash-table.c
+++ b/src/libknot/hash/cuckoo-hash-table.c
@@ -821,17 +821,19 @@ void ck_destroy_table(ck_hash_table_t **table, void (*dtor_value)(void *value),
while (item != NULL) {
// disconnect the item
(*table)->stash = item->next;
- /*! \todo Investigate this. */
- assert(item->item != NULL);
- if (dtor_value) {
- dtor_value(item->item->value);
- }
- if (delete_key) {
- free((void *)item->item->key);
+ /*! \todo Check item semantics. (#1688) */
+ if (item->item != NULL) {
+ if (dtor_value) {
+ dtor_value(item->item->value);
+ }
+ if (delete_key) {
+ free((void *)item->item->key);
+ }
+
+ free((void *)item->item);
}
- free((void *)item->item);
free(item);
item = (*table)->stash;
}
diff --git a/src/libknot/nameserver/name-server.c b/src/libknot/nameserver/name-server.c
index dea16ec..e1ccdd4 100644
--- a/src/libknot/nameserver/name-server.c
+++ b/src/libknot/nameserver/name-server.c
@@ -646,6 +646,8 @@ static int ns_put_authority_soa(const knot_zone_contents_t *zone,
knot_rrset_set_ttl(soa_copy, min);
soa_rrset = soa_copy;
+ /* Need to add it as temporary, so it get's freed. */
+ knot_packet_add_tmp_rrset(resp, soa_copy);
}
assert(soa_rrset != NULL);
diff --git a/src/libknot/nameserver/name-server.h b/src/libknot/nameserver/name-server.h
index 1ae309c..42fa0f2 100644
--- a/src/libknot/nameserver/name-server.h
+++ b/src/libknot/nameserver/name-server.h
@@ -87,6 +87,7 @@ typedef struct knot_ns_xfr {
knot_rcode_t rcode;
xfr_callback_t send;
int session;
+ int session_closed;
/*!
* XFR-out: Output buffer.
diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c
index 75d7fd7..4874ccd 100644
--- a/src/libknot/updates/xfr-in.c
+++ b/src/libknot/updates/xfr-in.c
@@ -1374,13 +1374,20 @@ static int xfrin_changes_check_rdata(knot_rdata_t ***rdatas, uint **types,
static void xfrin_changes_add_rdata(knot_rdata_t **rdatas, uint *types,
int *count, knot_rdata_t *rdata, uint type)
{
- dbg_xfrin_detail("Adding RDATA to new RDATA list: %p\n", rdata);
+ dbg_xfrin_detail("Adding RDATA to RDATA list: %p\n", rdata);
+
+ if (rdata == NULL) {
+ return;
+ }
dbg_xfrin_exec_detail(
// try to find the first RDATA in the given list
for (int i = 0; i < *count; ++i) {
knot_rdata_t *r = rdatas[i];
- while (r->next != rdatas[i]) {
+ if (r == NULL) {
+ continue;
+ }
+ while (r != NULL && r->next != rdatas[i]) {
if (r == rdata) {
dbg_xfrin_detail("Found same RDATA: %p\n", rdata);
knot_rdata_dump(rdata, type, 0);
@@ -1454,6 +1461,7 @@ static knot_rdata_t *xfrin_remove_rdata(knot_rrset_t *from,
static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
knot_changes_t *changes)
{
+ dbg_xfrin("Copying old RRSet: %p\n", old);
// create new RRSet by copying the old one
// int ret = knot_rrset_shallow_copy(old, copy);
int ret = knot_rrset_deep_copy(old, copy);
@@ -1486,6 +1494,7 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
changes->new_rrsets[changes->new_rrsets_count++] = *copy;
+ dbg_xfrin_verb("Adding RDATA from the RRSet copy to new RDATA list.\n");
xfrin_changes_add_rdata(changes->new_rdata, changes->new_rdata_types,
&changes->new_rdata_count,
knot_rrset_get_rdata(*copy),
@@ -1495,6 +1504,8 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
assert(old->rrsigs != NULL);
changes->new_rrsets[changes->new_rrsets_count++] =
(*copy)->rrsigs;
+ dbg_xfrin_verb("Adding RDATA from RRSIG of the RRSet copy to "
+ "new RDATA list.\n");
xfrin_changes_add_rdata(changes->new_rdata,
changes->new_rdata_types,
&changes->new_rdata_count,
@@ -1523,6 +1534,7 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
changes->old_rrsets[changes->old_rrsets_count++] = old;
+ dbg_xfrin_verb("Adding RDATA from old RRSet to old RDATA list.\n");
xfrin_changes_add_rdata(changes->old_rdata, changes->old_rdata_types,
&changes->old_rdata_count, old->rdata,
knot_rrset_type(old));
@@ -1531,6 +1543,8 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
assert(old->rrsigs != NULL);
changes->old_rrsets[changes->old_rrsets_count++] = old->rrsigs;
+ dbg_xfrin_verb("Adding RDATA from RRSIG of the old RRSet to "
+ "old RDATA list.\n");
xfrin_changes_add_rdata(changes->old_rdata,
changes->old_rdata_types,
&changes->old_rdata_count,
@@ -1546,8 +1560,18 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
static int xfrin_copy_rrset(knot_node_t *node, knot_rr_type_t type,
knot_rrset_t **rrset, knot_changes_t *changes)
{
+dbg_xfrin_exec_verb(
+ char *name = knot_dname_to_str(knot_node_owner(node));
+ dbg_xfrin_verb("Removing RRSet of type %s from node %s (%p)\n",
+ knot_rrtype_to_string(type), name, node);
+ free(name);
+);
knot_rrset_t *old = knot_node_remove_rrset(node, type);
+ dbg_xfrin_verb("Removed RRSet: %p\n", old);
+ dbg_xfrin_detail("Other RRSet of the same type in the node: %p\n",
+ knot_node_rrset(node, type));
+
if (old == NULL) {
dbg_xfrin("RRSet not found for RR to be removed.\n");
return 1;
@@ -1558,7 +1582,7 @@ static int xfrin_copy_rrset(knot_node_t *node, knot_rr_type_t type,
return ret;
}
- dbg_xfrin_detail("Copied old rrset %p to new %p.\n", old, *rrset);
+ dbg_xfrin_verb("Copied old rrset %p to new %p.\n", old, *rrset);
// replace the RRSet in the node copy by the new one
ret = knot_node_add_rrset(node, *rrset, 0);
@@ -1601,6 +1625,7 @@ static int xfrin_apply_remove_rrsigs(knot_changes_t *changes,
knot_rrset_rdata(remove));
// copy the rrset
+ dbg_xfrin_verb("Copying RRSet that carries the RRSIGs.\n");
ret = xfrin_copy_rrset(node, type, rrset, changes);
if (ret != KNOT_EOK) {
dbg_xfrin("Failed to copy rrset from changeset.\n");
@@ -1615,10 +1640,12 @@ static int xfrin_apply_remove_rrsigs(knot_changes_t *changes,
// this RRSet should be the already copied RRSet so we may
// update it right away
/*! \todo Does this case even occur? */
+ dbg_xfrin_verb("Using RRSet from previous iteration.\n");
}
// get the old rrsigs
knot_rrset_t *old = knot_rrset_get_rrsigs(*rrset);
+ dbg_xfrin_verb("Old RRSIGs from RRSet: %p\n", old);
if (old == NULL) {
return 1;
}
@@ -1630,8 +1657,10 @@ static int xfrin_apply_remove_rrsigs(knot_changes_t *changes,
if (ret != KNOT_EOK) {
return ret;
}
+ dbg_xfrin_verb("Copied RRSIGs: %p\n", rrsigs);
} else {
rrsigs = old;
+ dbg_xfrin_verb("Using old RRSIGs: %p\n", rrsigs);
}
// set the RRSIGs to the new RRSet copy
@@ -1935,14 +1964,22 @@ static int xfrin_apply_add_normal(knot_changes_t *changes,
dbg_xfrin("applying rrset:\n");
knot_rrset_dump(add, 0);
- if (!*rrset
- || knot_dname_compare(knot_rrset_owner(*rrset),
- knot_node_owner(node)) != 0
- || knot_rrset_type(*rrset)
- != knot_rrset_type(add)) {
- dbg_xfrin("Removing rrset!\n");
- *rrset = knot_node_remove_rrset(node, knot_rrset_type(add));
- }
+ /*! \note Reusing RRSet from previous function caused it not to be
+ * removed from the node.
+ * Maybe modification of the code would allow reusing the RRSet
+ * as in apply_add_rrsigs() - the RRSet should not be copied
+ * in such case.
+ */
+// if (!*rrset
+// || knot_dname_compare(knot_rrset_owner(*rrset),
+// knot_node_owner(node)) != 0
+// || knot_rrset_type(*rrset)
+// != knot_rrset_type(add)) {
+// dbg_xfrin("Removing rrset!\n");
+// *rrset = knot_node_remove_rrset(node, knot_rrset_type(add));
+// }
+
+ *rrset = knot_node_remove_rrset(node, knot_rrset_type(add));
dbg_xfrin("Removed RRSet: \n");
knot_rrset_dump(*rrset, 1);
@@ -1992,6 +2029,8 @@ dbg_xfrin_exec(
return ret;
}
+ dbg_xfrin("Copied RRSet: %p\n", *rrset);
+
// dbg_xfrin("After copy: Found RRSet with owner %s, type %s\n",
// knot_dname_to_str((*rrset)->owner),
// knot_rrtype_to_string(knot_rrset_type(*rrset)));
@@ -2007,11 +2046,13 @@ dbg_xfrin_exec(
*
* TODO: add the 'add' rrset to list of old RRSets?
*/
- dbg_xfrin("Merging RRSets with owners: %s %s types: %d %d\n",
- (*rrset)->owner->name, add->owner->name, (*rrset)->type,
- add->type);
+ dbg_xfrin("Merging RRSets with owners: %s, %s types: %s, %s\n",
+ (*rrset)->owner->name, add->owner->name,
+ knot_rrtype_to_string((*rrset)->type),
+ knot_rrtype_to_string(add->type));
dbg_xfrin_detail("RDATA in RRSet1: %p, RDATA in RRSet2: %p\n",
(*rrset)->rdata, add->rdata);
+
ret = knot_rrset_merge((void **)rrset, (void **)&add);
if (ret != KNOT_EOK) {
dbg_xfrin("Failed to merge changeset RRSet to copy.\n");
@@ -2021,6 +2062,11 @@ dbg_xfrin_exec(
knot_rrset_dump(*rrset, 1);
ret = knot_node_add_rrset(node, *rrset, 0);
+ if (ret < 0) {
+ dbg_xfrin("Failed to add merged RRSet to the node.\n");
+ return ret;
+ }
+
// return 2 so that the add RRSet is removed from
// the changeset (and thus not deleted)
// and put to list of new RRSets (is this ok?)
@@ -2058,6 +2104,9 @@ dbg_xfrin_exec(
int copied = 0;
+ /*! \note Here the check is OK, because if we aready have the RRSet,
+ * it's a copied one, so it is OK to modify it right away.
+ */
if (!*rrset
|| knot_dname_compare(knot_rrset_owner(*rrset),
knot_node_owner(node)) != 0
@@ -2081,7 +2130,6 @@ dbg_xfrin_exec(
if (*rrset == NULL) {
dbg_xfrin("RRSet to be added not found in zone.\n");
- dbg_xfrin("Creating new RRSet for RRSIG.\n");
// create a new RRSet to add the RRSIGs into
*rrset = knot_rrset_new(knot_node_get_owner(node), type,
knot_rrset_class(add),
@@ -2090,6 +2138,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to create new RRSet for RRSIGs.\n");
return KNOT_ENOMEM;
}
+ dbg_xfrin("Created new RRSet for RRSIG: %p.\n", *rrset);
// add the RRset to the list of new RRsets
ret = xfrin_changes_check_rrsets(
@@ -2448,6 +2497,17 @@ static int xfrin_apply_remove2(knot_zone_contents_t *contents,
int is_nsec3 = 0;
for (int i = 0; i < chset->remove_count; ++i) {
+dbg_xfrin_exec_verb(
+ char *name = knot_dname_to_str(
+ knot_rrset_owner(chset->remove[i]));
+ dbg_xfrin_verb("Removing RRSet: %s, type %s\n", name,
+ knot_rrtype_to_string(
+ knot_rrset_type(chset->remove[i])));
+ free(name);
+);
+dbg_xfrin_exec_detail(
+ knot_rrset_dump(chset->remove[i], 0);
+);
is_nsec3 = 0;
@@ -2524,8 +2584,17 @@ static int xfrin_apply_add2(knot_zone_contents_t *contents,
int is_nsec3 = 0;
for (int i = 0; i < chset->add_count; ++i) {
- dbg_xfrin_detail("Adding RRSet:\n");
+dbg_xfrin_exec_verb(
+ char *name = knot_dname_to_str(
+ knot_rrset_owner(chset->add[i]));
+ dbg_xfrin_verb("Adding RRSet: %s, type: %s\n", name,
+ knot_rrtype_to_string(
+ knot_rrset_type(chset->add[i])));
+ free(name);
+);
+dbg_xfrin_exec_detail(
knot_rrset_dump(chset->add[i], 0);
+);
is_nsec3 = 0;
@@ -2647,6 +2716,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents,
knot_changes_t *changes,
knot_changeset_t *chset)
{
+ dbg_xfrin("Replacing SOA record.\n");
knot_node_t *node = knot_zone_contents_get_apex(contents);
assert(node != NULL);
@@ -2658,6 +2728,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents,
contents->apex = node;
// remove the SOA RRSet from the apex
+ dbg_xfrin_verb("Removing SOA.\n");
knot_rrset_t *rrset = knot_node_remove_rrset(node, KNOT_RRTYPE_SOA);
assert(rrset != NULL);
@@ -2704,6 +2775,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents,
changes->old_rrsets[changes->old_rrsets_count++] = rrset;
/*! \todo Maybe check if the SOA does not have more RDATA? */
+ dbg_xfrin_verb("Adding RDATA from old SOA to the list of old RDATA.\n");
xfrin_changes_add_rdata(changes->old_rdata, changes->old_rdata_types,
&changes->old_rdata_count, rrset->rdata,
KNOT_RRTYPE_SOA);
@@ -2725,6 +2797,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents,
changes->new_rrsets[changes->new_rrsets_count++] = chset->soa_to;
+ dbg_xfrin_verb("Adding RDATA from new SOA to the list of new RDATA.\n");
xfrin_changes_add_rdata(changes->new_rdata,
changes->new_rdata_types,
&changes->new_rdata_count,
@@ -2750,6 +2823,9 @@ static int xfrin_apply_changeset2(knot_zone_contents_t *contents,
* SOA in the zone apex.
*/
+ dbg_xfrin("APPLYING CHANGESET: from serial %u to serial %u\n",
+ chset->serial_from, chset->serial_to);
+
// check if serial matches
/*! \todo Only if SOA is present? */
const knot_rrset_t *soa = knot_node_rrset(contents->apex,
diff --git a/src/libknot/util/debug.h b/src/libknot/util/debug.h
index e02f988..b6aba6e 100644
--- a/src/libknot/util/debug.h
+++ b/src/libknot/util/debug.h
@@ -33,6 +33,7 @@
#include <stdio.h>
#include "config.h" /* autoconf generated */
+#include "common/log.h"
/*
* Debug macros
@@ -132,8 +133,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_ns(msg...) fprintf(stderr, msg)
-#define dbg_ns_hex(data, len) hex_print((data), (len))
+#define dbg_ns(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ns_hex(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_ns_exec(cmds) do { cmds } while (0)
#else
#define dbg_ns(msg...)
@@ -143,8 +144,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_ns_verb(msg...) fprintf(stderr, msg)
-#define dbg_ns_hex_verb(data, len) hex_print((data), (len))
+#define dbg_ns_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ns_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_ns_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_ns_verb(msg...)
@@ -154,8 +155,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_ns_detail(msg...) fprintf(stderr, msg)
-#define dbg_ns_hex_detail(data, len) hex_print((data), (len))
+#define dbg_ns_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ns_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_ns_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_ns_detail(msg...)
@@ -182,8 +183,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_dname(msg...) fprintf(stderr, msg)
-#define dbg_dname_hex(data, len) hex_print((data), (len))
+#define dbg_dname(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_dname_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_dname_exec(cmds) do { cmds } while (0)
#else
#define dbg_dname(msg...)
@@ -193,8 +194,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_dname_verb(msg...) fprintf(stderr, msg)
-#define dbg_dname_hex_verb(data, len) hex_print((data), (len))
+#define dbg_dname_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_dname_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_dname_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_dname_verb(msg...)
@@ -204,8 +205,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_dname_detail(msg...) fprintf(stderr, msg)
-#define dbg_dname_hex_detail(data, len) hex_print((data), (len))
+#define dbg_dname_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_dname_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_dname_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_dname_detail(msg...)
@@ -232,8 +233,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_node(msg...) fprintf(stderr, msg)
-#define dbg_node_hex(data, len) hex_print((data), (len))
+#define dbg_node(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_node_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_node(msg...)
#define dbg_node_hex(data, len)
@@ -241,8 +242,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_node_verb(msg...) fprintf(stderr, msg)
-#define dbg_node_hex_verb(data, len) hex_print((data), (len))
+#define dbg_node_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_node_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_node_verb(msg...)
#define dbg_node_hex_verb(data, len)
@@ -250,8 +251,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_node_detail(msg...) fprintf(stderr, msg)
-#define dbg_node_hex_detail(data, len) hex_print((data), (len))
+#define dbg_node_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_node_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_node_detail(msg...)
#define dbg_node_hex_detail(data, len)
@@ -273,8 +274,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_zone(msg...) fprintf(stderr, msg)
-#define dbg_zone_hex(data, len) hex_print((data), (len))
+#define dbg_zone(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_zone_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_zone_exec(cmds) do { cmds } while (0)
#else
#define dbg_zone(msg...)
@@ -284,8 +285,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_zone_verb(msg...) fprintf(stderr, msg)
-#define dbg_zone_hex_verb(data, len) hex_print((data), (len))
+#define dbg_zone_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_zone_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_zone_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_zone_verb(msg...)
@@ -295,8 +296,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_zone_detail(msg...) fprintf(stderr, msg)
-#define dbg_zone_hex_detail(data, len) hex_print((data), (len))
+#define dbg_zone_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_zone_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_zone_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_zone_detail(msg...)
@@ -323,8 +324,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_zonedb(msg...) fprintf(stderr, msg)
-#define dbg_zonedb_hex(data, len) hex_print((data), (len))
+#define dbg_zonedb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_zonedb_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_zonedb_exec(cmds) do { cmds } while (0)
#else
#define dbg_zonedb(msg...)
@@ -334,8 +335,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_zonedb_verb(msg...) fprintf(stderr, msg)
-#define dbg_zonedb_hex_verb(data, len) hex_print((data), (len))
+#define dbg_zonedb_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_zonedb_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_zonedb_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_zonedb_verb(msg...)
@@ -345,8 +346,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_zonedb_detail(msg...) fprintf(stderr, msg)
-#define dbg_zonedb_hex_detail(data, len) hex_print((data), (len))
+#define dbg_zonedb_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_zonedb_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_zonedb_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_zonedb_detail(msg...)
@@ -373,8 +374,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_response(msg...) fprintf(stderr, msg)
-#define dbg_response_hex(data, len) hex_print((data), (len))
+#define dbg_response(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg)
+#define dbg_response_hex(data, len) hex_log(LOG_ANSWER, (data), (len))
#define dbg_response_exec(cmds) do { cmds } while (0)
#else
#define dbg_response(msg...)
@@ -384,8 +385,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_response_verb(msg...) fprintf(stderr, msg)
-#define dbg_response_hex_verb(data, len) hex_print((data), (len))
+#define dbg_response_verb(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg)
+#define dbg_response_hex_verb(data, len) hex_log(LOG_ANSWER, (data), (len))
#define dbg_response_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_response_verb(msg...)
@@ -395,8 +396,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_response_detail(msg...) fprintf(stderr, msg)
-#define dbg_response_hex_detail(data, len) hex_print((data), (len))
+#define dbg_response_detail(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg)
+#define dbg_response_hex_detail(data, len) hex_log(LOG_ANSWER, (data), (len))
#define dbg_response_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_response_detail(msg...)
@@ -423,8 +424,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_packet(msg...) fprintf(stderr, msg)
-#define dbg_packet_hex(data, len) hex_print((data), (len))
+#define dbg_packet(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg)
+#define dbg_packet_hex(data, len) hex_log(LOG_ANSWER, (data), (len))
#define dbg_packet_exec(cmds) do { cmds } while (0)
#else
#define dbg_packet(msg...)
@@ -434,8 +435,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_packet_verb(msg...) fprintf(stderr, msg)
-#define dbg_packet_hex_verb(data, len) hex_print((data), (len))
+#define dbg_packet_verb(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg)
+#define dbg_packet_hex_verb(data, len) hex_log(LOG_ANSWER, (data), (len))
#define dbg_packet_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_packet_verb(msg...)
@@ -445,8 +446,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_packet_detail(msg...) fprintf(stderr, msg)
-#define dbg_packet_hex_detail(data, len) hex_print((data), (len))
+#define dbg_packet_detail(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg)
+#define dbg_packet_hex_detail(data, len) hex_log(LOG_ANSWER, (data), (len))
#define dbg_packet_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_packet_detail(msg...)
@@ -473,8 +474,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_edns(msg...) fprintf(stderr, msg)
-#define dbg_edns_hex(data, len) hex_print((data), (len))
+#define dbg_edns(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_edns_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_edns(msg...)
#define dbg_edns_hex(data, len)
@@ -482,8 +483,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_edns_verb(msg...) fprintf(stderr, msg)
-#define dbg_edns_hex_verb(data, len) hex_print((data), (len))
+#define dbg_edns_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_edns_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_edns_verb(msg...)
#define dbg_edns_hex_verb(data, len)
@@ -491,8 +492,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_edns_detail(msg...) fprintf(stderr, msg)
-#define dbg_edns_hex_detail(data, len) hex_print((data), (len))
+#define dbg_edns_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_edns_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_edns_detail(msg...)
#define dbg_edns_hex_detail(data, len)
@@ -514,8 +515,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_nsec3(msg...) fprintf(stderr, msg)
-#define dbg_nsec3_hex(data, len) hex_print((data), (len))
+#define dbg_nsec3(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_nsec3_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_nsec3(msg...)
#define dbg_nsec3_hex(data, len)
@@ -523,8 +524,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_nsec3_verb(msg...) fprintf(stderr, msg)
-#define dbg_nsec3_hex_verb(data, len) hex_print((data), (len))
+#define dbg_nsec3_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_nsec3_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_nsec3_verb(msg...)
#define dbg_nsec3_hex_verb(data, len)
@@ -532,8 +533,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_nsec3_detail(msg...) fprintf(stderr, msg)
-#define dbg_nsec3_hex_detail(data, len) hex_print((data), (len))
+#define dbg_nsec3_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_nsec3_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_nsec3_detail(msg...)
#define dbg_nsec3_hex_detail(data, len)
@@ -555,8 +556,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_ck(msg...) fprintf(stderr, msg)
-#define dbg_ck_hex(data, len) hex_print((data), (len))
+#define dbg_ck(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_hex(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_ck_exec(cmds) do { cmds } while (0)
#else
#define dbg_ck(msg...)
@@ -566,8 +567,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_ck_verb(msg...) fprintf(stderr, msg)
-#define dbg_ck_hex_verb(data, len) hex_print((data), (len))
+#define dbg_ck_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_ck_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_ck_verb(msg...)
@@ -577,8 +578,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_ck_detail(msg...) fprintf(stderr, msg)
-#define dbg_ck_hex_detail(data, len) hex_print((data), (len))
+#define dbg_ck_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_ck_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_ck_detail(msg...)
@@ -605,9 +606,9 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_ck_hash(msg...) fprintf(stderr, msg)
-#define dbg_ck_rehash(msg...) fprintf(stderr, msg)
-#define dbg_ck_hash_hex(data, len) hex_print((data), (len))
+#define dbg_ck_hash(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_rehash(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_hash_hex(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_ck_hash(msg...)
#define dbg_ck_rehash(msg...)
@@ -616,8 +617,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_ck_hash_verb(msg...) fprintf(stderr, msg)
-#define dbg_ck_hash_hex_verb(data, len) hex_print((data), (len))
+#define dbg_ck_hash_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_hash_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_ck_hash_verb(msg...)
#define dbg_ck_hash_hex_verb(data, len)
@@ -625,8 +626,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_ck_hash_detail(msg...) fprintf(stderr, msg)
-#define dbg_ck_hash_hex_detail(data, len) hex_print((data), (len))
+#define dbg_ck_hash_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
+#define dbg_ck_hash_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_ck_hash_detail(msg...)
#define dbg_ck_hash_hex_detail(data, len)
@@ -649,8 +650,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_xfrin(msg...) fprintf(stderr, msg)
-#define dbg_xfrin_hex(data, len) hex_print((data), (len))
+#define dbg_xfrin(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_xfrin_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_xfrin_exec(cmds) do { cmds } while (0)
#else
#define dbg_xfrin(msg...)
@@ -660,8 +661,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_xfrin_verb(msg...) fprintf(stderr, msg)
-#define dbg_xfrin_hex_verb(data, len) hex_print((data), (len))
+#define dbg_xfrin_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_xfrin_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_xfrin_exec_verb(cmds) do { cmds } while (0)
#else
#define dbg_xfrin_verb(msg...)
@@ -671,8 +672,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_xfrin_detail(msg...) fprintf(stderr, msg)
-#define dbg_xfrin_hex_detail(data, len) hex_print((data), (len))
+#define dbg_xfrin_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_xfrin_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#define dbg_xfrin_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_xfrin_detail(msg...)
@@ -699,8 +700,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_ddns(msg...) fprintf(stderr, msg)
-#define dbg_ddns_hex(data, len) hex_print((data), (len))
+#define dbg_ddns(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_ddns_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_ddns(msg...)
#define dbg_ddns_hex(data, len)
@@ -708,8 +709,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_ddns_verb(msg...) fprintf(stderr, msg)
-#define dbg_ddns_hex_verb(data, len) hex_print((data), (len))
+#define dbg_ddns_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_ddns_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_ddns_verb(msg...)
#define dbg_ddns_hex_verb(data, len)
@@ -717,8 +718,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_ddns_detail(msg...) fprintf(stderr, msg)
-#define dbg_ddns_hex_detail(data, len) hex_print((data), (len))
+#define dbg_ddns_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_ddns_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_ddns_detail(msg...)
#define dbg_ddns_hex_detail(data, len)
@@ -738,8 +739,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_tsig(msg...) fprintf(stderr, msg)
-#define dbg_tsig_hex(data, len) hex_print((const char*)(data), (len))
+#define dbg_tsig(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_tsig_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_tsig(msg...)
#define dbg_tsig_hex(data, len)
@@ -747,8 +748,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_tsig_verb(msg...) fprintf(stderr, msg)
-#define dbg_tsig_hex_verb(data, len) hex_print((const char*)(data), (len))
+#define dbg_tsig_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_tsig_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_tsig_verb(msg...)
#define dbg_tsig_hex_verb(data, len)
@@ -756,8 +757,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_tsig_detail(msg...) fprintf(stderr, msg)
-#define dbg_tsig_hex_detail(data, len) hex_print((const char*)(data), (len))
+#define dbg_tsig_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_tsig_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_tsig_detail(msg...)
#define dbg_tsig_hex_detail(data, len)
@@ -777,8 +778,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
-#define dbg_rrset(msg...) fprintf(stderr, msg)
-#define dbg_rrset_hex(data, len) hex_print((data), (len))
+#define dbg_rrset(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_rrset_hex(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_rrset(msg...)
#define dbg_rrset_hex(data, len)
@@ -786,8 +787,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
-#define dbg_rrset_verb(msg...) fprintf(stderr, msg)
-#define dbg_rrset_hex_verb(data, len) hex_print((data), (len))
+#define dbg_rrset_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_rrset_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_rrset_verb(msg...)
#define dbg_rrset_hex_verb(data, len)
@@ -795,8 +796,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
-#define dbg_rrset_detail(msg...) fprintf(stderr, msg)
-#define dbg_rrset_hex_detail(data, len) hex_print((data), (len))
+#define dbg_rrset_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg)
+#define dbg_rrset_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len))
#else
#define dbg_rrset_detail(msg...)
#define dbg_rrset_hex_detail(data, len)