summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2018-10-19 14:07:15 +0200
committerDaniel Salzman <daniel.salzman@nic.cz>2018-10-19 14:07:15 +0200
commit85e70fa277771b15654c71a5c27ca3203aaf2def (patch)
tree90c454c2bad1a3263f83cb361c36b2a97a926826
parentlibknot: remove lmdb_LIBS from the pkg-config file if embedded LMDB is used (diff)
parentevents: fixed re-planning dnssec after empty update (diff)
downloadknot-85e70fa277771b15654c71a5c27ca3203aaf2def.tar.xz
knot-85e70fa277771b15654c71a5c27ca3203aaf2def.zip
Merge branch 'fix_unplanned_re_sign' into 'master'
Fix unplanned re sign See merge request knot/knot-dns!939
-rw-r--r--Knot.files2
-rw-r--r--src/knot/Makefile.inc2
-rw-r--r--src/knot/ctl/commands.c5
-rw-r--r--src/knot/events/handlers/dnssec.c21
-rw-r--r--src/knot/events/handlers/load.c1
-rw-r--r--src/knot/events/handlers/refresh.c1
-rw-r--r--src/knot/events/log.c27
-rw-r--r--src/knot/events/log.h22
-rw-r--r--src/knot/nameserver/update.c5
9 files changed, 19 insertions, 67 deletions
diff --git a/Knot.files b/Knot.files
index e5bf98610..767e039ed 100644
--- a/Knot.files
+++ b/Knot.files
@@ -132,8 +132,6 @@ src/knot/events/handlers/nsec3resalt.c
src/knot/events/handlers/parent_ds_query.c
src/knot/events/handlers/refresh.c
src/knot/events/handlers/update.c
-src/knot/events/log.c
-src/knot/events/log.h
src/knot/events/replan.c
src/knot/events/replan.h
src/knot/include/module.h
diff --git a/src/knot/Makefile.inc b/src/knot/Makefile.inc
index ab29dc6be..fc3700caa 100644
--- a/src/knot/Makefile.inc
+++ b/src/knot/Makefile.inc
@@ -73,8 +73,6 @@ libknotd_la_SOURCES = \
knot/events/handlers/refresh.c \
knot/events/handlers/update.c \
knot/events/handlers/parent_ds_query.c \
- knot/events/log.c \
- knot/events/log.h \
knot/events/replan.c \
knot/events/replan.h \
knot/nameserver/axfr.c \
diff --git a/src/knot/ctl/commands.c b/src/knot/ctl/commands.c
index 10971b5b4..7773b7161 100644
--- a/src/knot/ctl/commands.c
+++ b/src/knot/ctl/commands.c
@@ -24,7 +24,7 @@
#include "knot/ctl/commands.h"
#include "knot/dnssec/key-events.h"
#include "knot/events/events.h"
-#include "knot/events/log.h"
+#include "knot/events/handlers.h"
#include "knot/nameserver/query_module.h"
#include "knot/updates/zone-update.h"
#include "knot/zone/timers.h"
@@ -474,8 +474,7 @@ static int zone_txn_commit(zone_t *zone, ctl_args_t *args)
zone_txn_update_clear(zone);
return ret;
}
- log_dnssec_next(zone->name, (time_t)resch.next_sign);
- zone_events_schedule_at(zone, ZONE_EVENT_DNSSEC, (time_t)resch.next_sign);
+ event_dnssec_reschedule(conf(), zone, &resch, false);
}
int ret = zone_update_commit(conf(), zone->control_update);
diff --git a/src/knot/events/handlers/dnssec.c b/src/knot/events/handlers/dnssec.c
index ec433107c..8171e4f6b 100644
--- a/src/knot/events/handlers/dnssec.c
+++ b/src/knot/events/handlers/dnssec.c
@@ -19,11 +19,24 @@
#include "knot/common/log.h"
#include "knot/conf/conf.h"
#include "knot/dnssec/zone-events.h"
-#include "knot/events/log.h"
#include "knot/updates/apply.h"
#include "knot/zone/zone.h"
#include "libknot/errcode.h"
+static void log_dnssec_next(const knot_dname_t *zone, knot_time_t refresh_at)
+{
+ char time_str[64] = { 0 };
+ struct tm time_gm = { 0 };
+ time_t refresh = refresh_at;
+ localtime_r(&refresh, &time_gm);
+ strftime(time_str, sizeof(time_str), KNOT_LOG_TIME_FORMAT, &time_gm);
+ if (refresh_at == 0) {
+ log_zone_warning(zone, "DNSSEC, next signing not scheduled");
+ } else {
+ log_zone_info(zone, "DNSSEC, next signing at %s", time_str);
+ }
+}
+
void event_dnssec_reschedule(conf_t *conf, zone_t *zone,
const zone_sign_reschedule_t *refresh, bool zone_changed)
{
@@ -35,10 +48,6 @@ void event_dnssec_reschedule(conf_t *conf, zone_t *zone,
refresh_at = refresh->next_rollover;
}
- if (refresh_at <= 0) {
- return;
- }
-
log_dnssec_next(zone->name, (time_t)refresh_at);
if (refresh->plan_ds_query) {
@@ -50,7 +59,7 @@ void event_dnssec_reschedule(conf_t *conf, zone_t *zone,
}
zone_events_schedule_at(zone,
- ZONE_EVENT_DNSSEC, (time_t)refresh_at,
+ ZONE_EVENT_DNSSEC, refresh_at ? (time_t)refresh_at : ignore,
ZONE_EVENT_PARENT_DS_Q, refresh->plan_ds_query ? now : ignore,
ZONE_EVENT_NSEC3RESALT, refresh->next_nsec3resalt ? refresh->next_nsec3resalt : ignore,
ZONE_EVENT_NOTIFY, zone_changed ? now : ignore
diff --git a/src/knot/events/handlers/load.c b/src/knot/events/handlers/load.c
index 3c73d952f..946543b42 100644
--- a/src/knot/events/handlers/load.c
+++ b/src/knot/events/handlers/load.c
@@ -21,7 +21,6 @@
#include "knot/dnssec/key-events.h"
#include "knot/dnssec/zone-events.h"
#include "knot/events/handlers.h"
-#include "knot/events/log.h"
#include "knot/events/replan.h"
#include "knot/zone/zone-diff.h"
#include "knot/zone/zone-load.h"
diff --git a/src/knot/events/handlers/refresh.c b/src/knot/events/handlers/refresh.c
index a82c00a8a..4cae45994 100644
--- a/src/knot/events/handlers/refresh.c
+++ b/src/knot/events/handlers/refresh.c
@@ -23,7 +23,6 @@
#include "knot/conf/conf.h"
#include "knot/dnssec/zone-events.h"
#include "knot/events/handlers.h"
-#include "knot/events/log.h"
#include "knot/events/replan.h"
#include "knot/nameserver/ixfr.h"
#include "knot/query/layer.h"
diff --git a/src/knot/events/log.c b/src/knot/events/log.c
deleted file mode 100644
index 6c819f130..000000000
--- a/src/knot/events/log.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2016 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 <https://www.gnu.org/licenses/>.
- */
-
-#include "knot/events/log.h"
-#include "knot/common/log.h"
-
-void log_dnssec_next(const knot_dname_t *zone, time_t refresh_at)
-{
- char time_str[64] = { 0 };
- 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 at %s", time_str);
-}
diff --git a/src/knot/events/log.h b/src/knot/events/log.h
deleted file mode 100644
index aa10d9279..000000000
--- a/src/knot/events/log.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 2016 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 <https://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <time.h>
-#include "libknot/dname.h"
-
-void log_dnssec_next(const knot_dname_t *zone, time_t refresh_at);
diff --git a/src/knot/nameserver/update.c b/src/knot/nameserver/update.c
index a309389db..08515242c 100644
--- a/src/knot/nameserver/update.c
+++ b/src/knot/nameserver/update.c
@@ -19,7 +19,7 @@
#include "libdnssec/random.h"
#include "knot/common/log.h"
#include "knot/dnssec/zone-events.h"
-#include "knot/events/log.h"
+#include "knot/events/handlers.h"
#include "knot/query/capture.h"
#include "knot/query/requestor.h"
#include "knot/nameserver/update.h"
@@ -167,8 +167,7 @@ static int process_normal(conf_t *conf, zone_t *zone, list_t *requests)
set_rcodes(requests, KNOT_RCODE_SERVFAIL);
return ret;
}
- log_dnssec_next(zone->name, (time_t)resch.next_sign);
- zone_events_schedule_at(zone, ZONE_EVENT_DNSSEC, (time_t)resch.next_sign);
+ event_dnssec_reschedule(conf, zone, &resch, false); // false since we handle NOTIFY after processing ddns queue
}
// Apply changes.