mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-02-03 18:49:28 -05:00
server: extend 'zone-update-error' to cover more situations
This extends 5d164cefa9
This commit is contained in:
parent
8458300a50
commit
87641cff05
8 changed files with 34 additions and 17 deletions
|
|
@ -993,12 +993,14 @@ static int zone_txn_commit_l(zone_t *zone, _unused_ ctl_args_t *args)
|
||||||
}
|
}
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
zone_control_clear(zone);
|
zone_control_clear(zone);
|
||||||
|
zone_update_error(conf(), zone);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = zone_update_commit(conf(), zone->control_update);
|
ret = zone_update_commit(conf(), zone->control_update);
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
zone_control_clear(zone);
|
zone_control_clear(zone);
|
||||||
|
zone_update_error(conf(), zone);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ done:
|
||||||
|
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
zone_update_clear(&up);
|
zone_update_clear(&up);
|
||||||
|
zone_update_error(conf, zone);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -538,5 +538,12 @@ cleanup:
|
||||||
zone_skip_free(&skip);
|
zone_skip_free(&skip);
|
||||||
zone->started = true;
|
zone->started = true;
|
||||||
|
|
||||||
return (dontcare_load_error(conf, zone) ? KNOT_EOK : ret);
|
if (dontcare_load_error(conf, zone)) {
|
||||||
|
ret = KNOT_EOK;
|
||||||
|
}
|
||||||
|
if (ret != KNOT_EOK) {
|
||||||
|
zone_update_error(conf, zone);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1265,6 +1265,7 @@ static int transfer_consume(knot_layer_t *layer, knot_pkt_t *pkt)
|
||||||
if (data->ret == KNOT_EOK) {
|
if (data->ret == KNOT_EOK) {
|
||||||
data->updated = true;
|
data->updated = true;
|
||||||
} else {
|
} else {
|
||||||
|
zone_update_error(data->conf, data->zone);
|
||||||
next = KNOT_STATE_FAIL;
|
next = KNOT_STATE_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,7 @@ static void process_requests(conf_t *conf, zone_t *zone, list_t *requests)
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
log_zone_error(zone->name, "DDNS, processing failed (%s)",
|
log_zone_error(zone->name, "DDNS, processing failed (%s)",
|
||||||
knot_strerror(ret));
|
knot_strerror(ret));
|
||||||
|
zone_update_error(conf, zone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1150,7 +1150,7 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
ret = commit_full(conf, update);
|
ret = commit_full(conf, update);
|
||||||
}
|
}
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf_val_t thr = conf_zone_get(conf, C_ADJUST_THR, update->zone->name);
|
conf_val_t thr = conf_zone_get(conf, C_ADJUST_THR, update->zone->name);
|
||||||
|
|
@ -1161,7 +1161,7 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
}
|
}
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the zone size. */
|
/* Check the zone size. */
|
||||||
|
|
@ -1170,8 +1170,7 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
|
|
||||||
if (update->new_cont->size > size_limit) {
|
if (update->new_cont->size > size_limit) {
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
ret = KNOT_EZONESIZE;
|
return KNOT_EZONESIZE;
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val = conf_zone_get(conf, C_DNSSEC_VALIDATION, update->zone->name);
|
val = conf_zone_get(conf, C_DNSSEC_VALIDATION, update->zone->name);
|
||||||
|
|
@ -1184,7 +1183,7 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
ret = knot_dnssec_validate_zone(update, &val_conf);
|
ret = knot_dnssec_validate_zone(update, &val_conf);
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1193,7 +1192,7 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
ret = zone_update_external(conf, update, &val);
|
ret = zone_update_external(conf, update, &val);
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1201,21 +1200,21 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
log_zone_error(update->zone->name, "failed to process catalog zone (%s)", knot_strerror(ret));
|
log_zone_error(update->zone->name, "failed to process catalog zone (%s)", knot_strerror(ret));
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = commit_redis(conf, update);
|
ret = commit_redis(conf, update);
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
log_zone_error(update->zone->name, "zone database update failed (%s)", knot_strerror(ret));
|
log_zone_error(update->zone->name, "zone database update failed (%s)", knot_strerror(ret));
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = commit_journal(conf, update);
|
ret = commit_journal(conf, update);
|
||||||
if (ret != KNOT_EOK) {
|
if (ret != KNOT_EOK) {
|
||||||
log_zone_error(update->zone->name, "journal update failed (%s)", knot_strerror(ret));
|
log_zone_error(update->zone->name, "journal update failed (%s)", knot_strerror(ret));
|
||||||
discard_adds_tree(update);
|
discard_adds_tree(update);
|
||||||
goto error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dnssec) {
|
if (dnssec) {
|
||||||
|
|
@ -1268,13 +1267,6 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
|
||||||
memset(update, 0, sizeof(*update));
|
memset(update, 0, sizeof(*update));
|
||||||
|
|
||||||
return KNOT_EOK;
|
return KNOT_EOK;
|
||||||
error:
|
|
||||||
ATOMIC_ADD(update->zone->server->stats.zone_update_error, 1);
|
|
||||||
if (conf->cache.srv_dbus_event & DBUS_EVENT_ZONE_UPDATED) {
|
|
||||||
dbus_emit_zone_updated(update->zone->name, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zone_update_no_change(zone_update_t *update)
|
bool zone_update_no_change(zone_update_t *update)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <urcu.h>
|
#include <urcu.h>
|
||||||
|
|
||||||
|
#include "knot/common/dbus.h"
|
||||||
#include "knot/common/log.h"
|
#include "knot/common/log.h"
|
||||||
#include "knot/conf/module.h"
|
#include "knot/conf/module.h"
|
||||||
#include "knot/dnssec/kasp/kasp_db.h"
|
#include "knot/dnssec/kasp/kasp_db.h"
|
||||||
|
|
@ -1034,3 +1035,13 @@ time_t zone_bootstrap_next(uint8_t *count)
|
||||||
// Add a random delay to prevent burst refresh.
|
// Add a random delay to prevent burst refresh.
|
||||||
return increment + dnssec_random_uint16_t() % MIN(30, (1 + *count) * 5);
|
return increment + dnssec_random_uint16_t() % MIN(30, (1 + *count) * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void zone_update_error(conf_t *conf, zone_t *zone)
|
||||||
|
{
|
||||||
|
if (conf != NULL && zone != NULL) {
|
||||||
|
ATOMIC_ADD(zone->server->stats.zone_update_error, 1);
|
||||||
|
if (conf->cache.srv_dbus_event & DBUS_EVENT_ZONE_UPDATED) {
|
||||||
|
dbus_emit_zone_updated(zone->name, false, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -339,3 +339,5 @@ int zone_get_lastsigned_serial(zone_t *zone, uint32_t *serial);
|
||||||
int slave_zone_serial(zone_t *zone, conf_t *conf, uint32_t *serial);
|
int slave_zone_serial(zone_t *zone, conf_t *conf, uint32_t *serial);
|
||||||
|
|
||||||
time_t zone_bootstrap_next(uint8_t *count);
|
time_t zone_bootstrap_next(uint8_t *count);
|
||||||
|
|
||||||
|
void zone_update_error(conf_t *conf, zone_t *zone);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue