Commit 91ebc4c9 authored by Marek Vavrusa's avatar Marek Vavrusa

Merge branch 'master' into packet-api-rewrite

Conflicts:
	src/knot/server/server.c
	src/libknot/nameserver/name-server.c
	src/libknot/packet/packet.c
	src/libknot/packet/response.c
parents b9d51371 48621a5b
......@@ -28,10 +28,6 @@ src/common/base64.c
src/common/base64.h
src/common/binsearch.h
src/common/crc.h
src/common/dSFMT-params.h
src/common/dSFMT-params521.h
src/common/dSFMT.c
src/common/dSFMT.h
src/common/descriptor.c
src/common/descriptor.h
src/common/errcode.c
......@@ -69,8 +65,6 @@ src/common/mempool.c
src/common/mempool.h
src/common/print.c
src/common/print.h
src/common/prng.c
src/common/prng.h
src/common/ref.c
src/common/ref.h
src/common/slab/alloc-common.h
......@@ -148,6 +142,7 @@ src/libknot/dnssec/nsec-bitmap.h
src/libknot/dnssec/nsec3.c
src/libknot/dnssec/nsec3.h
src/libknot/dnssec/policy.h
src/libknot/dnssec/random.h
src/libknot/dnssec/rrset-sign.c
src/libknot/dnssec/rrset-sign.h
src/libknot/dnssec/sig0.c
......
......@@ -3,19 +3,22 @@ Knot DNS NEWS
v1.4.0-rc2 - Dec 13, 2013
-------------------------
Features:
* ./configure prints build configuration summary
* IDN support in Knot utilities
* Pretty zone file output (DNSSEC-related data separately)
* Lower memory consumption
* DNSSEC: support for GOST algorithm
* config: option 'dnssec-keydir' can be set per zone
* config: option 'storage' can be set per zone
Bugfixes:
* Crash in particular additionals processing
* Race condition in event cancelation
* Journal corruption after failed transactions
* DNSSEC: fixed detection of ECDSA support
Other improvements:
* ./configure prints build configuration summary
* Pretty zone file output (DNSSEC-related data separately)
* Lower memory consumption
* config: option 'dnssec-keydir' can be set per zone
* config: option 'storage' can be set per zone
v1.4.0-rc1 - Nov 20, 2013
-------------------------
......
......@@ -11,6 +11,7 @@ Knot DNS has several dependencies:
Optional packages:
* libcap-ng >= 0.6.4 (for POSIX 1003.1e capabilites(7))
* libidn (for IDNA2003 support in Knot utilities)
Dependencies for building documentation:
* texinfo
......
......@@ -87,22 +87,19 @@ AM_CONDITIONAL([T0_PARSER], test "$enable_fastparser" = "no")
# Debug modules
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug=server,zones,xfr,packet,dname,rr,ns,hash,compiler,stash],
AS_HELP_STRING([--enable-debug=server,zones,xfr,packet,rr,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.]) ;;
xfr) AC_DEFINE([KNOT_XFR_DEBUG], [1], [XFR debug.]) ;;
packet) AC_DEFINE([KNOT_PACKET_DEBUG], [1], [Packet debug.]) ;;
dname) AC_DEFINE([KNOT_DNAME_DEBUG], [1], [Domain names debug.]) ;;
rr) AC_DEFINE([KNOT_RR_DEBUG], [1], [RR debug.]) ;;
ns) AC_DEFINE([KNOT_NS_DEBUG], [1], [Nameserver debug.]) ;;
hash) AC_DEFINE([KNOT_HASH_DEBUG], [1], [Hashtable debug.]) ;;
compiler) AC_DEFINE([KNOT_COMPILER_DEBUG], [1], [Zone compiler debug.]) ;;
stash) AC_DEFINE([KNOT_STASH_DEBUG], [1], [Hash table stash debug.]) ;;
dnssec) AC_DEFINE([KNOT_DNSSEC_DEBUG], [1], [DNSSEC debug.]) ;;
server) AC_DEFINE([KNOTD_SERVER_DEBUG], [1], [Server debug.]) ;;
zones) AC_DEFINE([KNOT_ZONES_DEBUG], [1], [Zones debug.]) ;;
xfr) AC_DEFINE([KNOT_XFR_DEBUG], [1], [XFR debug.]) ;;
packet) AC_DEFINE([KNOT_PACKET_DEBUG], [1], [Packet debug.]) ;;
rr) AC_DEFINE([KNOT_RR_DEBUG], [1], [RR 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
], [])
......@@ -318,9 +315,6 @@ AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
# Set PRNG parameters
AC_DEFINE([DSFMT_MEXP], [521], [DSFMT parameters])
# Checks for library functions.
AC_CHECK_FUNCS([clock_gettime gettimeofday fgetln getline madvise poll posix_memalign pselect pthread_setaffinity_np regcomp select setgroups initgroups])
......
......@@ -105,12 +105,11 @@ listed, separated by commas:
timers, high-level journal management.
@item @code{xfr} - AXFR, IXFR and NOTIFY handling.
@item @code{packet} - Packet parsing and response creation.
@item @code{dname} - Parsing, comparing and other operations on domain names.
@item @code{rr} - Details of processed resource records.
@item @code{ns} - Query processing, high-level handling of all requests
(transfers, NOTIFY, normal queries).
@item @code{hash} - Details of hash table (the main data structure) operation.
@item @code{compiler} - Zone file compilation.
@item @code{loader} - Zone loading and semantic checks.
@item @code{dnssec} - DNSSEC operations.
@end itemize
@item
......
......@@ -24,8 +24,8 @@ Is a domain name that is to be looked up.
.TP
.I server
Is a domain name or an IPv4 or IPv6 address of the nameserver to send a query to.
The address can be specified using [address]:port notation. If no server is specified,
the servers from \fB/etc/resolv.conf\fR are used.
An additional port can be specified using address:port ([address]:port for IPv6 address)
or address#port notation. If no server is specified, the servers from \fB/etc/resolv.conf\fR are used.
.TP
If no arguments are provided, \fBkdig\fR sends \fINS\fR query for the root zone.
.SH OPTIONS
......@@ -164,7 +164,7 @@ Use EDNS version (default is 0).
.TP
.BR +noidn
Disable IDN transformation to ASCII and vice versa.
IDN support depends on libidn availability during project building!
IDNA2003 support depends on libidn availability during project building!
.TP
.BI +time= T
Set wait for reply interval in seconds (default is 5 seconds).
......@@ -179,26 +179,22 @@ Set EDNS buffer size in bytes (default is 512 bytes).
Options \fB\-k\fR and \fB\-y\fR cannot be used mutually.
.SS Missing features with regard to ISC dig
Options \fB\-f\fR and \fB\-m\fR and query options:
.br
.BR
.BR +split=\fIW\fR ,\ +tries=\fIT\fR ,\ +ndots=\fID\fR ,
.br
.BR
.BR +domain=\fIsomename\fR , +trusted\-key=\fI####\fR ,
.br
.BR
.BR + [ no ] vc ,\ + [ no ] search ,\ + [ no ] showsearch ,
.br
.BR
.BR + [ no ] defname ,\ + [ no ] aaonly ,\ + [ no ] cmd ,
.br
.BR
.BR + [ no ] identify ,\ + [ no ] comments ,\ + [ no ] rrcomments ,
.br
.BR
.BR + [ no ] onesoa ,\ + [ no ] besteffort ,\ + [ no ] sigchase ,
.br
.BR
.BR + [ no ] topdown ,\ + [ no ] nssearch ,\ + [ no ] trace.
.TP
Per-user file configuration via ${HOME}/.digrc.
.SS Differences with regard to ISC dig
Optional port specification has a form of [address]:port instead of address#port.
.TP
Trailing information is formatted slightly different.
.SH EXAMPLES
.B Example 1. Get A record for example.com:
.TP
......@@ -208,7 +204,7 @@ Trailing information is formatted slightly different.
.TP
# kdig example.com \-t AXFR @192.0.2.1
.TP
.B Example 3. Send one A query for example.com from 192.0.2.1 and one reverse \
.B Example 3. Get A record for example.com from 192.0.2.1 and reverse \
lookup for address 2001:DB8::1 from 192.0.2.2. Both using TCP protocol:
.TP
# kdig +tcp example.com \-t A @192.0.2.1 \-x 2001:DB8::1 @192.0.2.2
......
......@@ -174,6 +174,7 @@ libknot_la_SOURCES = \
libknot/dnssec/nsec3.c \
libknot/dnssec/nsec3.h \
libknot/dnssec/policy.h \
libknot/dnssec/random.h \
libknot/dnssec/rrset-sign.c \
libknot/dnssec/rrset-sign.h \
libknot/dnssec/sig0.c \
......@@ -226,12 +227,6 @@ libknots_la_SOURCES = \
common/errors.c \
common/errcode.h \
common/errcode.c \
common/dSFMT.h \
common/dSFMT-params.h \
common/dSFMT-params521.h \
common/dSFMT.c \
common/prng.h \
common/prng.c \
common/fdset.h \
common/fdset.c \
common/getline.h \
......
#ifndef DSFMT_PARAMS_H
#define DSFMT_PARAMS_H
#include "common/dSFMT.h"
/*----------------------
the parameters of DSFMT
following definitions are in dSFMT-paramsXXXX.h file.
----------------------*/
/** the pick up position of the array.
#define DSFMT_POS1 122
*/
/** the parameter of shift left as four 32-bit registers.
#define DSFMT_SL1 18
*/
/** the parameter of shift right as four 32-bit registers.
#define DSFMT_SR1 12
*/
/** A bitmask, used in the recursion. These parameters are introduced
* to break symmetry of SIMD.
#define DSFMT_MSK1 (uint64_t)0xdfffffefULL
#define DSFMT_MSK2 (uint64_t)0xddfecb7fULL
*/
/** These definitions are part of a 128-bit period certification vector.
#define DSFMT_PCV1 UINT64_C(0x00000001)
#define DSFMT_PCV2 UINT64_C(0x00000000)
*/
#define DSFMT_LOW_MASK UINT64_C(0x000FFFFFFFFFFFFF)
#define DSFMT_HIGH_CONST UINT64_C(0x3FF0000000000000)
#define DSFMT_SR 12
/* for sse2 */
#if defined(HAVE_SSE2)
#define SSE2_SHUFF 0x1b
#elif defined(HAVE_ALTIVEC)
#if defined(__APPLE__) /* For OSX */
#define ALTI_SR (vector unsigned char)(4)
#define ALTI_SR_PERM \
(vector unsigned char)(15,0,1,2,3,4,5,6,15,8,9,10,11,12,13,14)
#define ALTI_SR_MSK \
(vector unsigned int)(0x000fffffU,0xffffffffU,0x000fffffU,0xffffffffU)
#define ALTI_PERM \
(vector unsigned char)(12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3)
#else
#define ALTI_SR {4}
#define ALTI_SR_PERM {15,0,1,2,3,4,5,6,15,8,9,10,11,12,13,14}
#define ALTI_SR_MSK {0x000fffffU,0xffffffffU,0x000fffffU,0xffffffffU}
#define ALTI_PERM {12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3}
#endif
#endif
#if DSFMT_MEXP == 521
#include "common/dSFMT-params521.h"
#elif DSFMT_MEXP == 1279
#include "dSFMT-params1279.h"
#elif DSFMT_MEXP == 2203
#include "dSFMT-params2203.h"
#elif DSFMT_MEXP == 4253
#include "dSFMT-params4253.h"
#elif DSFMT_MEXP == 11213
#include "dSFMT-params11213.h"
#elif DSFMT_MEXP == 19937
#include "dSFMT-params19937.h"
#elif DSFMT_MEXP == 44497
#include "dSFMT-params44497.h"
#elif DSFMT_MEXP == 86243
#include "dSFMT-params86243.h"
#elif DSFMT_MEXP == 132049
#include "dSFMT-params132049.h"
#elif DSFMT_MEXP == 216091
#include "dSFMT-params216091.h"
#else
#ifdef __GNUC__
#error "DSFMT_MEXP is not valid."
#undef DSFMT_MEXP
#else
#undef DSFMT_MEXP
#endif
#endif
#endif /* DSFMT_PARAMS_H */
#ifndef DSFMT_PARAMS521_H
#define DSFMT_PARAMS521_H
/* #define DSFMT_N 4 */
/* #define DSFMT_MAXDEGREE 544 */
#define DSFMT_POS1 3
#define DSFMT_SL1 25
#define DSFMT_MSK1 UINT64_C(0x000fbfefff77efff)
#define DSFMT_MSK2 UINT64_C(0x000ffeebfbdfbfdf)
#define DSFMT_MSK32_1 0x000fbfefU
#define DSFMT_MSK32_2 0xff77efffU
#define DSFMT_MSK32_3 0x000ffeebU
#define DSFMT_MSK32_4 0xfbdfbfdfU
#define DSFMT_FIX1 UINT64_C(0xcfb393d661638469)
#define DSFMT_FIX2 UINT64_C(0xc166867883ae2adb)
#define DSFMT_PCV1 UINT64_C(0xccaa588000000000)
#define DSFMT_PCV2 UINT64_C(0x0000000000000001)
#define DSFMT_IDSTR "dSFMT2-521:3-25:fbfefff77efff-ffeebfbdfbfdf"
/* PARAMETERS FOR ALTIVEC */
#if defined(__APPLE__) /* For OSX */
#define ALTI_SL1 (vector unsigned int)(1, 1, 1, 1)
#define ALTI_SL1_PERM \
(vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
#define ALTI_SL1_MSK \
(vector unsigned int)(0xffffffffU,0xfe000000U,0xffffffffU,0xfe000000U)
#define ALTI_MSK (vector unsigned int)(DSFMT_MSK32_1, \
DSFMT_MSK32_2, DSFMT_MSK32_3, DSFMT_MSK32_4)
#else /* For OTHER OSs(Linux?) */
#define ALTI_SL1 {1, 1, 1, 1}
#define ALTI_SL1_PERM \
{3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
#define ALTI_SL1_MSK \
{0xffffffffU,0xfe000000U,0xffffffffU,0xfe000000U}
#define ALTI_MSK \
{DSFMT_MSK32_1, DSFMT_MSK32_2, DSFMT_MSK32_3, DSFMT_MSK32_4}
#endif
#endif /* DSFMT_PARAMS521_H */
This diff is collapsed.
This diff is collapsed.
......@@ -195,18 +195,11 @@ event_t* evsched_next(evsched_t *s)
/* Immediately return. */
if (timercmp_ge(&dt, &next_ev->tv)) {
s->cur = next_ev;
s->last_ev = next_ev;
s->running = true;
heap_delmin(&s->heap);
pthread_mutex_unlock(&s->mx);
pthread_mutex_lock(&s->rl);
/* Check back for late cancellation. */
if (s->cur == NULL) {
pthread_mutex_unlock(&s->rl);
pthread_mutex_lock(&s->mx);
continue;
}
return next_ev;
}
......@@ -225,7 +218,6 @@ event_t* evsched_next(evsched_t *s)
/* Unlock calendar, this shouldn't happen. */
pthread_mutex_unlock(&s->mx);
return NULL;
}
int evsched_event_finished(evsched_t *s)
......@@ -234,15 +226,17 @@ int evsched_event_finished(evsched_t *s)
return KNOT_EINVAL;
}
/* Mark as finished. */
if (s->cur) {
s->cur = NULL;
pthread_mutex_unlock(&s->rl);
return KNOT_EOK;
/* \note This enables event cancellation & running on next event. */
if(s->running) {
if (pthread_mutex_unlock(&s->rl) != 0) {
return KNOT_ERROR;
}
s->running = false; /* Mark as not running. */
} else {
return KNOT_ENOTRUNNING;
}
/* No event running. */
return KNOT_ENOTRUNNING;
return KNOT_EOK;
}
int evsched_schedule(evsched_t *s, event_t *ev, uint32_t dt)
......@@ -316,40 +310,39 @@ static int evsched_try_cancel(evsched_t *s, event_t *ev)
if (!s || !ev) {
return KNOT_EINVAL;
}
/* Make sure not running. */
/* Make sure not running. If an event is starting, we race for this lock
* and either win or lose. If we lose, we may find it in heap because
* it rescheduled itself. Either way, it will be marked as last running. */
pthread_mutex_lock(&s->rl);
/* Lock calendar. */
pthread_mutex_lock(&s->mx);
if ((found = heap_find(&s->heap, ev))) {
heap_delete(&s->heap, found);
}
/* Check if not being processed, invalidate if yes.
* Could happen if next 'cur' was set, but
* the evsched_next() waits until we release rl.
*/
if (s->cur == ev) {
s->cur = NULL; /* Invalidate */
found = KNOT_EAGAIN; /* Already ran, try again. */
/* Last running event was (probably) the one we're trying to cancel. */
if (s->last_ev == ev) {
s->last_ev = NULL; /* Invalidate it. */
found = KNOT_EAGAIN; /* Let's try again if it didn't reschedule itself. */
}
/* Unlock calendar. */
pthread_cond_broadcast(&s->notify);
pthread_mutex_unlock(&s->mx);
/* Enable running events. */
pthread_mutex_unlock(&s->rl);
if (found > 0) { /* Event canceled. */
if (found > 0) { /* Event canceled. */
return KNOT_EOK;
} else if (found < 0) {
return found; /* Error */
} else if (found < 0) { /* Error */
return found;
}
/* Not found. */
return KNOT_ENOENT;
return KNOT_ENOENT; /* Not found. */
}
int evsched_cancel(evsched_t *s, event_t *ev)
......
......@@ -67,6 +67,7 @@
#define _KNOTD_COMMON_EVSCHED_H_
#include <pthread.h>
#include <stdbool.h>
#include "common/slab/slab.h"
#include "common/heap.h"
#include "common/evqueue.h"
......@@ -88,10 +89,11 @@ typedef enum evsched_ev_t {
* Scheduler is terminated with a special EVSCHED_TERM event type.
*/
typedef struct {
pthread_mutex_t rl; /*!< Event running lock. */
volatile event_t *cur; /*!< Current running event. */
pthread_mutex_t mx; /*!< Event queue locking. */
pthread_cond_t notify; /*!< Event queue notification. */
pthread_mutex_t rl; /*!< Event running lock. */
volatile bool running;
volatile event_t *last_ev; /*!< Last running event. */
pthread_mutex_t mx; /*!< Event queue locking. */
pthread_cond_t notify; /*!< Event queue notification. */
struct heap heap;
struct {
slab_cache_t alloc; /*!< Events SLAB cache. */
......@@ -164,6 +166,9 @@ event_t* evsched_next(evsched_t *s);
*
* Need to call this after each event returned by evsched_next() is finished.
*
* \note Must not be called from outside event scheduler, only from events or
* event processing.
*
* \param s Event scheduler.
*
* \retval KNOT_EOK if successful.
......
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include <config.h>
#ifdef HAVE_POSIX_MEMALIGN
#include <stdlib.h>
#endif
#include "libknot/common.h"
#include "common/prng.h"
#include "common/dSFMT.h"
/*! \brief TLS unique key for each thread seed. */
static pthread_key_t tls_prng_key;
static pthread_once_t tls_prng_once = PTHREAD_ONCE_INIT;
static void tls_prng_deinit(void *ptr)
{
free(ptr);
}
static void tls_prng_deinit_main()
{
tls_prng_deinit(pthread_getspecific(tls_prng_key));
UNUSED(pthread_setspecific(tls_prng_key, NULL));
}
static void tls_prng_init()
{
UNUSED(pthread_key_create(&tls_prng_key, tls_prng_deinit));
atexit(tls_prng_deinit_main); // Main thread cleanup
}
double tls_rand()
{
/* Setup PRNG state for current thread. */
UNUSED(pthread_once(&tls_prng_once, tls_prng_init));
/* Create PRNG state if not exists. */
dsfmt_t* s = pthread_getspecific(tls_prng_key);
if (!s) {
/* Initialize seed from system PRNG generator. */
uint32_t seed = 0;
FILE *fp = fopen("/dev/urandom", "r");
if (fp == NULL) {
fp = fopen("/dev/random", "r");
}
if (fp != NULL) {
if (fread(&seed, sizeof(uint32_t), 1, fp) != 1) {
fclose(fp);
fp = NULL;
}
}
if (fp == NULL) {
fprintf(stderr, "error: PRNG: cannot seed from "
"/dev/urandom, seeding from local time\n");
struct timeval tv;
if (gettimeofday(&tv, NULL) == 0) {
seed = (uint32_t)(tv.tv_sec ^ tv.tv_usec);
} else {
/* Last resort. */
seed = (uint32_t)time(NULL);
}
} else {
fclose(fp);
}
/* Initialize PRNG state. */
#ifdef HAVE_POSIX_MEMALIGN
if (posix_memalign((void **)&s, 16, sizeof(dsfmt_t)) != 0) {
fprintf(stderr, "error: PRNG: not enough memory\n");
return .0;
}
#else
if ((s = malloc(sizeof(dsfmt_t))) == NULL) {
fprintf(stderr, "error: PRNG: not enough memory\n");
return .0;
}
#endif
dsfmt_init_gen_rand(s, seed);
UNUSED(pthread_setspecific(tls_prng_key, s));
}
return dsfmt_genrand_close_open(s);
}
......@@ -19,7 +19,6 @@
#include "knot/ctl/remote.h"
#include "common/log.h"
#include "common/fdset.h"
#include "common/prng.h"
#include "knot/knot.h"
#include "knot/conf/conf.h"
#include "knot/server/socket.h"
......@@ -30,6 +29,7 @@
#include "libknot/nameserver/name-server.h"
#include "libknot/tsig-op.h"
#include "libknot/rdata.h"
#include "libknot/dnssec/random.h"
#include "libknot/dnssec/zone-sign.h"
#include "libknot/dnssec/zone-nsec.h"
......@@ -135,7 +135,7 @@ static int remote_zone_refresh(server_t *s, const knot_zone_t *z)
if (zd->xfr_in.timer) {
evsched_cancel(sch, zd->xfr_in.timer);
evsched_schedule(sch, zd->xfr_in.timer,
tls_rand() * 1000);
knot_random_uint32_t() % 1000);
}
return KNOT_EOK;
......@@ -159,7 +159,7 @@ static int remote_zone_flush(server_t *s, const knot_zone_t *z)
if (zd->ixfr_dbsync) {
evsched_cancel(sch, zd->ixfr_dbsync);
evsched_schedule(sch, zd->ixfr_dbsync,
tls_rand() * 1000);
knot_random_uint32_t() % 1000);
}
return KNOT_EOK;
......@@ -715,7 +715,7 @@ knot_pkt_t* remote_query(const char *query, const knot_tsig_key_t *key)
return NULL;
}
knot_wire_set_id(pkt->wire, knot_random_id());
knot_wire_set_id(pkt->wire, knot_random_uint16_t());
knot_pkt_tsig_set(pkt, key);
/* Question section. */
......
......@@ -43,11 +43,9 @@
#define KNOTD_NOTIFY_DEBUG
#endif
#ifdef KNOT_COMPILER_DEBUG
#define KNOTD_ZDUMP_DEBUG
#ifdef KNOT_LOADER_DEBUG
#define KNOTD_ZLOAD_DEBUG
#define KNOTD_SEMCHECK_DEBUG
#define KNOTD_COMPILE_DEBUG
#endif
#include "common/log.h"
......@@ -390,50 +388,6 @@
/******************************************************************************/
#ifdef KNOTD_ZDUMP_DEBUG
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
#define dbg_zdump(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
#define dbg_zdump_hex(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_zdump(msg...)
#define dbg_zdump_hex(data, len)
#endif
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
#define dbg_zdump_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
#define dbg_zdump_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_zdump_verb(msg...)
#define dbg_zdump_hex_verb(data, len)
#endif
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
#define dbg_zdump_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
#define dbg_zdump_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_zdump_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_zdump_detail(msg...)
#define dbg_zdump_hex_detail(data, len)
#define dbg_zdump_exec_detail(cmds)
#endif
/* No messages. */
#else
#define dbg_zdump(msg...)
#define dbg_zdump_hex(data, len)
#define dbg_zdump_verb(msg...)
#define dbg_zdump_hex_verb(data, len)
#define dbg_zdump_detail(msg...)
#define dbg_zdump_hex_detail(data, len)
#define dbg_zdump_exec_detail(cmds)
#endif
/******************************************************************************/
#ifdef KNOTD_ZLOAD_DEBUG
/* Brief messages. */
......@@ -476,47 +430,7 @@
#define dbg_zload_exec_detail(cmds)
#endif
#ifdef KNOTD_COMPILE_DEBUG
/* Brief messages. */
#ifdef DEBUG_ENABLE_BRIEF
#define dbg_zp(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
#define dbg_zp_hex(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_zp(msg...)
#define dbg_zp_hex(data, len)
#endif
/* Verbose messages. */
#ifdef DEBUG_ENABLE_VERBOSE
#define dbg_zp_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
#define dbg_zp_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len))
#else
#define dbg_zp_verb(msg...)
#define dbg_zp_hex_verb(data, len)
#endif
/* Detail messages. */
#ifdef DEBUG_ENABLE_DETAILS
#define dbg_zp_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg)
#define dbg_zp_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len))
#define dbg_zp_exec_detail(cmds) do { cmds } while (0)
#else
#define dbg_zp_detail(msg...)
#define dbg_zp_hex_detail(data, len)
#define dbg_zp_exec_detail(cmds)
#endif
/* No messages. */
#else
#define dbg_zp(msg...)
#define dbg_zp_hex(data, len)
#define dbg_zp_verb(msg...)
#define dbg_zp_hex_verb(data, len)
#define dbg_zp_detail(msg...)
#define dbg_zp_hex_detail(data, len)
#define dbg_zp_exec_detail(cmds)
#endif
/******************************************************************************/
#ifdef KNOTD_SEMCHECK_DEBUG
......
......@@ -36,6 +36,7 @@
#include "libknot/nameserver/internet.h"
#include "libknot/util/debug.h"
#include "libknot/nameserver/ns_proc_query.h"
#include "libknot/dnssec/random.h"
/* Messages. */
......@@ -53,7 +54,7 @@ static int notify_request(const knot_rrset_t *rrset,
CHECK_ALLOC_LOG(pkt, KNOT_ENOMEM);
knot_pkt_clear(pkt);
knot_wire_set_id(pkt->wire, knot_random_id());
knot_wire_set_id(pkt->wire, knot_random_uint16_t());
knot_wire_set_aa(pkt->wire);
knot_wire_set_opcode(pkt->wire, KNOT_OPCODE_NOTIFY);
......