Commit 850b0f58 authored by Jan Kadlec's avatar Jan Kadlec

Merge remote-tracking branch 'origin/master' into changeset-refactor

Conflicts:
	Knot.files
	src/knot/nameserver/update.c
	src/knot/zone/zone-load.c
	src/knot/zone/zone.c
	src/knot/zone/zone.h
parents 3e41a980 a89efd15
......@@ -8,6 +8,6 @@ before_install:
before_script:
- autoreconf -fi
script:
- ./configure --disable-fastparser --enable-code-coverage && make && make -k check
- ./configure --disable-fastparser --disable-shared --enable-static --enable-code-coverage && make && make -k check
after_success:
- coveralls --exclude tests/ --extension .c --extension .h --build-root ./src/
- coveralls --exclude tests/ --exclude src/cf-lex.l --exclude src/cf-parse.y --exclude ./src/utils/ --exclude ./src/libtap --exclude ./src/zscanner --build-root ./src/
\ No newline at end of file
......@@ -5,4 +5,3 @@ Here is a list of the most notable features that are not supported in the
current version of Knot.
* Other DNS classes than IN, partially CH (CS, HS)
* UPDATE message forwarding (RFC2136) not implemented
......@@ -121,6 +121,8 @@ src/knot/modules/synth_record.c
src/knot/modules/synth_record.h
src/knot/nameserver/axfr.c
src/knot/nameserver/axfr.h
src/knot/nameserver/capture.c
src/knot/nameserver/capture.h
src/knot/nameserver/chaos.c
src/knot/nameserver/chaos.h
src/knot/nameserver/internet.c
......@@ -302,6 +304,7 @@ tests/Makefile.am
tests/acl.c
tests/base32hex.c
tests/base64.c
tests/changeset.c
tests/conf.c
tests/descriptor.c
tests/dname.c
......@@ -335,4 +338,3 @@ tests/worker_queue.c
tests/zone_events.c
tests/zonedb.c
tests/ztree.c
tests/changeset.c
Knot DNS NEWS
1.5.0 - Jul 8, 2014
-----------------------
Features:
* DDNS forwarding reimplemented
Improvements:
* Transfer sizes logged in bytes if needed
* Logging outgoing NOTIFY messages
* Logging unauthorized incoming NOTIFYs
Bugfixes:
* Zone flush planning after bootstrap
* Incorrect incoming AXFR message sizes
* DDNS signing changes were freed too soon, posibility of stale data
* knotc remote control key handling
1.5.0-rc2 - Jun 18, 2014
-----------------------
......
# -*- Autoconf -*-
AC_PREREQ([2.60])
AC_INIT([knot], [1.5.0-rc2], [knot-dns@labs.nic.cz])
AC_INIT([knot], [1.5.0], [knot-dns@labs.nic.cz])
AM_INIT_AUTOMAKE([gnits subdir-objects dist-xz -Wall -Werror])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/knot/main.c])
......
......@@ -9,7 +9,7 @@ EXTRA_DIST = \
running.rst \
troubleshooting.rst \
\
logo.pdf \
logo.eps \
logo.png
SPHINXBUILDDIR = _build
......
......@@ -195,7 +195,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = 'logo.pdf'
latex_logo = 'logo.eps'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
......
This diff is collapsed.
......@@ -43,4 +43,4 @@ Supported operating system
Knot DNS itself is written in a portable way, but it depends on
several libraries. Namely userspace-rcu, which could be a constraint
when it comes to the operating system support. Knot DNS can be compiled
and run on most of UNIX-like systems, such as Linux, *BSD and Mac OS X.
and run on most of UNIX-like systems, such as Linux, \*BSD and Mac OS X.
......@@ -11,8 +11,7 @@ AM_CPPFLAGS = \
-include $(top_builddir)/src/config.h \
-DCONFIG_DIR='"${config_dir}"' \
-DSTORAGE_DIR='"${storage_dir}"' \
-DRUN_DIR='"${run_dir}"' \
$(libidn_CFLAGS)
-DRUN_DIR='"${run_dir}"'
AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
AM_YFLAGS = -d
......@@ -210,6 +209,8 @@ libknotd_la_SOURCES = \
knot/conf/extra.h \
knot/conf/includes.c \
knot/conf/includes.h \
knot/ctl/estimator.c \
knot/ctl/estimator.h \
knot/ctl/process.c \
knot/ctl/process.h \
knot/ctl/remote.c \
......@@ -231,6 +232,8 @@ libknotd_la_SOURCES = \
knot/nameserver/axfr.h \
knot/nameserver/chaos.c \
knot/nameserver/chaos.h \
knot/nameserver/capture.c \
knot/nameserver/capture.h \
knot/nameserver/internet.c \
knot/nameserver/internet.h \
knot/nameserver/ixfr.c \
......@@ -284,8 +287,6 @@ libknotd_la_SOURCES = \
knot/worker/queue.h \
knot/zone/contents.c \
knot/zone/contents.h \
knot/zone/estimator.c \
knot/zone/estimator.h \
knot/zone/events.c \
knot/zone/events.h \
knot/zone/node.c \
......@@ -313,6 +314,7 @@ libknotd_la_SOURCES = \
libknot_la_LIBADD = libknots.la zscanner/libzscanner.la
libknotd_la_LIBADD = libknots.la libknot.la
libknotus_la_LDFLAGS = $(libidn_LIBS)
libknotus_la_CFLAGS = $(libidn_CFLAGS)
# sbin programs
knotd_LDADD = libknot.la libknotd.la
......
......@@ -169,7 +169,7 @@ critical { lval.t = yytext; lval.i = LOG_UPTO(LOG_CRIT); return LOG_LEVEL; }
all {
lval.t = yytext;
lval.i = LOG_UPTO(LOG_INFO);
fprintf(stderr, "Warning: log severity 'all'' is no longer "
fprintf(stderr, "Warning: log severity 'all' is no longer "
"supported. Using 'info' instead.\n");
return LOG_LEVEL;
}
......
......@@ -369,7 +369,7 @@ static void conf_zone_start(void *scanner, char *name) {
// Convert zone name to lower-case.
for (size_t i = 0; this_zone->name[i]; i++) {
this_zone->name[i] = tolower(this_zone->name[i]);
this_zone->name[i] = tolower((unsigned char)this_zone->name[i]);
}
/* Check domain name. */
......
......@@ -16,7 +16,7 @@
#include <assert.h>
#include "knot/zone/estimator.h"
#include "knot/ctl/estimator.h"
#include "libknot/dname.h"
#include "common/lists.h"
#include "knot/zone/node.h"
......
......@@ -34,7 +34,7 @@
#include "knot/zone/zone-load.h"
#include "knot/server/tcp-handler.h"
#include "libknot/packet/wire.h"
#include "knot/zone/estimator.h"
#include "knot/ctl/estimator.h"
/*! \brief Controller flags. */
enum knotc_flag_t {
......@@ -310,7 +310,7 @@ static int tsig_parse_str(knot_tsig_key_t *key, const char *str)
if (s) {
*s++ = '\0'; /* Last part separator */
knot_lookup_table_t *alg = NULL;
alg = knot_lookup_by_name(knot_tsig_alg_dnames_str, h);
alg = knot_lookup_by_name(knot_tsig_alg_names, h);
if (alg) {
algorithm = alg->id;
} else {
......
......@@ -461,7 +461,8 @@ int remote_poll(int sock)
return fdset_pselect(sock + 1, &rfds, NULL, NULL, NULL, NULL);
}
int remote_recv(int sock, struct sockaddr *addr, uint8_t* buf, size_t *buflen)
int remote_recv(int sock, struct sockaddr_storage *addr, uint8_t *buf,
size_t *buflen)
{
int c = tcp_accept(sock);
if (c < 0) {
......@@ -469,6 +470,13 @@ int remote_recv(int sock, struct sockaddr *addr, uint8_t* buf, size_t *buflen)
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;
}
/* Receive data. */
int n = tcp_recv_msg(c, buf, *buflen, NULL);
*buflen = n;
......@@ -755,7 +763,7 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
memset(&ss, 0, sizeof(struct sockaddr_storage));
/* Accept incoming connection and read packet. */
int client = remote_recv(sock, (struct sockaddr *)&ss, pkt->wire, &buflen);
int client = remote_recv(sock, &ss, pkt->wire, &buflen);
if (client < 0) {
dbg_server("remote: couldn't receive query = %d\n", client);
knot_pkt_free(&pkt);
......
......@@ -78,7 +78,8 @@ int remote_poll(int sock);
* \return client TCP socket if success.
* \return KNOT_ECONNREFUSED if fails to receive command.
*/
int remote_recv(int sock, struct sockaddr *addr, uint8_t* buf, size_t *buflen);
int remote_recv(int sock, struct sockaddr_storage *addr, uint8_t *buf,
size_t *buflen);
/*!
* \brief Parse a RC command.
......
......@@ -234,9 +234,10 @@ int axfr_query_process(knot_pkt_t *pkt, struct query_data *qdata)
return NS_PROC_FULL; /* Check for more. */
case KNOT_EOK: /* Last response. */
gettimeofday(&now, NULL);
AXFROUT_LOG(LOG_INFO, "Finished in %.02fs (%u messages, ~%.01f"
"kB).", time_diff(&axfr->proc.tstamp, &now) / 1000.0,
axfr->proc.npkts, axfr->proc.nbytes / 1024.0);
AXFROUT_LOG(LOG_INFO, "Finished in %.02fs (%u messages, "
"%s%.*f %s).",
time_diff(&axfr->proc.tstamp, &now) / 1000.0,
axfr->proc.npkts, SIZE_PARAMS(axfr->proc.nbytes));
return NS_PROC_DONE;
break;
default: /* Generic error. */
......@@ -315,9 +316,9 @@ static int axfr_answer_finalize(struct answer_data *adata)
zone_contents_serial(old_contents),
zone_contents_serial(proc->contents));
AXFRIN_LOG(LOG_INFO, "Finished in %.02fs (%u messages, ~%.01fkB).",
time_diff(&proc->tstamp, &now) / 1000.0,
proc->npkts, proc->nbytes / 1024.0);
AXFRIN_LOG(LOG_INFO, "Finished in %.02fs (%u messages, %s%.*f %s).",
time_diff(&proc->tstamp, &now) / 1000.0,
proc->npkts, SIZE_PARAMS(proc->nbytes));
/* Do not free new contents with cleanup. */
zone_contents_deep_free(&old_contents);
......@@ -331,9 +332,11 @@ static int axfr_answer_packet(knot_pkt_t *pkt, struct xfr_proc *proc)
assert(pkt != NULL);
assert(proc != NULL);
++proc->npkts;
/* Update counters. */
proc->npkts += 1;
proc->nbytes += pkt->size;
// Init zone creator
/* Init zone creator. */
zcreator_t zc = {.z = proc->contents, .master = false, .ret = KNOT_EOK };
const knot_pktsection_t *answer = knot_pkt_section(pkt, KNOT_ANSWER);
......
......@@ -32,6 +32,12 @@
struct query_data;
struct answer_data;
/*! \brief This macro helps with data size formatting during xfr logging. */
#define SIZE_PARAMS(value) (value) < 1024 ? "" : "~", \
(value) < 1024 ? 0 : 1, \
(value) < 1024 ? (float)(value) : (value) / 1024.0, \
(value) < 1024 ? "B" : "KiB"
/*! \brief Generic transfer processing state. */
struct xfr_proc {
list_t nodes; /* Items to process (ptrnode_t). */
......
/* Copyright (C) 2014 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 "knot/nameserver/capture.h"
#include "knot/server/tcp-handler.h"
#include "knot/server/udp-handler.h"
/* State-less packet capture, only incoming data is accepted. */
static int reset(knot_process_t *ctx) { return NS_PROC_MORE; }
static int finish(knot_process_t *ctx) { return NS_PROC_NOOP; }
/* Set capture parameters (sink). */
static int begin(knot_process_t *ctx, void *module_param)
{
ctx->data = module_param;
return NS_PROC_MORE;
}
/* Forward packet. */
static int capture(knot_pkt_t *pkt, knot_process_t *ctx)
{
assert(pkt && ctx);
struct process_capture_param *param = ctx->data;
/* Copy packet contents and free. */
knot_pkt_copy(param->sink, pkt);
knot_pkt_free(&pkt);
return NS_PROC_DONE;
}
/*! \brief Module implementation. */
static const knot_process_module_t PROCESS_CAPTURE_MODULE = {
&begin,
&reset,
&finish,
&capture,
&knot_process_noop, /* No output. */
&knot_process_noop /* No error processing. */
};
const knot_process_module_t *proc_capture_get_module(void)
{
return &PROCESS_CAPTURE_MODULE;
}
/*!
* \file capture.h
*
* \author Marek Vavrusa <marek.vavrusa@nic.cz>
*
* \brief Simple packet capture processor.
*
* \addtogroup answer_processing
* @{
*/
/* Copyright (C) 2014 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/>.
*/
#pragma once
#include "libknot/processing/process.h"
#include "libknot/packet/pkt.h"
/* Processing module implementation. */
const knot_process_module_t *proc_capture_get_module(void);
#define NS_PROC_CAPTURE proc_capture_get_module()
#define NS_PROC_CAPTURE_ID 3
/*!
* \brief Processing module parameters.
*/
struct process_capture_param {
knot_pkt_t *sink; /*!< Container for captured response. */
};
/*! @} */
......@@ -121,7 +121,7 @@ static bool dname_cname_cannot_synth(const knot_rrset_t *rrset, const knot_dname
/*! \brief DNSSEC both requested & available. */
static bool have_dnssec(struct query_data *qdata)
{
return pkt_has_dnssec(qdata->query) &&
return knot_pkt_has_dnssec(qdata->query) &&
qdata->rcode_ext != KNOT_EDNS_RCODE_BADVERS &&
zone_contents_is_signed(qdata->zone->contents);
}
......@@ -192,7 +192,7 @@ static int put_opt_rr(knot_pkt_t *pkt, struct query_data *qdata)
}
/* Set DO bit if set (DNSSEC requested). */
if (pkt_has_dnssec(query)) {
if (knot_pkt_has_dnssec(query)) {
dbg_ns("%s: setting DO=1 in OPT RR\n", __func__);
knot_edns_set_do(&opt_rr);
}
......
......@@ -294,7 +294,7 @@ static void ixfrin_cleanup(struct answer_data *data)
{
struct ixfr_proc *proc = data->ext;
if (proc) {
changesets_clear(&proc->changesets);
changesets_free(&proc->changesets);
knot_rrset_free(&proc->final_soa, proc->mm);
mm_free(data->mm, proc);
data->ext = NULL;
......@@ -339,9 +339,9 @@ static int ixfrin_finalize(struct answer_data *adata)
struct timeval now = {0};
gettimeofday(&now, NULL);
IXFRIN_LOG(LOG_INFO, "Finished in %.02fs (%u messages, ~%.01fkB).",
IXFRIN_LOG(LOG_INFO, "Finished in %.02fs (%u messages, %s%.*f %s).",
time_diff(&ixfr->proc.tstamp, &now) / 1000.0,
ixfr->proc.npkts, ixfr->proc.nbytes / 1024.0);
ixfr->proc.npkts, SIZE_PARAMS(ixfr->proc.nbytes));
return KNOT_EOK;
}
......@@ -507,6 +507,7 @@ static bool out_of_zone(const knot_rrset_t *rr, struct ixfr_proc *proc)
static int process_ixfrin_packet(knot_pkt_t *pkt, struct answer_data *adata)
{
struct ixfr_proc *ixfr = (struct ixfr_proc *)adata->ext;
// Update counters.
ixfr->proc.npkts += 1;
ixfr->proc.nbytes += pkt->size;
......@@ -595,9 +596,10 @@ int ixfr_query(knot_pkt_t *pkt, struct query_data *qdata)
return NS_PROC_FULL; /* Check for more. */
case KNOT_EOK: /* Last response. */
gettimeofday(&now, NULL);
IXFROUT_LOG(LOG_INFO, "Finished in %.02fs (%u messages, ~%.01fkB).",
IXFROUT_LOG(LOG_INFO, "Finished in %.02fs (%u messages, "
"%s%.*f %s).",
time_diff(&ixfr->proc.tstamp, &now) / 1000.0,
ixfr->proc.npkts, ixfr->proc.nbytes / 1024.0);
ixfr->proc.npkts, SIZE_PARAMS(ixfr->proc.nbytes));
ret = NS_PROC_DONE;
break;
default: /* Generic error. */
......
......@@ -46,37 +46,58 @@
#define NOTIFY_QLOG(severity, msg...) \
QUERY_LOG(severity, qdata, "NOTIFY", msg)
int notify_query(knot_pkt_t *pkt, struct query_data *qdata)
static int notify_check_query(struct query_data *qdata)
{
if (pkt == NULL || qdata == NULL) {
return NS_PROC_FAIL;
}
/* RFC1996 require SOA question. */
zone_t *zone = (zone_t *)qdata->zone;
/* RFC1996 requires SOA question. */
NS_NEED_QTYPE(qdata, KNOT_RRTYPE_SOA, KNOT_RCODE_FORMERR);
/* Check valid zone, transaction security. */
zone_t *zone = (zone_t *)qdata->zone;
NS_NEED_ZONE(qdata, KNOT_RCODE_NOTAUTH);
NS_NEED_AUTH(&zone->conf->acl.notify_in, qdata);
return NS_PROC_DONE;
}
int notify_process_query(knot_pkt_t *pkt, struct query_data *qdata)
{
if (pkt == NULL || qdata == NULL) {
return NS_PROC_FAIL;
}
/* Validate notification query. */
int state = notify_check_query(qdata);
if (state == NS_PROC_FAIL) {
switch (qdata->rcode) {
case KNOT_RCODE_NOTAUTH: /* Not authoritative or ACL check failed. */
NOTIFY_QLOG(LOG_NOTICE, "unauthorized request.");
break;
case KNOT_RCODE_FORMERR: /* Silently ignore bad queries. */
default:
break;
}
return state;
}
/* Reserve space for TSIG. */
knot_pkt_reserve(pkt, tsig_wire_maxsize(qdata->sign.tsig_key));
/* SOA RR in answer may be included, recover serial. */
unsigned serial = 0;
const knot_pktsection_t *answer = knot_pkt_section(qdata->query, KNOT_ANSWER);
if (answer->count > 0) {
const knot_rrset_t *soa = &answer->rr[0];
if (soa->type == KNOT_RRTYPE_SOA) {
serial = knot_soa_serial(&soa->rrs);
uint32_t serial = knot_soa_serial(&soa->rrs);
NOTIFY_QLOG(LOG_INFO, "received serial %u.", serial);
} else { /* Ignore */
NOTIFY_QLOG(LOG_INFO, "received, doesn't have SOA.");
} else { /* Complain, but accept N/A record. */
NOTIFY_QLOG(LOG_NOTICE, "received, bad record in answer section.");
}
} else {
NOTIFY_QLOG(LOG_INFO, "received, doesn't have SOA.");
}
/* Incoming NOTIFY expires REFRESH timer and renews EXPIRE timer. */
zone_t *zone = (zone_t *)qdata->zone;
zone_events_schedule(zone, ZONE_EVENT_REFRESH, ZONE_EVENT_NOW);
return NS_PROC_DONE;
......
......@@ -43,7 +43,7 @@ struct answer_data;
* \retval FAIL if it encountered an error.
* \retval DONE if finished.
*/
int notify_query(knot_pkt_t *pkt, struct query_data *qdata);
int notify_process_query(knot_pkt_t *pkt, struct query_data *qdata);
/*!
* \brief Process an answer to the NOTIFY query.
......
......@@ -20,11 +20,6 @@
#include "knot/nameserver/ixfr.h"
#include "knot/nameserver/axfr.h"
static int noop(knot_pkt_t *pkt, knot_process_t *ctx)
{
return NS_PROC_NOOP;
}
/*! \brief Accessor to query-specific data. */
#define ANSWER_DATA(ctx) ((struct answer_data *)(ctx)->data)
......@@ -117,7 +112,7 @@ static int process_answer(knot_pkt_t *pkt, knot_process_t *ctx)
/* Verify incoming packet. */
int ret = tsig_verify_packet(&data->param->tsig_ctx, pkt);
if (ret != KNOT_EOK) {
ANSWER_LOG(LOG_INFO, data, "Response", "%s", knot_strerror(ret));
ANSWER_LOG(LOG_WARNING, data, "Response", "%s", knot_strerror(ret));
return NS_PROC_FAIL;
}
......@@ -151,12 +146,12 @@ static int process_answer(knot_pkt_t *pkt, knot_process_t *ctx)
/*! \brief Module implementation. */
static const knot_process_module_t PROCESS_ANSWER_MODULE = {
&process_answer_begin,
&process_answer_reset,
&process_answer_finish,
&process_answer,
&noop, /* No output. */
&noop /* No error processing. */
&process_answer_begin,
&process_answer_reset,
&process_answer_finish,
&process_answer,
&knot_process_noop, /* No output. */
&knot_process_noop /* No error processing. */
};
const knot_process_module_t *process_answer_get_module(void)
......
......@@ -29,7 +29,7 @@
#include "knot/nameserver/process_query.h"
#include "knot/nameserver/tsig_ctx.h"
/* Query processing module implementation. */
/* Answer processing module implementation. */
const knot_process_module_t *process_answer_get_module(void);
#define NS_PROC_ANSWER process_answer_get_module()
#define NS_PROC_ANSWER_ID 2
......@@ -42,7 +42,7 @@ const knot_process_module_t *process_answer_get_module(void);
} while(0)
/*!
* \brief Answer processing parameters.
* \brief Processing module parameters.
*/
struct process_answer_param {
zone_t *zone; /*!< Answer bailiwick. */
......@@ -52,7 +52,7 @@ struct process_answer_param {
};
/*!
* \brief Answer processing context.
* \brief Processing module context.
*/
struct answer_data {
/* Extensions. */
......
This diff is collapsed.
......@@ -31,8 +31,8 @@
#include "knot/updates/acl.h"
/* Query processing module implementation. */
extern const knot_process_module_t _process_query;
#define NS_PROC_QUERY (&_process_query)
const knot_process_module_t *process_query_get_module(void);
#define NS_PROC_QUERY process_query_get_module()
#define NS_PROC_QUERY_ID 1
/*! \brief Query processing logging common base. */
......@@ -110,62 +110,6 @@ struct rrsig_info {
knot_rrinfo_t *rrinfo; /* RR info. */
};
/*!
* \brief Initialize query processing context.
*
* \param ctx
* \param module_param
* \return MORE (awaits query)
*/
int process_query_begin(knot_process_t *ctx, void *module_param);
/*!
* \brief Reset query processing context.
*
* \param ctx
* \return MORE (awaits next query)
*/
int process_query_reset(knot_process_t *ctx);
/*!
* \brief Finish and close current query processing.
*
* \param ctx
* \return NOOP (context will be inoperable further on)
*/
int process_query_finish(knot_process_t *ctx);
/*!
* \brief Put query into query processing context.
*
* \param pkt
* \param ctx
* \retval NOOP (unsupported query)
* \retval FULL (ready to write answer)
*/
int process_query_in(knot_pkt_t *pkt, knot_process_t *ctx);
/*!
* \brief Make query response.
*
* \param pkt
* \param ctx
* \retval DONE (finished response)
* \retval FULL (partial response, send it and call again)
* \retval FAIL (failure)
*/
int process_query_out(knot_pkt_t *pkt, knot_process_t *ctx);
/*!
* \brief Make an error response.
*
* \param pkt
* \param ctx
* \retval DONE (finished response)
* \retval FAIL (failure)
*/
int process_query_err(knot_pkt_t *pkt, knot_process_t *ctx);
/*!
* \brief Check current query against ACL.
*
......@@ -187,29 +131,4 @@ bool process_query_acl_check(list_t *acl, struct query_data *qdata);
*/
int process_query_verify(struct query_data *qdata);
/*!
* \brief Sign query response if applicable.
*
* \param pkt
* \param qdata
* \retval KNOT_EOK
* \retval (other generic errors)
*/
int process_query_sign_response(knot_pkt_t *pkt, struct query_data *qdata);
int process_query_hooks(int qclass, int stage, knot_pkt_t *pkt, struct query_data *qdata);
/*! \brief Checks if DO bit is set in the packet's OPT RR. */
static inline bool pkt_has_dnssec(const knot_pkt_t *pkt)
{
return knot_pkt_has_edns(pkt) && knot_edns_do(pkt->opt_rr);
}
/*! \brief Checks if there is an NSID OPTION in the packet's OPT RR. */
static inline bool pkt_has_nsid(const knot_pkt_t *pkt)
{
return knot_pkt_has_edns(pkt)
&& knot_edns_has_option(pkt->opt_rr, KNOT_EDNS_OPTION_NSID);
}
/*! @} */
......@@ -185,7 +185,11 @@ int requestor_enqueue(struct requestor *requestor, struct request *request, void
/* Form a pending request. */
request->data.fd = fd;
request->state = NS_PROC_FULL; /* We have a query to be sent. */
memcpy(&request->process.mm, requestor->mm, sizeof(mm_ctx_t));
if (requestor->mm != NULL) {
memcpy(&request->process.mm, requestor->mm, sizeof(mm_ctx_t));
} else {
mm_ctx_init(&request->process.mm);
}