Commit a5f0f80c28 for bind
commit a5f0f80c280ef0dc5be79d9b82b45e95b8721f23
Author: Matthijs Mekking <matthijs@isc.org>
Date: Thu Oct 1 12:28:29 2026 +0200
Move notifytime into notify context
In preparation for implementing notify-defer for NOTIFY(CDS), let's move
the time into the generic structure.
diff --git a/lib/dns/include/dns/notify.h b/lib/dns/include/dns/notify.h
index 96fe7d20c8..8aff1f6dad 100644
--- a/lib/dns/include/dns/notify.h
+++ b/lib/dns/include/dns/notify.h
@@ -33,6 +33,7 @@ struct dns_notifyctx {
dns_rdatatype_t type;
dns_notifylist_t notifies;
+ isc_time_t notifytime;
/* Configuration data. */
dns_notifytype_t notifytype;
@@ -70,7 +71,7 @@ typedef enum dns_notify_flags {
} dns_notify_flags_t;
void
-dns_notifyctx_init(dns_notifyctx_t *nctx, dns_rdatatype_t type);
+dns_notifyctx_init(dns_notifyctx_t *nctx, dns_rdatatype_t type, isc_time_t now);
/*%
* Initializes a notify context for the RRtype 'type'.
*
diff --git a/lib/dns/notify.c b/lib/dns/notify.c
index b2f67ebc41..2b22a3f346 100644
--- a/lib/dns/notify.c
+++ b/lib/dns/notify.c
@@ -16,6 +16,7 @@
#include <isc/netmgr.h>
#include <isc/ratelimiter.h>
#include <isc/result.h>
+#include <isc/time.h>
#include <dns/adb.h>
#include <dns/notify.h>
@@ -42,10 +43,12 @@ notify_log(dns_notify_t *notify, int level, const char *fmt, ...) {
}
void
-dns_notifyctx_init(dns_notifyctx_t *nctx, dns_rdatatype_t type) {
+dns_notifyctx_init(dns_notifyctx_t *nctx, dns_rdatatype_t type,
+ isc_time_t now) {
dns_notifyctx_t ctx = {
.type = type,
.notifytype = dns_notifytype_yes,
+ .notifytime = now,
.notifydelay = 5,
.notifies = ISC_LIST_INITIALIZER,
};
diff --git a/lib/dns/zone.c b/lib/dns/zone.c
index 8c120e8d77..2ce44d29d8 100644
--- a/lib/dns/zone.c
+++ b/lib/dns/zone.c
@@ -505,7 +505,6 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, isc_tid_t tid) {
.requestexpire = true,
.updatemethod = dns_updatemethod_increment,
.tid = tid,
- .notifytime = now,
.newincludes = ISC_LIST_INITIALIZER,
.checkds_requests = ISC_LIST_INITIALIZER,
.signing = ISC_LIST_INITIALIZER,
@@ -533,8 +532,8 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, isc_tid_t tid) {
zone->defaultkasp = NULL;
ISC_LIST_INIT(zone->keyring);
- dns_notifyctx_init(&zone->notifysoa, dns_rdatatype_soa);
- dns_notifyctx_init(&zone->notifycds, dns_rdatatype_cds);
+ dns_notifyctx_init(&zone->notifysoa, dns_rdatatype_soa, now);
+ dns_notifyctx_init(&zone->notifycds, dns_rdatatype_cds, now);
isc_stats_create(mctx, &zone->gluecachestats,
dns_gluecachestatscounter_max);
@@ -10073,19 +10072,19 @@ zone_maintenance(dns_zone_t *zone) {
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOTIFYNODEFER) &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOTIFYDEFERRED))
{
- if (isc_time_compare(&now, &zone->notifytime) > 0) {
- zone->notifytime = now;
+ if (isc_time_compare(&now, &zone->notifysoa.notifytime) > 0) {
+ zone->notifysoa.notifytime = now;
}
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOTIFYDEFERRED);
- DNS_ZONE_TIME_ADD(&zone->notifytime,
+ DNS_ZONE_TIME_ADD(&zone->notifysoa.notifytime,
zone->notifysoa.notifydefer,
- &zone->notifytime);
+ &zone->notifysoa.notifytime);
}
notify = (zone->type == dns_zone_secondary ||
zone->type == dns_zone_mirror) &&
(DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) ||
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY)) &&
- isc_time_compare(&now, &zone->notifytime) >= 0;
+ isc_time_compare(&now, &zone->notifysoa.notifytime) >= 0;
UNLOCK_ZONE(zone);
if (notify) {
@@ -10135,7 +10134,8 @@ zone_maintenance(dns_zone_t *zone) {
LOCK_ZONE(zone);
notify = (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) ||
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY)) &&
- isc_time_compare(&now, &zone->notifytime) >= 0;
+ isc_time_compare(&now, &zone->notifysoa.notifytime) >=
+ 0;
UNLOCK_ZONE(zone);
if (notify) {
zone_notify(zone, &now);
@@ -11024,9 +11024,9 @@ dns_zone_notify(dns_zone_t *zone, bool nodefer) {
* operation.
*/
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NOTIFYDEFERRED);
- DNS_ZONE_TIME_SUBTRACT(&zone->notifytime,
+ DNS_ZONE_TIME_SUBTRACT(&zone->notifysoa.notifytime,
zone->notifysoa.notifydefer,
- &zone->notifytime);
+ &zone->notifysoa.notifytime);
}
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOTIFYNODEFER);
}
@@ -11065,7 +11065,8 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
DNS_ZONEFLG_NOTIFYNODEFER |
DNS_ZONEFLG_NOTIFYDEFERRED);
notifytype = zone->notifysoa.notifytype;
- DNS_ZONE_TIME_ADD(now, zone->notifysoa.notifydelay, &zone->notifytime);
+ DNS_ZONE_TIME_ADD(now, zone->notifysoa.notifydelay,
+ &zone->notifysoa.notifytime);
UNLOCK_ZONE(zone);
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) ||
@@ -13344,7 +13345,7 @@ zone__settimer(void *arg) {
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) ||
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY))
{
- next = zone->notifytime;
+ next = zone->notifysoa.notifytime;
}
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP) &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DUMPING))
@@ -13376,7 +13377,7 @@ zone__settimer(void *arg) {
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) ||
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY))
{
- next = zone->notifytime;
+ next = zone->notifysoa.notifytime;
}
FALLTHROUGH;
case dns_zone_stub:
diff --git a/lib/dns/zone_p.h b/lib/dns/zone_p.h
index ae93941540..7d5e01b13b 100644
--- a/lib/dns/zone_p.h
+++ b/lib/dns/zone_p.h
@@ -473,7 +473,6 @@ struct dns_zone {
isc_time_t refreshtime;
isc_time_t dumptime;
isc_time_t loadtime;
- isc_time_t notifytime;
isc_time_t resigntime;
isc_time_t keywarntime;
isc_time_t signingtime;