Commit d4eaa94c authored by Daniel Salzman's avatar Daniel Salzman

knot: use a config copy for event handlers

parent 9b098d2d
......@@ -161,7 +161,7 @@ static int zone_status(zone_t *zone, remote_cmdargs_t *a)
conf_val_t val = conf_zone_get(conf(), C_DNSSEC_SIGNING, zone->name);
bool dnssec_enable = conf_bool(&val);
bool is_slave = zone_is_slave(zone);
bool is_slave = zone_is_slave(conf(), zone);
int n = snprintf(buf, sizeof(buf),
"%s%s\ttype=%s | serial=%u | %s %s | %s %s",
......@@ -198,7 +198,7 @@ static int zone_refresh(zone_t *zone, remote_cmdargs_t *a)
{
UNUSED(a);
if (!zone_is_slave(zone)) {
if (!zone_is_slave(conf(), zone)) {
return KNOT_ENOTSUP;
}
......@@ -211,7 +211,7 @@ static int zone_retransfer(zone_t *zone, remote_cmdargs_t *a)
{
UNUSED(a);
if (!zone_is_slave(zone)) {
if (!zone_is_slave(conf(), zone)) {
return KNOT_ENOTSUP;
}
......
......@@ -386,7 +386,7 @@ static int ixfrin_finalize(struct answer_data *adata)
}
/* Write changes to journal. */
ret = zone_changes_store(ixfr->zone, &ixfr->changesets);
ret = zone_changes_store(adata->param->conf, ixfr->zone, &ixfr->changesets);
if (ret != KNOT_EOK) {
IXFRIN_LOG(LOG_WARNING, "failed to write changes to journal (%s)",
knot_strerror(ret));
......
......@@ -26,6 +26,7 @@
#include <sys/socket.h>
#include "knot/conf/conf.h"
#include "knot/nameserver/process_query.h"
#include "knot/nameserver/tsig_ctx.h"
......@@ -42,7 +43,8 @@ const knot_layer_api_t *process_answer_layer(void);
* \brief Processing module parameters.
*/
struct process_answer_param {
zone_t *zone; /*!< Answer bailiwick. */
zone_t *zone; /*!< Answer bailiwick. */
conf_t *conf; /*!< Configuration. */
const knot_pkt_t *query; /*!< Query preceding the answer. */
const struct sockaddr_storage *remote; /*!< Answer origin. */
tsig_ctx_t tsig_ctx; /*!< Signing context. */
......
......@@ -129,7 +129,7 @@ static int process_bulk(zone_t *zone, list_t *requests, zone_update_t *up)
return KNOT_EOK;
}
static int process_normal(zone_t *zone, list_t *requests)
static int process_normal(conf_t *conf, zone_t *zone, list_t *requests)
{
assert(requests);
......@@ -151,7 +151,7 @@ static int process_normal(zone_t *zone, list_t *requests)
// Apply changes.
zone_contents_t *new_contents = NULL;
ret = zone_update_commit(&up, &new_contents);
ret = zone_update_commit(conf, &up, &new_contents);
if (ret != KNOT_EOK) {
if (ret == KNOT_ETTL) {
set_rcodes(requests, KNOT_RCODE_REFUSED);
......@@ -163,15 +163,11 @@ static int process_normal(zone_t *zone, list_t *requests)
/* If there is anything to change */
if (new_contents) {
/* Temporarily unlock locked configuration. */
rcu_read_unlock();
/* Switch zone contents. */
zone_contents_t *old_contents = zone_switch_contents(zone, new_contents);
/* Sync RCU. */
synchronize_rcu();
rcu_read_lock();
/* Clear obsolete zone contents. */
update_free_zone(&old_contents);
......@@ -180,7 +176,7 @@ static int process_normal(zone_t *zone, list_t *requests)
zone_update_clear(&up);
/* Sync zonefile immediately if configured. */
conf_val_t val = conf_zone_get(conf(), C_ZONEFILE_SYNC, zone->name);
conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
if (conf_int(&val) == 0) {
zone_events_schedule(zone, ZONE_EVENT_FLUSH, ZONE_EVENT_NOW);
}
......@@ -188,7 +184,7 @@ static int process_normal(zone_t *zone, list_t *requests)
return KNOT_EOK;
}
static void process_requests(zone_t *zone, list_t *requests)
static void process_requests(conf_t *conf, zone_t *zone, list_t *requests)
{
assert(zone);
assert(requests);
......@@ -199,7 +195,7 @@ static void process_requests(zone_t *zone, list_t *requests)
const uint32_t old_serial = zone_contents_serial(zone->contents);
/* Process authenticated packet. */
int ret = process_normal(zone, requests);
int ret = process_normal(conf, zone, requests);
if (ret != KNOT_EOK) {
log_zone_error(zone->name, "DDNS, processing failed (%s)",
knot_strerror(ret));
......@@ -221,7 +217,7 @@ static void process_requests(zone_t *zone, list_t *requests)
zone_events_schedule(zone, ZONE_EVENT_NOTIFY, ZONE_EVENT_NOW);
}
static int remote_forward(struct knot_request *request, conf_remote_t *remote)
static int remote_forward(conf_t *conf, struct knot_request *request, conf_remote_t *remote)
{
/* Copy request and assign new ID. */
knot_pkt_t *query = knot_pkt_new(NULL, request->query->max_size, NULL);
......@@ -266,7 +262,7 @@ static int remote_forward(struct knot_request *request, conf_remote_t *remote)
/* Enqueue the request. */
ret = knot_requestor_enqueue(&re, req);
if (ret == KNOT_EOK) {
conf_val_t *val = &conf()->cache.srv_tcp_reply_timeout;
conf_val_t *val = &conf->cache.srv_tcp_reply_timeout;
int timeout = conf_int(val) * 1000;
ret = knot_requestor_exec(&re, timeout);
} else {
......@@ -279,25 +275,25 @@ static int remote_forward(struct knot_request *request, conf_remote_t *remote)
return ret;
}
static void forward_request(zone_t *zone, struct knot_request *request)
static void forward_request(conf_t *conf, zone_t *zone, struct knot_request *request)
{
/* Read the ddns master or the first master. */
conf_val_t remote = conf_zone_get(conf(), C_DDNS_MASTER, zone->name);
conf_val_t remote = conf_zone_get(conf, C_DDNS_MASTER, zone->name);
if (remote.code != KNOT_EOK) {
remote = conf_zone_get(conf(), C_MASTER, zone->name);
remote = conf_zone_get(conf, C_MASTER, zone->name);
}
/* Get the number of remote addresses. */
conf_val_t addr = conf_id_get(conf(), C_RMT, C_ADDR, &remote);
conf_val_t addr = conf_id_get(conf, C_RMT, C_ADDR, &remote);
size_t addr_count = conf_val_count(&addr);
assert(addr_count > 0);
/* Try all remote addresses to forward the request to. */
int ret = KNOT_EOK;
for (size_t i = 0; i < addr_count; i++) {
conf_remote_t master = conf_remote(conf(), &remote, i);
conf_remote_t master = conf_remote(conf, &remote, i);
ret = remote_forward(request, &master);
ret = remote_forward(conf, request, &master);
if (ret == KNOT_EOK) {
break;
}
......@@ -318,7 +314,7 @@ static void forward_request(zone_t *zone, struct knot_request *request)
}
}
static void forward_requests(zone_t *zone, list_t *requests)
static void forward_requests(conf_t *conf, zone_t *zone, list_t *requests)
{
assert(zone);
assert(requests);
......@@ -326,7 +322,7 @@ static void forward_requests(zone_t *zone, list_t *requests)
ptrnode_t *node = NULL;
WALK_LIST(node, *requests) {
struct knot_request *req = node->d;
forward_request(zone, req);
forward_request(conf, zone, req);
}
}
......@@ -356,10 +352,10 @@ static bool update_tsig_check(struct query_data *qdata, struct knot_request *req
#undef UPDATE_LOG
static void send_update_response(const zone_t *zone, struct knot_request *req)
static void send_update_response(conf_t *conf, const zone_t *zone, struct knot_request *req)
{
if (req->resp) {
if (!zone_is_slave(zone)) {
if (!zone_is_slave(conf, zone)) {
// Sign the response with TSIG where applicable
struct query_data qdata;
init_qdata_from_request(&qdata, zone, req, NULL);
......@@ -368,7 +364,7 @@ static void send_update_response(const zone_t *zone, struct knot_request *req)
}
if (net_is_stream(req->fd)) {
conf_val_t *val = &conf()->cache.srv_tcp_reply_timeout;
conf_val_t *val = &conf->cache.srv_tcp_reply_timeout;
int timeout = conf_int(val) * 1000;
net_dns_tcp_send(req->fd, req->resp->wire, req->resp->size,
timeout);
......@@ -387,18 +383,18 @@ static void free_request(struct knot_request *req)
free(req);
}
static void send_update_responses(const zone_t *zone, list_t *updates)
static void send_update_responses(conf_t *conf, const zone_t *zone, list_t *updates)
{
ptrnode_t *node = NULL, *nxt = NULL;
WALK_LIST_DELSAFE(node, nxt, *updates) {
struct knot_request *req = node->d;
send_update_response(zone, req);
send_update_response(conf, zone, req);
free_request(req);
}
ptrlist_free(updates, NULL);
}
static int init_update_responses(const zone_t *zone, list_t *updates,
static int init_update_responses(conf_t *conf, const zone_t *zone, list_t *updates,
size_t *update_count)
{
ptrnode_t *node = NULL, *nxt = NULL;
......@@ -411,7 +407,7 @@ static int init_update_responses(const zone_t *zone, list_t *updates,
assert(req->query);
knot_pkt_init_response(req->resp, req->query);
if (zone_is_slave(zone)) {
if (zone_is_slave(conf, zone)) {
// Don't check TSIG for forwards.
continue;
}
......@@ -425,7 +421,7 @@ static int init_update_responses(const zone_t *zone, list_t *updates,
if (!update_tsig_check(&qdata, req)) {
// ACL/TSIG check failed, send response.
send_update_response(zone, req);
send_update_response(conf, zone, req);
// Remove this request from processing list.
free_request(req);
ptrlist_rem(node, NULL);
......@@ -463,7 +459,7 @@ int update_process_query(knot_pkt_t *pkt, struct query_data *qdata)
return KNOT_STATE_DONE;
}
void updates_execute(zone_t *zone)
void updates_execute(conf_t *conf, zone_t *zone)
{
/* Get list of pending updates. */
list_t updates;
......@@ -472,39 +468,32 @@ void updates_execute(zone_t *zone)
return;
}
/* Block config changes. */
rcu_read_lock();
/* Init updates respones. */
int ret = init_update_responses(zone, &updates, &update_count);
int ret = init_update_responses(conf, zone, &updates, &update_count);
if (ret != KNOT_EOK) {
/* Send what responses we can. */
set_rcodes(&updates, KNOT_RCODE_SERVFAIL);
send_update_responses(zone, &updates);
rcu_read_unlock();
send_update_responses(conf, zone, &updates);
return;
}
if (update_count == 0) {
/* All updates failed their ACL checks. */
rcu_read_unlock();
return;
}
/* Process update list - forward if zone has master, or execute.
RCODEs are set. */
if (zone_is_slave(zone)) {
if (zone_is_slave(conf, zone)) {
log_zone_info(zone->name,
"DDNS, forwarding %zu updates", update_count);
forward_requests(zone, &updates);
forward_requests(conf, zone, &updates);
} else {
log_zone_info(zone->name,
"DDNS, processing %zu updates", update_count);
process_requests(zone, &updates);
process_requests(conf, zone, &updates);
}
/* Send responses. */
send_update_responses(zone, &updates);
rcu_read_unlock();
send_update_responses(conf, zone, &updates);
}
......@@ -39,12 +39,7 @@ int update_process_query(knot_pkt_t *pkt, struct query_data *qdata);
/*!
* \brief Processes serialized packet with DDNS. Function expects that the
* query is already authenticated and TSIG signature is verified.
*
* \note RCODEs are set.
*
* \param pkt Prepared response packet.
* \param qdata Minimal query data context.
*/
void updates_execute(zone_t *zone);
void updates_execute(conf_t *conf, zone_t *zone);
/*! @} */
......@@ -363,7 +363,7 @@ static int sign_update(zone_update_t *update,
return KNOT_EOK;
}
static int set_new_soa(zone_update_t *update)
static int set_new_soa(zone_update_t *update, unsigned serial_policy)
{
assert(update);
......@@ -372,9 +372,8 @@ static int set_new_soa(zone_update_t *update)
return KNOT_ENOMEM;
}
conf_val_t val = conf_zone_get(conf(), C_SERIAL_POLICY, update->zone->name);
uint32_t old_serial = knot_soa_serial(&soa_cpy->rrs);
uint32_t new_serial = serial_next(old_serial, conf_opt(&val));
uint32_t new_serial = serial_next(old_serial, serial_policy);
if (serial_compare(old_serial, new_serial) >= 0) {
log_zone_warning(update->zone->name, "updated serial is lower "
"than current, serial %u -> %u",
......@@ -387,7 +386,7 @@ static int set_new_soa(zone_update_t *update)
return KNOT_EOK;
}
static int commit_incremental(zone_update_t *update, zone_contents_t **contents_out)
static int commit_incremental(conf_t *conf, zone_update_t *update, zone_contents_t **contents_out)
{
assert(update);
......@@ -399,7 +398,8 @@ static int commit_incremental(zone_update_t *update, zone_contents_t **contents_
int ret = KNOT_EOK;
if (zone_update_to(update) == NULL) {
// No SOA in the update, create one according to the current policy
ret = set_new_soa(update);
conf_val_t val = conf_zone_get(conf, C_SERIAL_POLICY, update->zone->name);
ret = set_new_soa(update, conf_opt(&val));
if (ret != KNOT_EOK) {
return ret;
}
......@@ -415,7 +415,7 @@ static int commit_incremental(zone_update_t *update, zone_contents_t **contents_
assert(new_contents);
conf_val_t val = conf_zone_get(conf(), C_DNSSEC_SIGNING, update->zone->name);
conf_val_t val = conf_zone_get(conf, C_DNSSEC_SIGNING, update->zone->name);
bool dnssec_enable = update->flags & UPDATE_SIGN && conf_bool(&val);
// Sign the update.
......@@ -430,7 +430,7 @@ static int commit_incremental(zone_update_t *update, zone_contents_t **contents_
}
// Write changes to journal if all went well. (DNSSEC merged)
ret = zone_change_store(update->zone, &update->change);
ret = zone_change_store(conf, update->zone, &update->change);
if (ret != KNOT_EOK) {
update_rollback(&update->change);
update_free_zone(&new_contents);
......@@ -442,10 +442,10 @@ static int commit_incremental(zone_update_t *update, zone_contents_t **contents_
return KNOT_EOK;
}
int zone_update_commit(zone_update_t *update, zone_contents_t **contents_out)
int zone_update_commit(conf_t *conf, zone_update_t *update, zone_contents_t **contents_out)
{
if (update->flags & UPDATE_INCREMENTAL) {
return commit_incremental(update, contents_out);
return commit_incremental(conf, update, contents_out);
}
return KNOT_ENOTSUP;
......
......@@ -24,6 +24,7 @@
#pragma once
#include "knot/conf/conf.h"
#include "knot/updates/changesets.h"
#include "knot/zone/contents.h"
#include "knot/zone/zone.h"
......@@ -137,12 +138,13 @@ int zone_update_remove(zone_update_t *update, const knot_rrset_t *rrset);
/*!
* \brief Commits all changes to the zone, signs it, saves changes to journal.
*
* \param conf Configuration.
* \param update Zone update.
* \param contents_out Where to store the resulting zone contents pointer.
*
* \return KNOT_E*
*/
int zone_update_commit(zone_update_t *update, zone_contents_t **contents_out);
int zone_update_commit(conf_t *conf, zone_update_t *update, zone_contents_t **contents_out);
/*!
* \brief Returns bool whether there are any changes at all.
......
......@@ -18,8 +18,7 @@
*
* Zone contents structure and API for manipulating it.
*
* \addtogroup knot
*
* \addtogroup zone
* @{
*/
......
......@@ -16,6 +16,7 @@
#include <assert.h>
#include <time.h>
#include <urcu.h>
#include "libknot/libknot.h"
#include "knot/common/log.h"
......@@ -24,13 +25,9 @@
#include "knot/zone/events/replan.h"
#include "knot/zone/zone.h"
/* ------------------------- internal timers -------------------------------- */
#define ZONE_EVENT_IMMEDIATE 1 /* Fast-track to worker queue. */
/* -- internal API ---------------------------------------------------------- */
typedef int (*zone_event_cb)(zone_t *zone);
typedef int (*zone_event_cb)(conf_t *conf, zone_t *zone);
typedef struct event_info {
zone_event_type_t type;
......@@ -39,15 +36,15 @@ typedef struct event_info {
} event_info_t;
static const event_info_t EVENT_INFO[] = {
{ ZONE_EVENT_LOAD, event_load, "load" },
{ ZONE_EVENT_REFRESH, event_refresh, "refresh" },
{ ZONE_EVENT_XFER, event_xfer, "transfer" },
{ ZONE_EVENT_UPDATE, event_update, "update" },
{ ZONE_EVENT_EXPIRE, event_expire, "expiration" },
{ ZONE_EVENT_FLUSH, event_flush, "journal flush" },
{ ZONE_EVENT_NOTIFY, event_notify, "notify" },
{ ZONE_EVENT_DNSSEC, event_dnssec, "DNSSEC resign" },
{ 0 }
{ ZONE_EVENT_LOAD, event_load, "load" },
{ ZONE_EVENT_REFRESH, event_refresh, "refresh" },
{ ZONE_EVENT_XFER, event_xfer, "transfer" },
{ ZONE_EVENT_UPDATE, event_update, "update" },
{ ZONE_EVENT_EXPIRE, event_expire, "expiration" },
{ ZONE_EVENT_FLUSH, event_flush, "journal flush" },
{ ZONE_EVENT_NOTIFY, event_notify, "notify" },
{ ZONE_EVENT_DNSSEC, event_dnssec, "DNSSEC resign" },
{ 0 }
};
static const event_info_t *get_event_info(zone_event_type_t type)
......@@ -152,8 +149,6 @@ static void reschedule(zone_events_t *events)
evsched_schedule(events->event, diff * 1000);
}
/* -- callbacks control ----------------------------------------------------- */
/*!
* \brief Zone event wrapper, expected to be called from a worker thread.
*
......@@ -181,10 +176,21 @@ static void event_wrap(task_t *task)
pthread_mutex_unlock(&events->mx);
const event_info_t *info = get_event_info(type);
int result = info->callback(zone);
if (result != KNOT_EOK) {
log_zone_error(zone->name, "zone %s failed (%s)", info->name,
knot_strerror(result));
/* Create a configuration copy just for this event. */
conf_t *conf;
rcu_read_lock();
int ret = conf_clone(&conf);
rcu_read_unlock();
if (ret == KNOT_EOK) {
/* Execute the event callback. */
ret = info->callback(conf, zone);
conf_free(conf);
}
if (ret != KNOT_EOK) {
log_zone_error(zone->name, "zone event '%s' failed (%s)",
info->name, knot_strerror(ret));
}
pthread_mutex_lock(&events->mx);
......@@ -213,8 +219,6 @@ static int event_dispatch(event_t *event)
return KNOT_EOK;
}
/* -- public API ------------------------------------------------------------ */
int zone_events_init(zone_t *zone)
{
if (!zone) {
......@@ -407,14 +411,14 @@ time_t zone_events_get_next(const struct zone *zone, zone_event_type_t *type)
return next_time;
}
void zone_events_update(zone_t *zone, zone_t *old_zone)
void zone_events_update(conf_t *conf, zone_t *zone, zone_t *old_zone)
{
replan_events(zone, old_zone);
replan_events(conf, zone, old_zone);
}
void zone_events_replan_ddns(struct zone *zone, const struct zone *old_zone)
void zone_events_replan_ddns(zone_t *zone, zone_t *old_zone)
{
if (old_zone) {
replan_update(zone, (zone_t *)old_zone);
replan_update(zone, old_zone);
}
}
......@@ -20,6 +20,7 @@
#include <stdbool.h>
#include <sys/time.h>
#include "knot/conf/conf.h"
#include "knot/common/evsched.h"
#include "knot/worker/pool.h"
#include "libknot/db/db.h"
......@@ -189,10 +190,11 @@ time_t zone_events_get_next(const struct zone *zone, zone_event_type_t *type);
/*!
* \brief Replans zone events after config change. Will reuse events where applicable.
*
* \param conf Configuration.
* \param zone Zone with new config.
* \param old_zone Zone with old config.
*/
void zone_events_update(struct zone *zone, struct zone *old_zone);
void zone_events_update(conf_t *conf, struct zone *zone, struct zone *old_zone);
/*!
* \brief Replans DDNS processing event if DDNS queue is not empty.
......@@ -200,4 +202,4 @@ void zone_events_update(struct zone *zone, struct zone *old_zone);
* \param zone Zone with new config.
* \param old_zone Zone with old config.
*/
void zone_events_replan_ddns(struct zone *zone, const struct zone *old_zone);
void zone_events_replan_ddns(struct zone *zone, struct zone *old_zone);
This diff is collapsed.
......@@ -16,24 +16,25 @@
#pragma once
#include "knot/conf/conf.h"
#include "knot/zone/zone.h"
/*! \brief Loads or reloads potentially changed zone. */
int event_load(zone_t *zone);
int event_load(conf_t *conf, zone_t *zone);
/*! \brief Sends a SOA query to master. */
int event_refresh(zone_t *zone);
int event_refresh(conf_t *conf, zone_t *zone);
/*! \brief Initiates transfer with master. */
int event_xfer(zone_t *zone);
int event_xfer(conf_t *conf, zone_t *zone);
/*! \brief Processes DDNS updates in the zone's DDNS queue. */
int event_update(zone_t *zone);
int event_update(conf_t *conf, zone_t *zone);
/*! \brief Empties in-memory zone contents. */
int event_expire(zone_t *zone);
int event_expire(conf_t *conf, zone_t *zone);
/*! \brief Flushes zone contents into text file. */
int event_flush(zone_t *zone);
int event_flush(conf_t *conf, zone_t *zone);
/*! \brief Sends notify to slaves. */
int event_notify(zone_t *zone);
int event_notify(conf_t *conf, zone_t *zone);
/*! \brief (re)Signs the zone using its DNSSEC keys. */
int event_dnssec(zone_t *zone);
int event_dnssec(conf_t *conf, zone_t *zone);
/*! \brief Progressive bootstrap retry timer. */
uint32_t bootstrap_next(uint32_t timer);
......@@ -33,14 +33,14 @@ static void replan_event(zone_t *zone, const zone_t *old_zone, zone_event_type_t
}
/*!< \brief Replans events that are dependent on the SOA record. */
static void replan_soa_events(zone_t *zone, const zone_t *old_zone)
static void replan_soa_events(conf_t *conf, zone_t *zone, const zone_t *old_zone)
{
if (!zone_is_slave(zone)) {
if (!zone_is_slave(conf, zone)) {
// Events only valid for slaves.
return;
}
if (zone_is_slave(old_zone)) {
if (zone_is_slave(conf, old_zone)) {
// Replan SOA events.
replan_event(zone, old_zone, ZONE_EVENT_REFRESH);
replan_event(zone, old_zone, ZONE_EVENT_EXPIRE);
......@@ -56,14 +56,14 @@ static void replan_soa_events(zone_t *zone, const zone_t *old_zone)
}
/*!< \brief Replans transfer event. */
static void replan_xfer(zone_t *zone, const zone_t *old_zone)
static void replan_xfer(conf_t *conf, zone_t *zone, const zone_t *old_zone)
{
if (!zone_is_slave(zone)) {
if (!zone_is_slave(conf, zone)) {
// Only valid for slaves.
return;
}
if (zone_is_slave(old_zone)) {
if (zone_is_slave(conf, old_zone)) {
// Replan the transfer from old zone.
replan_event(zone, old_zone, ZONE_EVENT_XFER);
} else if (zone_contents_is_empty(zone->contents)) {
......@@ -74,9 +74,9 @@ static void replan_xfer(zone_t *zone, const zone_t *old_zone)
}
/*!< \brief Replans flush event. */
static void replan_flush(zone_t *zone, const zone_t *old_zone)
static void replan_flush(conf_t *conf, zone_t *zone, const zone_t *old_zone)
{
conf_val_t val = conf_zone_get(conf(), C_ZONEFILE_SYNC, zone->name);
conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
int64_t sync_timeout = conf_int(&val);
if (sync_timeout <= 0) {
// Immediate sync scheduled after events.
......@@ -109,9 +109,9 @@ static void duplicate_ddns_q(zone_t *zone, zone_t *old_zone)
}
/*!< Replans DNSSEC event. Not whole resign needed, \todo #247 */
static void replan_dnssec(zone_t *zone)
static void replan_dnssec(conf_t *conf, zone_t *zone)
{
conf_val_t val = conf_zone_get(conf(), C_DNSSEC_SIGNING, zone->name);
conf_val_t val = conf_zone_get(conf, C_DNSSEC_SIGNING, zone->name);
if (conf_bool(&val)) {
/* Keys could have changed, force resign. */
zone_events_schedule(zone, ZONE_EVENT_DNSSEC, ZONE_EVENT_NOW);
......@@ -131,12 +131,12 @@ void replan_update(zone_t *zone, zone_t *old_zone)
}
}
void replan_events(zone_t *zone, zone_t *old_zone)
void replan_events(conf_t *conf, zone_t *zone, zone_t *old_zone)
{
replan_soa_events(zone, old_zone);
replan_xfer(zone, old_zone);
replan_flush(zone, old_zone);
replan_soa_events(conf, zone, old_zone);
replan_xfer(conf, zone, old_zone);
replan_flush(conf, zone, old_zone);
replan_event(zone, old_zone, ZONE_EVENT_NOTIFY);
replan_update(zone, old_zone);
replan_dnssec(zone);
replan_dnssec(conf, zone);
}
......@@ -16,10 +16,11 @@
#pragma once
#include "knot/conf/conf.h"
#include "knot/zone/zone.h"
/*! \brief Replans zone's events using old zone. */
void replan_events(zone_t *zone, zone_t *old_zone);
void replan_events(conf_t *conf, zone_t *zone, zone_t *old_zone);
/*! \brief Replans zone's DDNS events using old zone's DDNS queue. */
void replan_update(zone_t *zone, zone_t *old_zone);
......@@ -77,8 +77,6 @@ enum node_flags {
NODE_FLAGS_WILDCARD_CHILD = 1 << 4
};
/* ------------------------- Node create/free --------------------------------*/
/*!
* \brief Creates and initializes new node structure.
*
......@@ -119,8 +117,6 @@ void node_free(zone_node_t **node, knot_mm_t *mm);
*/
zone_node_t *node_shallow_copy(const zone_node_t *src, knot_mm_t *mm);
/* ----------------------- Data addition/removal -----------------------------*/
/*!
* \brief Adds an RRSet to the node. All data are copied. Owner and class are
* not used at all.
......@@ -140,8 +136,6 @@ int node_add_rrset(zone_node_t *node, const knot_rrset_t *rrset, knot_mm_t *mm);
*/
void node_remove_rdataset(zone_node_t *node, uint16_t type);
/* ---------------------------- Data getters ---------------------------------*/
/*!
* \brief Returns the RRSet of the given type from the node. RRSet is allocated.
*
......@@ -163,8 +157,6 @@ knot_rrset_t *node_create_rrset(const zone_node_t *node, uint16_t type);
*/
knot_rdataset_t *node_rdataset(const zone_node_t *node, uint16_t type);
/* ---------------------------- Parent setter ------------------------------- */
/*!
* \brief Sets the parent of the node. Also adjusts children count of parent.
*
......@@ -173,8 +165,6 @@ knot_rdataset_t *node_rdataset(const zone_node_t *node, uint16_t type);
*/
void node_set_parent(zone_node_t *node, zone_node_t *parent);
/* ----------------------------- Bool checks -------------------------------- */
/*!
* \brief Checks whether node contains any RRSIG for given type.
*
......@@ -205,8 +195,6 @@ bool node_rrtype_exists(const zone_node_t *node, uint16_t type);
*/
bool node_empty(const zone_node_t *node);
/* -------------------- Inline RRSet initializations ------------------------ */
/*!
* \brief Returns RRSet structure initialized with data from node.
*
......
......@@ -14,13 +14,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/