summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Hák <jan.hak@nic.cz>2024-11-26 12:56:51 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2024-12-11 17:36:20 +0100
commit87552b9c572947ef36c29a3a92e909bd13d29bb7 (patch)
tree215aa5c0d357d029e2e1dd3bf3415e984d2a9394
parentbackup: fix usage of new atomic in code (variable backup_ctx) (diff)
downloadknot-87552b9c572947ef36c29a3a92e909bd13d29bb7.tar.xz
knot-87552b9c572947ef36c29a3a92e909bd13d29bb7.zip
dnssec: fix usage of new atomic in code (variable dnssec_expire)
-rw-r--r--src/knot/dnssec/zone-events.c6
-rw-r--r--src/knot/zone/contents.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/knot/dnssec/zone-events.c b/src/knot/dnssec/zone-events.c
index 811b3dc14..87acb32fd 100644
--- a/src/knot/dnssec/zone-events.c
+++ b/src/knot/dnssec/zone-events.c
@@ -317,7 +317,7 @@ done:
if (result == KNOT_EOK) {
reschedule->next_sign = schedule_next(&ctx, &keyset, ctx.offline_next_time, ctx.stats->expire);
reschedule->plan_dnskey_sync = ctx.policy->has_dnskey_sync;
- update->new_cont->dnssec_expire = ctx.stats->expire;
+ ATOMIC_SET(update->new_cont->dnssec_expire, ctx.stats->expire);
update->flags |= UPDATE_SIGNED_FULL;
} else {
reschedule->next_sign = knot_dnssec_failover_delay(&ctx);
@@ -457,7 +457,9 @@ done:
if (ctx.policy->has_dnskey_sync) {
zone_events_schedule_now(update->zone, ZONE_EVENT_DNSKEY_SYNC);
}
- update->new_cont->dnssec_expire = knot_time_min(update->zone->contents->dnssec_expire, ctx.stats->expire);
+ ATOMIC_SET(update->new_cont->dnssec_expire,
+ (uint64_t)knot_time_min(ATOMIC_GET(update->zone->contents->dnssec_expire),
+ ctx.stats->expire));
}
free_zone_keys(&keyset);
diff --git a/src/knot/zone/contents.c b/src/knot/zone/contents.c
index 8a32cc87e..e2d00d4c5 100644
--- a/src/knot/zone/contents.c
+++ b/src/knot/zone/contents.c
@@ -192,6 +192,7 @@ zone_contents_t *zone_contents_new(const knot_dname_t *apex_name, bool use_binod
}
contents->apex->flags |= NODE_FLAGS_APEX;
contents->max_ttl = UINT32_MAX;
+ ATOMIC_INIT(contents->dnssec_expire, 0);
return contents;
@@ -522,6 +523,8 @@ void zone_contents_free(zone_contents_t *contents)
dnssec_nsec3_params_free(&contents->nsec3_params);
additionals_tree_free(contents->adds_tree);
+ ATOMIC_DEINIT(contents->dnssec_expire);
+
free(contents);
}