Commit 5e76f6e8 authored by Daniel Salzman's avatar Daniel Salzman

knot: remove deprecated debug macros

parent 603494a1
......@@ -180,7 +180,6 @@ src/dnstap/reader.c
src/dnstap/reader.h
src/dnstap/writer.c
src/dnstap/writer.h
src/knot/common/debug.h
src/knot/common/evsched.c
src/knot/common/evsched.h
src/knot/common/fdset.c
......
......@@ -117,41 +117,6 @@ PKG_CHECK_MODULES([gnutls], [gnutls >= 3.0 nettle], [
# JSON for DNSSEC status storage
PKG_CHECK_MODULES([jansson], [jansson >= 2.3])
# Debug modules
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug=server,zones,ns,loader,dnssec],
[compile selected debug modules [default=none]]),
[
echo ${enableval}|tr "," "\n"|while read val; do
case "${val}" in
server) AC_DEFINE([KNOTD_SERVER_DEBUG], [1], [Server debug.]) ;;
zones) AC_DEFINE([KNOT_ZONES_DEBUG], [1], [Zones debug.]) ;;
ns) AC_DEFINE([KNOT_NS_DEBUG], [1], [Nameserver debug.]) ;;
loader) AC_DEFINE([KNOT_LOADER_DEBUG], [1], [Zone loading debug.]) ;;
dnssec) AC_DEFINE([KNOT_DNSSEC_DEBUG], [1], [DNSSEC debug.]) ;;
esac
done
], [])
# Debug level
AC_ARG_ENABLE([debuglevel],
AS_HELP_STRING([--enable-debuglevel=brief|verbose|details], [enable given debug level [default=disabled]]),
# Not all shells support fall-through with ;& so I have to duplicate
[case "x${enableval}" in
xdetails)
AC_DEFINE([DEBUG_ENABLE_DETAILS], [1], [Enable details debugging messages.])
AC_DEFINE([DEBUG_ENABLE_VERBOSE], [1], [Enable verbose debugging messages.])
AC_DEFINE([DEBUG_ENABLE_BRIEF], [1], [Enable brief debugging messages.])
;;
xverbose)
AC_DEFINE([DEBUG_ENABLE_VERBOSE], [1], [Enable verbose debugging messages.])
AC_DEFINE([DEBUG_ENABLE_BRIEF], [1], [Enable brief debugging messages.])
;;
xbrief)
AC_DEFINE([DEBUG_ENABLE_BRIEF], [1], [Enable brief debugging messages.])
;;
esac], [])
# recvmmsg() (valgrind doesn't support it, so disable for debugging)
# The check for struct mmsghdr is required when libc doesn't have an API but the function links
AC_ARG_ENABLE([recvmmsg],
......
......@@ -273,7 +273,6 @@ libknotd_la_SOURCES = \
knot/nameserver/tsig_ctx.h \
knot/nameserver/update.c \
knot/nameserver/update.h \
knot/common/debug.h \
knot/common/evsched.c \
knot/common/evsched.h \
knot/common/fdset.c \
......
This diff is collapsed.
......@@ -29,7 +29,7 @@
#include "libknot/internal/mem.h"
#include "libknot/internal/macros.h"
#include "libknot/libknot.h"
#include "knot/common/debug.h"
#include "knot/common/log.h"
#include "knot/ctl/estimator.h"
#include "knot/ctl/remote.h"
#include "knot/conf/conf.h"
......@@ -177,7 +177,6 @@ static int cmd_remote_reply(int c, struct timeval *timeout)
/* Read response packet. */
int n = net_dns_tcp_recv(c, pkt->wire, pkt->max_size, timeout);
if (n <= 0) {
dbg_server("remote: couldn't receive response = %s\n", knot_strerror(n));
knot_pkt_free(&pkt);
return KNOT_ECONN;
} else {
......@@ -264,8 +263,6 @@ static int cmd_remote(struct sockaddr_storage *addr, knot_tsig_key_t *key,
}
}
dbg_server("%s: sending query size %zu\n", __func__, pkt->size);
/* Default timeout. */
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
const struct timeval tv_reply = { conf_int(&val), 0 };
......
......@@ -19,7 +19,6 @@
#include <urcu.h>
#include "dnssec/random.h"
#include "knot/common/debug.h"
#include "knot/common/fdset.h"
#include "knot/common/log.h"
#include "knot/conf/conf.h"
......@@ -296,12 +295,10 @@ static int remote_c_reload(server_t *s, remote_cmdargs_t *a)
if (a->argc == 0) {
/* Reload all. */
dbg_server_verb("remote: refreshing all zones\n");
ret = server_reload(s, conf()->filename);
} else {
rcu_read_lock();
/* Reload specific zones. */
dbg_server_verb("remote: refreshing particular zones");
ret = remote_rdata_apply(s, a, &remote_zone_reload);
rcu_read_unlock();
}
......@@ -319,7 +316,6 @@ static int remote_c_status(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
UNUSED(a);
dbg_server("remote: %s\n", __func__);
return KNOT_EOK;
}
......@@ -412,8 +408,6 @@ static int remote_zonestatus(zone_t *zone, remote_cmdargs_t *a)
*/
static int remote_c_zonestatus(server_t *s, remote_cmdargs_t *a)
{
dbg_server("remote: %s\n", __func__);
rcu_read_lock();
if (a->argc == 0) {
knot_zonedb_foreach(s->zone_db, remote_zonestatus, a);
......@@ -434,11 +428,9 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t *a)
*/
static int remote_c_refresh(server_t *s, remote_cmdargs_t *a)
{
dbg_server("remote: %s\n", __func__);
rcu_read_lock();
if (a->argc == 0) {
/* Refresh all. */
dbg_server_verb("remote: refreshing all zones\n");
knot_zonedb_foreach(s->zone_db, remote_zone_refresh, NULL);
} else {
/* Refresh specific zones. */
......@@ -457,7 +449,6 @@ static int remote_c_refresh(server_t *s, remote_cmdargs_t *a)
*/
static int remote_c_retransfer(server_t *s, remote_cmdargs_t *a)
{
dbg_server("remote: %s\n", __func__);
if (a->argc == 0) {
/* Retransfer all. */
return KNOT_CTL_ARG_REQ;
......@@ -481,12 +472,9 @@ static int remote_c_retransfer(server_t *s, remote_cmdargs_t *a)
*/
static int remote_c_flush(server_t *s, remote_cmdargs_t *a)
{
dbg_server("remote: %s\n", __func__);
rcu_read_lock();
if (a->argc == 0) {
/* Flush all. */
dbg_server_verb("remote: flushing all zones\n");
knot_zonedb_foreach(s->zone_db, remote_zone_flush, NULL);
} else {
/* Flush specific zones. */
......@@ -502,8 +490,6 @@ static int remote_c_flush(server_t *s, remote_cmdargs_t *a)
*/
static int remote_c_signzone(server_t *s, remote_cmdargs_t *a)
{
dbg_server("remote: %s\n", __func__);
if (a->argc == 0) {
/* Resign all. */
return KNOT_CTL_ARG_REQ;
......@@ -567,7 +553,6 @@ static int remote_c_conf_begin(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
UNUSED(a);
dbg_server("remote: %s\n", __func__);
return conf_io_begin(false);
}
......@@ -578,7 +563,6 @@ static int remote_c_conf_begin(server_t *s, remote_cmdargs_t *a)
static int remote_c_conf_commit(server_t *s, remote_cmdargs_t *a)
{
UNUSED(a);
dbg_server("remote: %s\n", __func__);
conf_io_t io = {
.fcn = format_item,
......@@ -608,7 +592,6 @@ static int remote_c_conf_abort(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
UNUSED(a);
dbg_server("remote: %s\n", __func__);
return conf_io_abort(false);
}
......@@ -685,7 +668,6 @@ static int parse_conf_key(char *key, char **key0, char **id, char **key1)
static int remote_c_conf_desc(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
if (a->argc > 1) {
return KNOT_EINVAL;
......@@ -724,7 +706,6 @@ static int remote_c_conf_desc(server_t *s, remote_cmdargs_t *a)
static int remote_c_conf_diff(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
if (a->argc > 1) {
return KNOT_EINVAL;
......@@ -756,7 +737,6 @@ static int remote_c_conf_diff(server_t *s, remote_cmdargs_t *a)
static int conf_read(server_t *s, remote_cmdargs_t *a, bool get_current)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
if (a->argc > 1) {
return KNOT_EINVAL;
......@@ -807,7 +787,6 @@ static int remote_c_conf_get(server_t *s, remote_cmdargs_t *a)
static int remote_c_conf_set(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
if (a->argc < 1 || a->argc > 255) {
return KNOT_EINVAL;
......@@ -865,7 +844,6 @@ static int remote_c_conf_set(server_t *s, remote_cmdargs_t *a)
static int remote_c_conf_unset(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
if (a->argc > 255) {
return KNOT_EINVAL;
......@@ -1005,13 +983,11 @@ int remote_recv(int sock, struct sockaddr_storage *addr, uint8_t *buf,
{
int c = tcp_accept(sock);
if (c < 0) {
dbg_server("remote: failed to accept incoming connection\n");
return c;
}
socklen_t addrlen = sizeof(*addr);
if (getpeername(c, (struct sockaddr *)addr, &addrlen) != 0) {
dbg_server("remote: failed to get remote address\n");
close(c);
return KNOT_ECONNREFUSED;
}
......@@ -1020,7 +996,6 @@ int remote_recv(int sock, struct sockaddr_storage *addr, uint8_t *buf,
int n = net_dns_tcp_recv(c, buf, *buflen, NULL);
*buflen = n;
if (n <= 0) {
dbg_server("remote: failed to receive data\n");
close(c);
return KNOT_ECONNREFUSED;
}
......@@ -1125,13 +1100,11 @@ int remote_answer(int sock, server_t *s, knot_pkt_t *pkt)
*/
const knot_dname_t *qname = knot_pkt_qname(pkt);
if (knot_pkt_qclass(pkt) != KNOT_CLASS_CH) {
dbg_server("remote: qclass != CH\n");
return KNOT_EMALF;
}
knot_dname_t *realm = knot_dname_from_str_alloc(KNOT_CTL_REALM);
if (!knot_dname_is_sub(qname, realm) != 0) {
dbg_server("remote: qname != *%s\n", KNOT_CTL_REALM_EXT);
knot_dname_free(&realm, NULL);
return KNOT_EMALF;
}
......@@ -1313,7 +1286,6 @@ int remote_process(server_t *s, struct sockaddr_storage *ctl_addr, int sock,
/* Accept incoming connection and read packet. */
int client = remote_recv(sock, &ss, pkt->wire, &buflen);
if (client < 0) {
dbg_server("remote: failed to receive query = %d\n", client);
knot_pkt_free(&pkt);
return client;
} else {
......
......@@ -17,7 +17,6 @@
#include <assert.h>
#include <stdint.h>
#include "knot/common/debug.h"
#include "knot/dnssec/nsec-chain.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/dnssec/zone-sign.h"
......@@ -112,7 +111,6 @@ static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
knot_rrset_t new_nsec;
ret = create_nsec_rrset(&new_nsec, a, b, data->ttl);
if (ret != KNOT_EOK) {
dbg_dnssec_detail("Failed to create new NSEC.\n");
return ret;
}
......@@ -133,12 +131,10 @@ static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
if (equal) {
// current NSEC is valid, do nothing
dbg_dnssec_detail("NSECs equal.\n");
knot_rdataset_clear(&new_nsec.rrs, NULL);
return KNOT_EOK;
}
dbg_dnssec_detail("NSECs not equal, replacing.\n");
// Mark the node so that we do not sign this NSEC
a->flags |= NODE_FLAGS_REMOVED_NSEC;
ret = knot_nsec_changeset_remove(a, data->changeset);
......@@ -148,7 +144,6 @@ static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
}
}
dbg_dnssec_detail("Adding new NSEC to changeset.\n");
// Add new NSEC to the changeset (no matter if old was removed)
ret = changeset_add_rrset(data->changeset, &new_nsec);
knot_rdataset_clear(&new_nsec.rrs, NULL);
......
......@@ -23,13 +23,13 @@
#include "libknot/internal/mem.h"
#include "libknot/libknot.h"
#include "knot/conf/conf.h"
#include "knot/common/log.h"
#include "knot/dnssec/context.h"
#include "knot/dnssec/policy.h"
#include "knot/dnssec/zone-events.h"
#include "knot/dnssec/zone-keys.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/common/debug.h"
#include "knot/zone/serial.h"
#include "knot/zone/zone.h"
......
......@@ -22,10 +22,11 @@
#include "knot/nameserver/process_answer.h"
#include "knot/updates/apply.h"
#include "knot/zone/zonefile.h"
#include "knot/common/debug.h"
#include "knot/common/log.h"
#include "libknot/libknot.h"
#include "libknot/descriptor.h"
#include "libknot/internal/lists.h"
#include "libknot/internal/print.h"
/* AXFR context. @note aliasing the generic xfr_proc */
struct axfr_proc {
......
......@@ -14,11 +14,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "knot/common/debug.h"
#include "libknot/libknot.h"
#include "libknot/descriptor.h"
#include "libknot/rrtype/rdname.h"
#include "libknot/rrtype/soa.h"
#include "knot/common/log.h"
#include "knot/nameserver/internet.h"
#include "knot/nameserver/nsec_proofs.h"
#include "knot/nameserver/process_query.h"
......@@ -68,8 +68,6 @@ static int dname_cname_synth(const knot_rrset_t *dname_rr,
if (cname_rrset == NULL) {
return KNOT_EINVAL;
}
dbg_ns("%s(%p, %p)\n", __func__, dname_rr, qname);
knot_dname_t *owner_copy = knot_dname_copy(qname, mm);
if (owner_copy == NULL) {
return KNOT_ENOMEM;
......@@ -193,7 +191,6 @@ static int put_answer(knot_pkt_t *pkt, uint16_t type, struct query_data *qdata)
/* If ANY not allowed, set TC bit. */
if ((qdata->param->proc_flags & NS_QUERY_LIMIT_ANY) &&
conf_bool(&val)) {
dbg_ns("%s: ANY/UDP disabled for this zone TC=1\n", __func__);
knot_wire_set_tc(pkt->wire);
return KNOT_ESPACE;
}
......@@ -222,7 +219,6 @@ static int put_answer(knot_pkt_t *pkt, uint16_t type, struct query_data *qdata)
static int put_authority_soa(knot_pkt_t *pkt, struct query_data *qdata,
const zone_contents_t *zone)
{
dbg_ns("%s(%p, %p)\n", __func__, pkt, zone);
knot_rrset_t soa_rrset = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
......@@ -317,8 +313,6 @@ static int put_additional(knot_pkt_t *pkt, const knot_rrset_t *rr,
static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qdata)
{
dbg_ns("%s(%p, %p)\n", __func__, pkt, qdata);
const zone_node_t *cname_node = qdata->node;
knot_rrset_t cname_rr = node_rrset(qdata->node, rrtype);
knot_rrset_t rrsigs = node_rrset(qdata->node, KNOT_RRTYPE_RRSIG);
......@@ -340,8 +334,6 @@ static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qda
/* Check if RR count increased. */
if (pkt->rrset_count <= rr_count_before) {
dbg_ns("%s: RR %p already inserted => CNAME loop\n",
__func__, &cname_rr);
qdata->node = NULL; /* Act is if the name leads to nowhere. */
return HIT;
}
......@@ -372,10 +364,7 @@ static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qda
if (knot_dname_is_wildcard(cname_node->owner)) {
/* Check if is not in wildcard nodes (loop). */
dbg_ns("%s: CNAME node %p is wildcard\n", __func__, cname_node);
if (wildcard_has_visited(qdata, cname_node)) {
dbg_ns("%s: node %p already visited => CNAME loop\n",
__func__, cname_node);
qdata->node = NULL; /* Act is if the name leads to nowhere. */
return HIT;
}
......@@ -389,28 +378,18 @@ static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qda
/* Now follow the next CNAME TARGET. */
qdata->name = knot_cname_name(&cname_rr.rrs);
#ifdef KNOT_NS_DEBUG
char *cname_str = knot_dname_to_str_alloc(cname_node->owner);
char *target_str = knot_dname_to_str_alloc(qdata->name);
dbg_ns("%s: FOLLOW '%s' -> '%s'\n", __func__, cname_str, target_str);
free(cname_str);
free(target_str);
#endif /* KNOT_NS_DEBUG */
return FOLLOW;
}
static int name_found(knot_pkt_t *pkt, struct query_data *qdata)
{
uint16_t qtype = knot_pkt_qtype(pkt);
dbg_ns("%s(%p, %p)\n", __func__, pkt, qdata);
if (node_rrtype_exists(qdata->node, KNOT_RRTYPE_CNAME)
&& qtype != KNOT_RRTYPE_CNAME
&& qtype != KNOT_RRTYPE_RRSIG
&& qtype != KNOT_RRTYPE_NSEC
&& qtype != KNOT_RRTYPE_ANY) {
dbg_ns("%s: solving CNAME\n", __func__);
return follow_cname(pkt, KNOT_RRTYPE_CNAME, qdata);
}
......@@ -418,15 +397,12 @@ static int name_found(knot_pkt_t *pkt, struct query_data *qdata)
* triggers referral response. */
if (qtype != KNOT_RRTYPE_DS &&
((qdata->node->flags & NODE_FLAGS_DELEG) || qdata->node->flags & NODE_FLAGS_NONAUTH)) {
dbg_ns("%s: solving REFERRAL\n", __func__);
return DELEG;
}
uint16_t old_rrcount = pkt->rrset_count;
int ret = put_answer(pkt, qtype, qdata);
if (ret != KNOT_EOK) {
dbg_ns("%s: failed answer from node %p (%s)\n",
__func__, qdata->node, knot_strerror(ret));
if (ret == KNOT_ESPACE) {
return TRUNC;
} else {
......@@ -444,12 +420,8 @@ static int name_found(knot_pkt_t *pkt, struct query_data *qdata)
static int name_not_found(knot_pkt_t *pkt, struct query_data *qdata)
{
dbg_ns("%s(%p, %p)\n", __func__, pkt, qdata);
/* Name is covered by wildcard. */
if (qdata->encloser->flags & NODE_FLAGS_WILDCARD_CHILD) {
dbg_ns("%s: name %p covered by wildcard\n", __func__, qdata->name);
/* Find wildcard child in the zone. */
const zone_node_t *wildcard_node =
zone_contents_find_wildcard_child(
......@@ -475,25 +447,21 @@ static int name_not_found(knot_pkt_t *pkt, struct query_data *qdata)
/* Name is under DNAME, use it for substitution. */
knot_rrset_t dname_rrset = node_rrset(qdata->encloser, KNOT_RRTYPE_DNAME);
if (!knot_rrset_empty(&dname_rrset)) {
dbg_ns("%s: solving DNAME for name %p\n", __func__, qdata->name);
qdata->node = qdata->encloser; /* Follow encloser as new node. */
return follow_cname(pkt, KNOT_RRTYPE_DNAME, qdata);
}
/* Name is below delegation. */
if ((qdata->encloser->flags & NODE_FLAGS_DELEG)) {
dbg_ns("%s: name below delegation point %p\n", __func__, qdata->name);
qdata->node = qdata->encloser;
return DELEG;
}
dbg_ns("%s: name not found in zone %p\n", __func__, qdata->name);
return MISS;
}
static int solve_name(int state, knot_pkt_t *pkt, struct query_data *qdata)
{
dbg_ns("%s(%d, %p, %p)\n", __func__, state, pkt, qdata);
int ret = zone_contents_find_dname(qdata->zone->contents, qdata->name,
&qdata->node, &qdata->encloser,
&qdata->previous);
......@@ -552,16 +520,13 @@ static int solve_authority(int state, knot_pkt_t *pkt, struct query_data *qdata,
switch (state) {
case HIT: /* Positive response. */
dbg_ns("%s: answer is POSITIVE\n", __func__);
ret = KNOT_EOK;
break;
case MISS: /* MISS, set NXDOMAIN RCODE. */
dbg_ns("%s: answer is NXDOMAIN\n", __func__);
qdata->rcode = KNOT_RCODE_NXDOMAIN;
ret = put_authority_soa(pkt, qdata, zone_contents);
break;
case NODATA: /* NODATA append AUTHORITY SOA. */
dbg_ns("%s: answer is NODATA\n", __func__);
ret = put_authority_soa(pkt, qdata, zone_contents);
break;
case DELEG: /* Referral response. */
......@@ -673,7 +638,6 @@ int ns_put_rr(knot_pkt_t *pkt, const knot_rrset_t *rr,
uint32_t flags, struct query_data *qdata)
{
if (rr->rrs.rr_count < 1) {
dbg_ns("%s: refusing to put empty RR of type %u\n", __func__, rr->type);
return KNOT_EMALF;
}
......@@ -737,19 +701,16 @@ static int default_answer(knot_pkt_t *response, struct query_data *qdata)
int state = BEGIN;
/* Resolve ANSWER. */
dbg_ns("%s: writing %p ANSWER\n", __func__, response);
knot_pkt_begin(response, KNOT_ANSWER);
SOLVE_STEP(solve_answer, state, NULL);
SOLVE_STEP(solve_answer_dnssec, state, NULL);
/* Resolve AUTHORITY. */
dbg_ns("%s: writing %p AUTHORITY\n", __func__, response);
knot_pkt_begin(response, KNOT_AUTHORITY);
SOLVE_STEP(solve_authority, state, NULL);
SOLVE_STEP(solve_authority_dnssec, state, NULL);
/* Resolve ADDITIONAL. */
dbg_ns("%s: writing %p ADDITIONAL\n", __func__, response);
knot_pkt_begin(response, KNOT_ADDITIONAL);
SOLVE_STEP(solve_additional, state, NULL);
SOLVE_STEP(solve_additional_dnssec, state, NULL);
......@@ -771,7 +732,6 @@ static int planned_answer(struct query_plan *plan, knot_pkt_t *response, struct
/* Begin processing. */
for (int section = KNOT_ANSWER; section <= KNOT_ADDITIONAL; ++section) {
dbg_ns("%s: writing section %u\n", __func__, section);
knot_pkt_begin(response, section);
WALK_LIST(step, plan->stage[QPLAN_STAGE + section]) {
SOLVE_STEP(step->process, state, step->ctx);
......@@ -793,7 +753,6 @@ static int planned_answer(struct query_plan *plan, knot_pkt_t *response, struct
int internet_query(knot_pkt_t *response, struct query_data *qdata)
{
dbg_ns("%s(%p, %p)\n", __func__, response, qdata);
if (response == NULL || qdata == NULL) {
return KNOT_STATE_FAIL;
}
......
......@@ -22,10 +22,11 @@
#include "knot/nameserver/process_query.h"
#include "knot/nameserver/process_answer.h"
#include "knot/updates/apply.h"
#include "knot/common/debug.h"
#include "knot/common/log.h"
#include "knot/zone/serial.h"
#include "libknot/libknot.h"
#include "libknot/descriptor.h"
#include "libknot/internal/print.h"
#include "libknot/internal/utils.h"
#include "libknot/rrtype/soa.h"
......@@ -111,7 +112,6 @@ static int ixfr_process_changeset(knot_pkt_t *pkt, const void *item,
/* Put former SOA. */
if (ixfr->state == IXFR_SOA_DEL) {
IXFR_SAFE_PUT(pkt, chgset->soa_from);
dbg_ns("%s: put 'REMOVE' SOA\n", __func__);
ixfr->state = IXFR_DEL;
}
......@@ -134,7 +134,6 @@ static int ixfr_process_changeset(knot_pkt_t *pkt, const void *item,
/* Put next SOA. */
if (ixfr->state == IXFR_SOA_ADD) {
IXFR_SAFE_PUT(pkt, chgset->soa_to);
dbg_ns("%s: put 'IXFR_ADD' SOA\n", __func__);
ixfr->state = IXFR_ADD;
}
......@@ -253,7 +252,6 @@ static int ixfr_answer_init(struct query_data *qdata)
init_list(&chgsets);
int ret = ixfr_load_chsets(&chgsets, (zone_t *)qdata->zone, their_soa);
if (ret != KNOT_EOK) {
dbg_ns("%s: failed to load changesets => %d\n", __func__, ret);
return ret;
}
......@@ -299,7 +297,6 @@ static int ixfr_answer_init(struct query_data *qdata)
/*! \brief Sends response to SOA query. */
static int ixfr_answer_soa(knot_pkt_t *pkt, struct query_data *qdata)
{
dbg_ns("%s: answering IXFR/SOA\n", __func__);
if (pkt == NULL || qdata == NULL) {
return KNOT_STATE_FAIL;
}
......
......@@ -28,10 +28,9 @@
#include "libknot/packet/wire.h"
#include "knot/updates/acl.h"
#include "knot/common/evsched.h"
#include "knot/common/debug.h"
#include "knot/common/log.h"
#include "knot/server/server.h"
#include "knot/nameserver/internet.h"
#include "knot/common/debug.h"
#include "knot/nameserver/process_query.h"
#include "dnssec/random.h"
#include "knot/nameserver/tsig_ctx.h"
......
......@@ -20,8 +20,6 @@
#include "knot/nameserver/internet.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/common/debug.h"
#define DNSSEC_ENABLED 1
/*! \note #191 There is a lot of duplicate and legacy code here. I have just
......@@ -122,12 +120,6 @@ static int ns_put_covering_nsec3(const zone_contents_t *zone,
return KNOT_EOK;
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(prev->owner);
dbg_ns_verb("Covering NSEC3 node: %s\n", name);
free(name);
);
return ns_put_nsec3_from_node(prev, qdata, resp);
}
......@@ -167,23 +159,10 @@ static int ns_put_nsec3_closest_encloser_proof(
// this function should be called only if NSEC3 is enabled in the zone
assert(zone_contents_nsec3params(zone) != NULL);
dbg_ns_verb("Adding closest encloser proof\n");
if (zone_contents_nsec3params(zone) == NULL) {
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(zone->apex->owner);
dbg_ns_verb("No NSEC3PARAM found in zone %s.\n", name);
free(name);
);
return KNOT_EOK;
}
dbg_ns_exec_detail(
char *name = knot_dname_to_str_alloc((*closest_encloser)->owner);
dbg_ns_detail("Closest encloser: %s\n", name);
free(name);
);
/*
* 1) NSEC3 that matches closest provable encloser.
*/
......@@ -201,22 +180,6 @@ dbg_ns_exec_detail(
assert(nsec3_node != NULL);
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(nsec3_node->owner);
dbg_ns_verb("NSEC3 node: %s\n", name);
free(name);
name = knot_dname_to_str_alloc((*closest_encloser)->owner);
dbg_ns_verb("Closest provable encloser: %s\n", name);
free(name);
if (next_closer != NULL) {
name = knot_dname_to_str_alloc(next_closer);
dbg_ns_verb("Next closer name: %s\n", name);
free(name);
} else {
dbg_ns_verb("Next closer name: none\n");
}
);
int ret = ns_put_nsec3_from_node(nsec3_node, qdata, resp);
if (ret != KNOT_EOK) {
return ret;
......@@ -233,11 +196,7 @@ dbg_ns_exec_verb(
if (new_next_closer == NULL) {
return KNOT_ERROR; /*servfail */
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(new_next_closer);
dbg_ns_verb("Next closer name: %s\n", name);
free(name);
);
ret = ns_put_covering_nsec3(zone, new_next_closer, qdata, resp);
knot_dname_free(&new_next_closer, NULL);
......@@ -269,11 +228,6 @@ static knot_dname_t *ns_wildcard_child_name(const knot_dname_t *name)
if (wildcard == NULL)
return NULL;
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(wildcard);
dbg_ns_verb("Wildcard: %s\n", name);
free(name);
);
return wildcard;
}
......@@ -394,18 +348,13 @@ static int ns_put_nsec3_wildcard(const zone_contents_t *zone,
* NSEC3 that covers the "next closer" name.
*/
// create the "next closer" name by appending from qname
dbg_ns_verb("Finding next closer name for wildcard NSEC3.\n");
knot_dname_t *next_closer =
ns_next_closer(closest_encloser->owner, qname);
if (next_closer == NULL) {
return KNOT_ERROR; /* servfail */
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(next_closer);
dbg_ns_verb("Next closer name: %s\n", name);
free(name);
);
int ret = ns_put_covering_nsec3(zone, next_closer, qdata, resp);
/* Duplicate from ns_next_close(), safe to discard. */
......@@ -445,7 +394,6 @@ static int ns_put_nsec_nsec3_wildcard_answer(const zone_node_t *node,
int ret = KNOT_EOK;
if (knot_dname_is_wildcard(node->owner)
&& !knot_dname_is_equal(qname, node->owner)) {
dbg_ns_verb("Adding NSEC/NSEC3 for wildcard answer.\n");
if (knot_is_nsec3_enabled(zone)) {
ret = ns_put_nsec3_wildcard(zone, closest_encloser,
qname, qdata, resp);
......@@ -495,12 +443,6 @@ static int ns_put_nsec_nxdomain(const knot_dname_t *qname,
}
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str_alloc(previous->owner);
dbg_ns_verb("Previous node: %s\n", name);
free(name);
);
// 1) NSEC proving that there is no node with the searched name
rrset = node_rrset(previous, KNOT_RRTYPE_NSEC);
rrsigs = node_rrset(previous, KNOT_RRTYPE_RRSIG);
......@@ -512,8 +454,6 @@ dbg_ns_exec_verb(
int ret = ns_put_rr(resp, &rrset, &rrsigs, KNOT_COMPR_HINT_NONE, 0, qdata);
if (ret != KNOT_EOK) {
dbg_ns("Failed to add NSEC for NXDOMAIN to response: %s\n",
knot_strerror(ret));
return ret;
}
......@@ -545,8 +485,6 @@ dbg_ns_exec_verb(
}
ret = ns_put_rr(resp, &rrset, &rrsigs, KNOT_COMPR_HINT_NONE, 0, qdata);
if (ret != KNOT_EOK) {
dbg_ns("Failed to add second NSEC for NXDOMAIN to "
"response: %s\n", knot_strerror(ret));
return ret;
}
}
......@@ -582,8 +520,6 @@ static int ns_put_nsec3_nxdomain(const zone_contents_t *zone,
qname, qdata, resp);
// 2) NSEC3 covering non-existent wildcard
if (ret == KNOT_EOK && closest_encloser != NULL) {
dbg_ns_verb("Putting NSEC3 for no wildcard child of closest "
"encloser.\n");
ret = ns_put_nsec3_no_wildcard_child(zone, closest_encloser,