Commit 90216771 authored by Daniel Salzman's avatar Daniel Salzman

Tiny review fixes

parent ce67236a
......@@ -34,9 +34,9 @@ static void reschedule(conf_t *conf, zone_t *zone,
conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
zone_events_schedule_at(zone,
ZONE_EVENT_DNSSEC, dnssec_refresh,
ZONE_EVENT_DNSSEC, dnssec_refresh,
ZONE_EVENT_NOTIFY, zone_changed ? now : ignore,
ZONE_EVENT_FLUSH, conf_int(&val) == 0 ? now : ignore
ZONE_EVENT_FLUSH, conf_int(&val) == 0 ? now : ignore
);
}
......@@ -78,7 +78,7 @@ int event_dnssec(conf_t *conf, zone_t *zone)
int ret = apply_changeset(&a_ctx, zone->contents, &ch, &new_contents);
if (ret != KNOT_EOK) {
log_zone_error(zone->name, "DNSSEC, failed to sign zone (%s)",
knot_strerror(ret));
knot_strerror(ret));
goto done;
}
......@@ -86,7 +86,7 @@ int event_dnssec(conf_t *conf, zone_t *zone)
ret = zone_change_store(conf, zone, &ch);
if (ret != KNOT_EOK) {
log_zone_error(zone->name, "DNSSEC, failed to sign zone (%s)",
knot_strerror(ret));
knot_strerror(ret));
update_rollback(&a_ctx);
update_free_zone(&new_contents);
goto done;
......
......@@ -115,7 +115,7 @@ static int send_notify(conf_t *conf, zone_t *zone, const knot_rrset_t *soa,
"failed (%s)", knot_strerror(ret));
} else {
NOTIFY_LOG(LOG_WARNING, zone->name, dst,
"server responded withi error '%s",
"server responded with error '%s'",
knot_pkt_ext_rcode_name(req->resp));
}
......
......@@ -339,7 +339,7 @@ static int ixfr_finalize(struct refresh_data *data)
apply_init_ctx(&ctx, NULL, APPLY_STRICT);
int ret = apply_changesets(&ctx, data->zone->contents,
&data->ixfr.changesets, &new_zone);
&data->ixfr.changesets, &new_zone);
if (ret != KNOT_EOK) {
IXFRIN_LOG(LOG_WARNING, data->zone->name, data->remote,
"failed to apply changes to zone (%s)",
......@@ -699,7 +699,7 @@ static int transfer_produce(knot_layer_t *layer, knot_pkt_t *pkt)
query_init_pkt(pkt);
knot_pkt_put_question(pkt, data->zone->name, KNOT_CLASS_IN,
ixfr ? KNOT_RRTYPE_IXFR : KNOT_RRTYPE_AXFR);
ixfr ? KNOT_RRTYPE_IXFR : KNOT_RRTYPE_AXFR);
if (ixfr) {
assert(data->soa);
......
......@@ -23,5 +23,5 @@ void log_dnssec_next(const knot_dname_t *zone, time_t refresh_at)
struct tm time_gm = { 0 };
localtime_r(&refresh_at, &time_gm);
strftime(time_str, sizeof(time_str), KNOT_LOG_TIME_FORMAT, &time_gm);
log_zone_info(zone, "DNSSEC, next signing on %s", time_str);
log_zone_info(zone, "DNSSEC, next signing at %s", time_str);
}
......@@ -86,7 +86,6 @@ static bool can_expire(const zone_t *zone)
* \brief Replan events that depend on zone timers (REFRESH, EXPIRE, FLUSH).
*/
void replan_from_timers(conf_t *conf, zone_t *zone)
{
assert(conf);
assert(zone);
......@@ -115,8 +114,8 @@ void replan_from_timers(conf_t *conf, zone_t *zone)
zone_events_schedule_at(zone,
ZONE_EVENT_REFRESH, refresh,
ZONE_EVENT_EXPIRE, expire_pre,
ZONE_EVENT_EXPIRE, expire,
ZONE_EVENT_EXPIRE, expire_pre,
ZONE_EVENT_EXPIRE, expire,
ZONE_EVENT_FLUSH, flush);
}
......
......@@ -19,7 +19,6 @@
#include "libknot/packet/pkt.h"
struct query_data;
struct answer_data;
/*! \brief Internet query processing states. */
enum {
......@@ -41,23 +40,6 @@ enum {
*/
int internet_process_query(knot_pkt_t *pkt, struct query_data *qdata);
/*!
* \brief Puts RRSet to packet, will store its RRSIG for later use.
*
* \param pkt Packet to store RRSet into.
* \param rr RRSet to be stored.
* \param rrsigs RRSIGs to be stored.
* \param compr_hint Compression hint.
* \param flags Flags.
* \param expand Set to true if wildcards should be expanded.
* \param qdata Query data structure.
*
* \return KNOT_E*
*/
int ns_put_rr(knot_pkt_t *pkt, const knot_rrset_t *rr,
const knot_rrset_t *rrsigs, uint16_t compr_hint,
uint32_t flags, struct query_data *qdata);
/*! \brief Require given QUERY TYPE or return error code. */
#define NS_NEED_QTYPE(qdata, qtype_want, error_rcode) \
if (knot_pkt_qtype((qdata)->query) != (qtype_want)) { \
......
/* Copyright (C) 2015 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2017 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
......@@ -16,15 +16,12 @@
#include <urcu.h>
#include "knot/common/log.h"
#include "knot/nameserver/internet.h"
#include "knot/nameserver/axfr.h"
#include "knot/nameserver/ixfr.h"
#include "knot/nameserver/log.h"
#include "knot/nameserver/xfr.h"
#include "knot/updates/apply.h"
#include "knot/zone/serial.h"
#include "knot/zone/semantic-check.h"
#include "knot/zone/zonefile.h"
#include "libknot/libknot.h"
#include "contrib/mempattern.h"
......@@ -55,8 +52,9 @@ static int ixfr_put_chg_part(knot_pkt_t *pkt, struct ixfr_proc *ixfr,
if (knot_rrset_empty(&ixfr->cur_rr)) {
ixfr->cur_rr = changeset_iter_next(itt);
}
int ret = KNOT_EOK; // Declaration for IXFR_SAFE_PUT macro
while(!knot_rrset_empty(&ixfr->cur_rr)) {
while (!knot_rrset_empty(&ixfr->cur_rr)) {
IXFR_SAFE_PUT(pkt, &ixfr->cur_rr);
ixfr->cur_rr = changeset_iter_next(itt);
}
......@@ -301,7 +299,7 @@ int ixfr_process_query(knot_pkt_t *pkt, struct query_data *qdata)
}
int ret = KNOT_EOK;
struct ixfr_proc *ixfr = (struct ixfr_proc*)qdata->ext;
struct ixfr_proc *ixfr = (struct ixfr_proc *)qdata->ext;
/* If IXFR is disabled, respond with SOA. */
if (qdata->param->proc_flags & NS_QUERY_NO_IXFR) {
......@@ -311,9 +309,9 @@ int ixfr_process_query(knot_pkt_t *pkt, struct query_data *qdata)
/* Initialize on first call. */
if (qdata->ext == NULL) {
ret = ixfr_answer_init(qdata);
switch(ret) {
switch (ret) {
case KNOT_EOK: /* OK */
ixfr = (struct ixfr_proc*)qdata->ext;
ixfr = (struct ixfr_proc *)qdata->ext;
IXFROUT_LOG(LOG_INFO, qdata, "started, serial %u -> %u",
knot_soa_serial(&ixfr->soa_from->rrs),
knot_soa_serial(&ixfr->soa_to->rrs));
......@@ -337,13 +335,13 @@ int ixfr_process_query(knot_pkt_t *pkt, struct query_data *qdata)
/* Answer current packet (or continue). */
ret = xfr_process_list(pkt, &ixfr_process_changeset, qdata);
switch(ret) {
switch (ret) {
case KNOT_ESPACE: /* Couldn't write more, send packet and continue. */
return KNOT_STATE_PRODUCE; /* Check for more. */
case KNOT_EOK: /* Last response. */
xfr_stats_end(&ixfr->proc.stats);
xfr_log_finished(ZONE_NAME(qdata), LOG_OPERATION_IXFR, LOG_DIRECTION_OUT,
REMOTE(qdata), &ixfr->proc.stats);
REMOTE(qdata), &ixfr->proc.stats);
ret = KNOT_STATE_DONE;
break;
default: /* Generic error. */
......
/* Copyright (C) 2015 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2017 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
......@@ -13,20 +13,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file
*
* \brief IXFR processing.
*
* \addtogroup query_processing
* @{
*/
#pragma once
#include "knot/nameserver/process_query.h"
#include "knot/nameserver/xfr.h"
#include "knot/query/query.h"
#include "libknot/packet/pkt.h"
/*! \brief IXFR-in processing states. */
......@@ -68,5 +59,3 @@ struct ixfr_proc {
* \retval DONE if finished.
*/
int ixfr_process_query(knot_pkt_t *pkt, struct query_data *qdata);
/*! @} */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment