Commit e913a5f7 authored by Marek Vavruša's avatar Marek Vavruša

Merge branch 'master' into zone-events-queue

Conflicts:
	src/knot/dnssec/zone-sign.c
	src/knot/nameserver/axfr.c
	src/knot/nameserver/internet.c
	src/knot/nameserver/notify.c
	src/knot/nameserver/nsec_proofs.c
	src/knot/server/xfr-handler.c
	src/knot/server/zone-load.c
	src/knot/server/zones.c
	src/knot/updates/ddns.c
	src/knot/updates/xfr-in.c
	src/knot/zone/contents.c
	src/knot/zone/contents.h
	src/knot/zone/semantic-check.c
	src/knot/zone/semantic-check.h
	src/knot/zone/zone-diff.c
	src/knot/zone/zonefile.c
	tests/process_query.c
parents decdc3a2 76b3dbcc
......@@ -73,3 +73,7 @@
*.gcno
/*-coverage.info
/*coverage/
# alternative allocators
/src/allocator.h
/src/allocators/
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libtap src tests samples doc man patches
AM_DISTCHECK_CONFIGURE_FLAGS = \
--without-ragel \
--disable-code-coverage
code_coverage_quiet = --quiet
check-code-coverage:
......@@ -70,6 +74,4 @@ code-coverage-clean:
-find . -name "*.gcda" -o -name "*.gcov" -delete
endif
DISTCHECK_CONFIGURE_FLAGS = --disable-code-coverage
.PHONY: check-code-coverage code-coverage-initial code-coverage-capture code-coverage-html code-coverage-clean
......@@ -65,7 +65,17 @@ AS_IF([test "x$YACC_BISON" != "xbison"],
AC_PROG_INSTALL
# Check for Ragel
AC_PATH_PROG([RAGEL], [ragel], [false])
AC_ARG_WITH([ragel],
AC_HELP_STRING([--with-ragel=path], [Path to Ragel binary. [default=auto]]),
[with_ragel=$withval],
[with_ragel=auto])
AS_CASE([$with_ragel],
[yes|auto], [AC_PATH_PROG([RAGEL], [ragel], [false])],
[no], [RAGEL=false],
[*], [RAGEL=$with_ragel],
)
AM_CONDITIONAL([HAVE_RAGEL], test "$RAGEL" != "false")
# Set FSM type for Ragel
......@@ -391,5 +401,6 @@ echo "
Ragel: ${RAGEL} ${FSM_TYPE}
Utils with IDN: ${libidn}
Use systemd notifications: ${enable_systemd}
Code coverage: ${enable_code_coverage}
Continue with 'make' command"
......@@ -10,5 +10,6 @@ knot_TEXINFOS = \
requirements.texi \
running.texi \
security.texi \
synth_record.texi \
troubleshooting.texi \
version.texi
......@@ -37,7 +37,7 @@ Knot DNS requires few libraries to be compiled:
@itemize
@item
OpenSSL, at least 0.9.8
OpenSSL, at least 1.0.0 (1.0.1 is required for ECDSA)
@item
zlib
@item
......
......@@ -17,7 +17,6 @@ Parameters:
-c, --config <file> Select configuration file.
-d, --daemonize=[dir] Run server as a daemon. Working directory may
be set.
-v, --verbose Verbose mode - additional runtime information.
-V, --version Print version of the server.
-h, --help Print help and usage.
@end example
......
......@@ -16,8 +16,9 @@ AC_DEFUN([AX_CODE_COVERAGE], [
dnl Check for --enable-code-coverage
AC_ARG_ENABLE([code-coverage],
AS_HELP_STRING([--enable-code-coverage], [enable code coverage testing with gcov]),
[enable_code_coverage=yes],
[enable_code_coverage=no])
[enable_code_coverage=$enableval],
[enable_code_coverage=no]
)
AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test "$enable_code_coverage" = "yes"])
AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
......
......@@ -14,9 +14,6 @@ Select configuration file.
\fB\-d\fR, \fB\-\-daemonize\fR=[\fIdir\fR]
Run server as a daemon. Working directory may be set.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose mode \- additional runtime information.
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version of the server.
.TP
......
......@@ -129,7 +129,7 @@ libknotus_la_SOURCES = \
# dynamic: libknot
libknot_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS) \
$(AM_LDFLAGS) \
-version-info 0:1:0 \
-export-symbols-regex '^(knot|KNOT|rrset|tsig|zone)_'
......@@ -313,7 +313,7 @@ libknotd_la_LIBADD = libknots.la libknot.la
# sbin programs
knotd_LDADD = libknot.la libknotd.la
knotd_CPPFLAGS = $(AM_CPPFLAGS) ${systemd_daemon_CFLAGS}
knotd_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) ${systemd_daemon_LIBS}
knotd_LDFLAGS = $(AM_LDFLAGS) ${systemd_daemon_LIBS}
knotc_LDADD = libknot.la libknotd.la
......
......@@ -122,7 +122,7 @@ static int cmd_remote_print_reply(const knot_rrset_t *rr)
return KNOT_EMALF;
}
uint16_t rr_count = knot_rrset_rr_count(rr);
uint16_t rr_count = rr->rrs.rr_count;
for (uint16_t i = 0; i < rr_count; i++) {
/* Parse TXT. */
remote_print_txt(rr, i);
......@@ -716,7 +716,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
/* Zone checking */
int rc = 0;
size_t total_size = 0;
double total_size = 0;
/* Generate databases for all zones */
const bool sorted = false;
......@@ -755,9 +755,9 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
/* Init memory estimation context. */
zone_estim_t est = {.node_table = hattrie_create_n(TRIE_BUCKET_SIZE, &mem_ctx),
.dname_size = 0, .rrset_size = 0,
.node_size = 0, .ahtable_size = 0,
.rdata_size = 0, .record_count = 0 };
.dname_size = 0, .node_size = 0,
.htable_size = 0, .rdata_size = 0,
.record_count = 0 };
if (est.node_table == NULL) {
log_server_error("Not enough memory.\n");
continue;
......@@ -772,9 +772,8 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
if (loader == NULL) {
rc = 1;
log_zone_error("Could not load zone %s\n", zone->name);
hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
hattrie_free(est.node_table);
break;
continue;
}
/* Do a parser run, but do not actually create the zone. */
......@@ -785,26 +784,25 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
hattrie_free(est.node_table);
zs_loader_free(loader);
break;
continue;
}
/* Only size of ahtables inside trie's nodes is missing. */
assert(est.ahtable_size == 0);
est.ahtable_size = estimator_trie_ahtable_memsize(est.node_table);
assert(est.htable_size == 0);
est.htable_size = estimator_trie_htable_memsize(est.node_table);
/* Cleanup */
hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
hattrie_free(est.node_table);
size_t zone_size = (size_t)(((double)(est.rdata_size +
double zone_size = ((double)(est.rdata_size +
est.node_size +
est.rrset_size +
est.dname_size +
est.ahtable_size +
malloc_size) * ESTIMATE_MAGIC) / (1024.0 * 1024.0));
est.htable_size +
malloc_size) * ESTIMATE_MAGIC) / (1024.0 * 1024.0);
log_zone_info("Zone %s: %zu RRs, used memory estimation is %zuMB.\n",
zone->name, est.record_count, zone_size);
zone->name, est.record_count, (size_t)zone_size);
zs_loader_free(loader);
total_size += zone_size;
conf_free_zone(zone);
......@@ -812,7 +810,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
hattrie_iter_free(z_iter);
if (rc == 0 && argc == 0) { // for all zones
log_zone_info("Estimated memory consumption for all zones is %zuMB.\n", total_size);
log_zone_info("Estimated memory consumption for all zones is %zuMB.\n", (size_t)total_size);
}
return rc;
......
......@@ -98,7 +98,7 @@ static int remote_rdata_apply(server_t *s, remote_cmdargs_t* a, remote_zonef_t *
continue;
}
uint16_t rr_count = knot_rrset_rr_count(rr);
uint16_t rr_count = rr->rrs.rr_count;
for (uint16_t i = 0; i < rr_count; i++) {
const knot_dname_t *dn = knot_ns_name(&rr->rrs, i);
rcu_read_lock();
......@@ -246,7 +246,7 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t* a)
const knot_rdataset_t *soa_rrs = NULL;
uint32_t serial = 0;
if (zone->contents) {
soa_rrs = knot_node_rdataset(zone->contents->apex,
soa_rrs = node_rdataset(zone->contents->apex,
KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
serial = knot_soa_serial(soa_rrs);
......@@ -548,7 +548,7 @@ static void log_command(const char *cmd, const remote_cmdargs_t* args)
continue;
}
uint16_t rr_count = knot_rrset_rr_count(rr);
uint16_t rr_count = rr->rrs.rr_count;
for (uint16_t j = 0; j < rr_count; j++) {
const knot_dname_t *dn = knot_ns_name(&rr->rrs, j);
char *name = knot_dname_to_str(dn);
......@@ -966,7 +966,7 @@ int remote_create_ns(knot_rrset_t *rr, const char *d)
int remote_print_txt(const knot_rrset_t *rr, uint16_t i)
{
if (!rr || knot_rrset_rr_count(rr) < 1) {
if (!rr || rr->rrs.rr_count < 1) {
return -1;
}
......
......@@ -34,8 +34,8 @@
*
* \return NSEC RR set, NULL on error.
*/
static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
const knot_node_t *to,
static knot_rrset_t *create_nsec_rrset(const zone_node_t *from,
const zone_node_t *to,
uint32_t ttl)
{
assert(from);
......@@ -51,7 +51,7 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
bitmap_add_node_rrsets(&rr_types, from);
bitmap_add_type(&rr_types, KNOT_RRTYPE_NSEC);
bitmap_add_type(&rr_types, KNOT_RRTYPE_RRSIG);
if (knot_node_rrtype_exists(from, KNOT_RRTYPE_SOA)) {
if (node_rrtype_exists(from, KNOT_RRTYPE_SOA)) {
bitmap_add_type(&rr_types, KNOT_RRTYPE_DNSKEY);
}
......@@ -86,14 +86,14 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
*
* \return Error code, KNOT_EOK if successful.
*/
static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
nsec_chain_iterate_data_t *data)
{
assert(a);
assert(b);
assert(data);
if (b->rrset_count == 0 || knot_node_is_non_auth(b)) {
if (b->rrset_count == 0 || b->flags & NODE_FLAGS_NONAUTH) {
return NSEC_NODE_SKIP;
}
......@@ -103,7 +103,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
* If the node has no other RRSets than NSEC (and possibly RRSIGs),
* just remove the NSEC and its RRSIG, they are redundant
*/
if (knot_node_rrtype_exists(b, KNOT_RRTYPE_NSEC)
if (node_rrtype_exists(b, KNOT_RRTYPE_NSEC)
&& knot_nsec_empty_nsec_and_rrsigs_in_node(b)) {
ret = knot_nsec_changeset_remove(b, data->changeset);
if (ret != KNOT_EOK) {
......@@ -120,7 +120,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
return KNOT_ENOMEM;
}
knot_rrset_t old_nsec = knot_node_rrset(a, KNOT_RRTYPE_NSEC);
knot_rrset_t old_nsec = node_rrset(a, KNOT_RRTYPE_NSEC);
if (!knot_rrset_empty(&old_nsec)) {
if (knot_rrset_equal(new_nsec, &old_nsec,
KNOT_RRSET_COMPARE_WHOLE)) {
......@@ -132,7 +132,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
dbg_dnssec_detail("NSECs not equal, replacing.\n");
// Mark the node so that we do not sign this NSEC
knot_node_set_removed_nsec(a);
a->flags |= NODE_FLAGS_REMOVED_NSEC;
ret = knot_nsec_changeset_remove(a, data->changeset);
if (ret != KNOT_EOK) {
knot_rrset_free(&new_nsec, NULL);
......@@ -170,15 +170,15 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
return KNOT_EINVAL;
}
knot_node_t *first = (knot_node_t *)*hattrie_iter_val(it);
knot_node_t *previous = first;
knot_node_t *current = first;
zone_node_t *first = (zone_node_t *)*hattrie_iter_val(it);
zone_node_t *previous = first;
zone_node_t *current = first;
hattrie_iter_next(it);
int result = KNOT_EOK;
while (!hattrie_iter_finished(it)) {
current = (knot_node_t *)*hattrie_iter_val(it);
current = (zone_node_t *)*hattrie_iter_val(it);
result = callback(previous, current, data);
if (result == NSEC_NODE_SKIP) {
......@@ -204,7 +204,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
/*!
* \brief Add entry for removed NSEC to the changeset.
*/
int knot_nsec_changeset_remove(const knot_node_t *n,
int knot_nsec_changeset_remove(const zone_node_t *n,
knot_changeset_t *changeset)
{
if (changeset == NULL) {
......@@ -213,9 +213,9 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
int result = KNOT_EOK;
knot_rrset_t *nsec = knot_node_create_rrset(n, KNOT_RRTYPE_NSEC);
knot_rrset_t *nsec = node_create_rrset(n, KNOT_RRTYPE_NSEC);
if (nsec == NULL) {
nsec = knot_node_create_rrset(n, KNOT_RRTYPE_NSEC3);
nsec = node_create_rrset(n, KNOT_RRTYPE_NSEC3);
}
if (nsec) {
// update changeset
......@@ -227,7 +227,7 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
}
}
knot_rrset_t rrsigs = knot_node_rrset(n, KNOT_RRTYPE_RRSIG);
knot_rrset_t rrsigs = node_rrset(n, KNOT_RRTYPE_RRSIG);
if (!knot_rrset_empty(&rrsigs)) {
knot_rrset_t *synth_rrsigs = knot_rrset_new(n->owner,
KNOT_RRTYPE_RRSIG,
......@@ -268,11 +268,11 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
* \brief Checks whether the node is empty or eventually contains only NSEC and
* RRSIGs.
*/
bool knot_nsec_empty_nsec_and_rrsigs_in_node(const knot_node_t *n)
bool knot_nsec_empty_nsec_and_rrsigs_in_node(const zone_node_t *n)
{
assert(n);
for (int i = 0; i < n->rrset_count; ++i) {
knot_rrset_t rrset = knot_node_rrset_at(n, i);
knot_rrset_t rrset = node_rrset_at(n, i);
if (rrset.type != KNOT_RRTYPE_NSEC &&
rrset.type != KNOT_RRTYPE_RRSIG) {
return false;
......
......@@ -53,17 +53,17 @@ enum {
/*!
* \brief Callback used when creating NSEC chains.
*/
typedef int (*chain_iterate_create_cb)(knot_node_t *, knot_node_t *,
typedef int (*chain_iterate_create_cb)(zone_node_t *, zone_node_t *,
nsec_chain_iterate_data_t *);
/*!
* \brief Add all RR types from a node into the bitmap.
*/
inline static void bitmap_add_node_rrsets(bitmap_t *bitmap,
const knot_node_t *node)
const zone_node_t *node)
{
for (int i = 0; i < node->rrset_count; i++) {
knot_rrset_t rr = knot_node_rrset_at(node, i);
knot_rrset_t rr = node_rrset_at(node, i);
if (rr.type != KNOT_RRTYPE_NSEC &&
rr.type != KNOT_RRTYPE_RRSIG) {
bitmap_add_type(bitmap, rr.type);
......@@ -95,7 +95,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_nsec_changeset_remove(const knot_node_t *n,
int knot_nsec_changeset_remove(const zone_node_t *n,
knot_changeset_t *changeset);
/*!
......@@ -107,7 +107,7 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
* \retval true if the node is empty or contains only NSEC and RRSIGs.
* \retval false otherwise.
*/
bool knot_nsec_empty_nsec_and_rrsigs_in_node(const knot_node_t *n);
bool knot_nsec_empty_nsec_and_rrsigs_in_node(const zone_node_t *n);
/*!
* \brief Create new NSEC chain, add differences from current into a changeset.
......
......@@ -44,7 +44,7 @@ static int create_nsec3_rrset(knot_rrset_t *rrset,
/*!
* \brief Perform some basic checks that the node is a valid NSEC3 node.
*/
inline static bool valid_nsec3_node(const knot_node_t *node)
inline static bool valid_nsec3_node(const zone_node_t *node)
{
assert(node);
......@@ -52,7 +52,7 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
return false;
}
const knot_rdataset_t *nsec3 = knot_node_rdataset(node, KNOT_RRTYPE_NSEC3);
const knot_rdataset_t *nsec3 = node_rdataset(node, KNOT_RRTYPE_NSEC3);
if (nsec3 == NULL) {
return false;
}
......@@ -67,14 +67,14 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
/*!
* \brief Check if two nodes are equal.
*/
static bool are_nsec3_nodes_equal(const knot_node_t *a, const knot_node_t *b)
static bool are_nsec3_nodes_equal(const zone_node_t *a, const zone_node_t *b)
{
if (!(valid_nsec3_node(a) && valid_nsec3_node(b))) {
return false;
}
knot_rrset_t a_rrset = knot_node_rrset(a, KNOT_RRTYPE_NSEC3);
knot_rrset_t b_rrset = knot_node_rrset(b, KNOT_RRTYPE_NSEC3);
knot_rrset_t a_rrset = node_rrset(a, KNOT_RRTYPE_NSEC3);
knot_rrset_t b_rrset = node_rrset(b, KNOT_RRTYPE_NSEC3);
return knot_rrset_equal(&a_rrset, &b_rrset, KNOT_RRSET_COMPARE_WHOLE);
}
......@@ -86,10 +86,10 @@ static bool are_nsec3_nodes_equal(const knot_node_t *a, const knot_node_t *b)
*
* \return true/false.
*/
static bool node_should_be_signed_nsec3(const knot_node_t *n)
static bool node_should_be_signed_nsec3(const zone_node_t *n)
{
for (int i = 0; i < n->rrset_count; i++) {
knot_rrset_t rrset = knot_node_rrset_at(n, i);
knot_rrset_t rrset = node_rrset_at(n, i);
if (rrset.type == KNOT_RRTYPE_NSEC ||
rrset.type == KNOT_RRTYPE_RRSIG) {
continue;
......@@ -112,16 +112,16 @@ static bool node_should_be_signed_nsec3(const knot_node_t *n)
* \brief Shallow copy NSEC3 signatures from the one node to the second one.
* Just sets the pointer, needed only for comparison.
*/
static int shallow_copy_signature(const knot_node_t *from, knot_node_t *to)
static int shallow_copy_signature(const zone_node_t *from, zone_node_t *to)
{
assert(valid_nsec3_node(from));
assert(valid_nsec3_node(to));
knot_rrset_t from_sig = knot_node_rrset(from, KNOT_RRTYPE_RRSIG);
knot_rrset_t from_sig = node_rrset(from, KNOT_RRTYPE_RRSIG);
if (knot_rrset_empty(&from_sig)) {
return KNOT_EOK;
}
return knot_node_add_rrset(to, &from_sig, NULL);
return node_add_rrset(to, &from_sig, NULL);
}
/*!
......@@ -139,8 +139,8 @@ static int copy_signatures(const knot_zone_tree_t *from, knot_zone_tree_t *to)
hattrie_iter_t *it = hattrie_iter_begin(from, sorted);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
knot_node_t *node_from = (knot_node_t *)*hattrie_iter_val(it);
knot_node_t *node_to = NULL;
zone_node_t *node_from = (zone_node_t *)*hattrie_iter_val(it);
zone_node_t *node_to = NULL;
knot_zone_tree_get(to, node_from->owner, &node_to);
if (node_to == NULL) {
......@@ -173,13 +173,13 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes)
bool sorted = false;
hattrie_iter_t *it = hattrie_iter_begin(nodes, sorted);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
knot_node_t *node = (knot_node_t *)*hattrie_iter_val(it);
zone_node_t *node = (zone_node_t *)*hattrie_iter_val(it);
// newly allocated NSEC3 nodes
knot_rdataset_t *nsec3 = knot_node_get_rdataset(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = knot_node_get_rdataset(node, KNOT_RRTYPE_RRSIG);
knot_rdataset_t *nsec3 = node_rdataset(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = node_rdataset(node, KNOT_RRTYPE_RRSIG);
knot_rdataset_clear(nsec3, NULL);
knot_rdataset_clear(rrsig, NULL);
knot_node_free(&node);
node_free(&node);
}
hattrie_iter_free(it);
......@@ -272,9 +272,9 @@ static int create_nsec3_rrset(knot_rrset_t *rrset,
/*!
* \brief Create NSEC3 node.
*/
static knot_node_t *create_nsec3_node(knot_dname_t *owner,
static zone_node_t *create_nsec3_node(knot_dname_t *owner,
const knot_nsec3_params_t *nsec3_params,
knot_node_t *apex_node,
zone_node_t *apex_node,
const bitmap_t *rr_types,
uint32_t ttl)
{
......@@ -283,24 +283,25 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner,
assert(apex_node);
assert(rr_types);
uint8_t flags = 0;
knot_node_t *new_node = knot_node_new(owner, apex_node, flags);
zone_node_t *new_node = node_new(owner);
if (!new_node) {
return NULL;
}
node_set_parent(new_node, apex_node);
knot_rrset_t nsec3_rrset;
int ret = create_nsec3_rrset(&nsec3_rrset, owner, nsec3_params,
rr_types, NULL, ttl);
if (ret != KNOT_EOK) {
knot_node_free(&new_node);
node_free(&new_node);
return NULL;
}
ret = knot_node_add_rrset(new_node, &nsec3_rrset, NULL);
ret = node_add_rrset(new_node, &nsec3_rrset, NULL);
knot_rrset_clear(&nsec3_rrset, NULL);
if (ret != KNOT_EOK) {
knot_node_free(&new_node);
node_free(&new_node);
return NULL;
}
......@@ -317,8 +318,8 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner,
*
* \return Error code, KNOT_EOK if successful.
*/
static knot_node_t *create_nsec3_node_for_node(knot_node_t *node,
knot_node_t *apex,
static zone_node_t *create_nsec3_node_for_node(zone_node_t *node,
zone_node_t *apex,
const knot_nsec3_params_t *params,
uint32_t ttl)
{
......@@ -341,7 +342,7 @@ static knot_node_t *create_nsec3_node_for_node(knot_node_t *node,
bitmap_add_type(&rr_types, KNOT_RRTYPE_DNSKEY);
}
knot_node_t *nsec3_node;
zone_node_t *nsec3_node;
nsec3_node = create_nsec3_node(nsec3_owner, params, apex, &rr_types, ttl);
return nsec3_node;
......@@ -358,7 +359,7 @@ static knot_node_t *create_nsec3_node_for_node(knot_node_t *node,
*
* \return Error code, KNOT_EOK if successful.
*/
static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b,
static int connect_nsec3_nodes(zone_node_t *a, zone_node_t *b,
nsec_chain_iterate_data_t *data)
{
assert(a);
......@@ -367,7 +368,7 @@ static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b,
assert(a->rrset_count == 1);
knot_rdataset_t *a_rrs = knot_node_get_rdataset(a, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *a_rrs = node_rdataset(a, KNOT_RRTYPE_NSEC3);
assert(a_rrs);
uint8_t algorithm = knot_nsec3_algorithm(a_rrs, 0);
if (algorithm == 0) {
......@@ -429,7 +430,7 @@ static int create_nsec3_nodes(const zone_contents_t *zone, uint32_t ttl,
int sorted = false;
hattrie_iter_t *it = hattrie_iter_begin(zone->nodes, sorted);
while (!hattrie_iter_finished(it)) {
knot_node_t *node = (knot_node_t *)*hattrie_iter_val(it);
zone_node_t *node = (zone_node_t *)*hattrie_iter_val(it);
/*!
* Remove possible NSEC from the node. (Do not allow both NSEC
......@@ -439,15 +440,15 @@ static int create_nsec3_nodes(const zone_contents_t *zone, uint32_t ttl,
if (result != KNOT_EOK) {
break;
}
if (knot_node_rrtype_exists(node, KNOT_RRTYPE_NSEC)) {
knot_node_set_removed_nsec(node);
if (node_rrtype_exists(node, KNOT_RRTYPE_NSEC)) {
node->flags |= NODE_FLAGS_REMOVED_NSEC;
}
if (knot_node_is_non_auth(node) || knot_node_is_empty(node)) {
if (node->flags & NODE_FLAGS_NONAUTH || node->flags & NODE_FLAGS_EMPTY) {
hattrie_iter_next(it);
continue;
}
knot_node_t *nsec3_node;
zone_node_t *nsec3_node;
nsec3_node = create_nsec3_node_for_node(node, zone->apex,
params, ttl);
if (!nsec3_node) {
......@@ -478,9 +479,9 @@ static int create_nsec3_nodes(const zone_contents_t *zone, uint32_t ttl,
* RRSIGs and NSECs.
* \retval false otherwise.
*/
static bool nsec3_is_empty(knot_node_t *node)
static bool nsec3_is_empty(zone_node_t *node)
{
if (knot_node_children(node) > 0) {
if (node->children > 0) {
return false;
}
......@@ -494,17 +495,17 @@ static bool nsec3_is_empty(knot_node_t *node)
* It also lowers the children count for the parent of marked node. This must be
* fixed before further operations on the zone.
*/
static int nsec3_mark_empty(knot_node_t **node_p, void *data)
static int nsec3_mark_empty(zone_node_t **node_p, void *data)
{
UNUSED(data);
knot_node_t *node = *node_p;
zone_node_t *node = *node_p;
if (!knot_node_is_empty(node) && nsec3_is_empty(node)) {
if (!(node->flags & NODE_FLAGS_EMPTY) && nsec3_is_empty(node)) {
/*!
* Mark this node and all parent nodes that meet the same
* criteria as empty.
*/
knot_node_set_empty(node);
node->flags |= NODE_FLAGS_EMPTY;
if (node->parent) {
/* We must decrease the parent's children count,
......@@ -543,18 +544,18 @@ static void mark_empty_nodes_tmp(const zone_contents_t *zone)
* The children count of node's parent is increased if this node was marked as
* empty, as it was previously decreased in the \a nsec3_mark_empty() function.
*/
static int nsec3_reset(knot_node_t **node_p, void *data)
static int nsec3_reset(zone_node_t **node_p, void *data)
{
UNUSED(data);
knot_node_t *node = *node_p;
zone_node_t *node = *node_p;
if (knot_node_is_empty(node)) {
if (node->flags & NODE_FLAGS_EMPTY) {
/* If node was marked as empty, increase its parent's children
* count.
*/
node->parent->children++;
/* Clear the 'empty' flag. */
knot_node_clear_empty(node);
node->flags &= ~NODE_FLAGS_EMPTY;
}
return KNOT_EOK;
......
......@@ -129,8 +129,8 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
}
// update SOA if there were any changes
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
assert(!knot_rrset_empty(&soa));
result = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch);
......@@ -240,8 +240,8 @@ int knot_dnssec_sign_changeset(const zone_contents_t *zone,
}
// Update SOA RRSIGs
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
ret = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch);
if (ret != KNOT_EOK) {
......
......@@ -92,8 +92,8 @@ static bool get_zone_soa_min_ttl(const zone_contents_t *zone,
assert(zone->apex);
assert(ttl);
knot_node_t *apex = zone->apex;
const knot_rdataset_t *soa = knot_node_rdataset(apex, KNOT_RRTYPE_SOA);
zone_node_t *apex = zone->apex;
const knot_rdataset_t *soa = node_rdataset(apex, KNOT_RRTYPE_SOA);
if (!soa) {
return false;
}
......@@ -124,7 +124,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
assert(data != NULL);
knot_zone_tree_t *nsec3s = (knot_zone_tree_t *)data;
knot_node_t *node = NULL;
zone_node_t *node = NULL;
int ret;
if (rrset->type == KNOT_RRTYPE_NSEC3) {
......@@ -136,7 +136,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
}
if (node != NULL) {
knot_node_set_removed_nsec(node);
node->flags |= NODE_FLAGS_REMOVED_NSEC;
}
}
......
......@@ -78,7 +78,7 @@ static bool valid_signature_exists(const knot_rrset_t *covered,