Commit 1ae535848b for bind
commit 1ae535848b692f8a834c21c11a4784b1da94bb13
Author: Matthijs Mekking <matthijs@isc.org>
Date: Thu Oct 1 14:32:24 2026 +0200
Add flags to notify context
And corresponding set, clear and has functions.
diff --git a/lib/dns/include/dns/notify.h b/lib/dns/include/dns/notify.h
index 8aff1f6dad..7cdffa8f0c 100644
--- a/lib/dns/include/dns/notify.h
+++ b/lib/dns/include/dns/notify.h
@@ -32,8 +32,9 @@ struct dns_notifyctx {
dns_rdatatype_t type;
- dns_notifylist_t notifies;
- isc_time_t notifytime;
+ dns_notifylist_t notifies;
+ isc_time_t notifytime;
+ atomic_uint_fast64_t flags;
/* Configuration data. */
dns_notifytype_t notifytype;
@@ -148,3 +149,34 @@ dns_notify_cancel(dns_notifyctx_t *nctx);
* Requires:
* 'nctx' is not NULL
*/
+
+void
+dns_notifyctx_setflag(dns_notifyctx_t *nctx, unsigned int flag);
+/*%<
+ * Set flag on notify context. The corresponding zone must be locked.
+ *
+ * Requires:
+ * 'nctx' is not NULL
+ */
+
+void
+dns_notifyctx_clearflag(dns_notifyctx_t *nctx, unsigned int flag);
+/*%<
+ * Clear flag on notify context. The corresponding zone must be locked.
+ *
+ * Requires:
+ * 'nctx' is not NULL
+ */
+
+bool
+dns_notifyctx_hasflag(dns_notifyctx_t *nctx, unsigned int flag);
+/*%<
+ * Check flag on notify context. The corresponding zone must be locked.
+ *
+ * Requires:
+ * 'nctx' is not NULL
+ *
+ * Returns:
+ * true if the flag is set
+ * false otherwise
+ */
diff --git a/lib/dns/notify.c b/lib/dns/notify.c
index 2b22a3f346..57da082a5d 100644
--- a/lib/dns/notify.c
+++ b/lib/dns/notify.c
@@ -32,6 +32,13 @@
#include "zone_p.h"
+/*%
+ * Notify and notify context flags.
+ */
+#define NOTIFY_FLAG(n, f) ((atomic_load_relaxed(&(n)->flags) & (f)) != 0)
+#define NOTIFY_SETFLAG(n, f) atomic_fetch_or(&(n)->flags, (f))
+#define NOTIFY_CLRFLAG(n, f) atomic_fetch_and(&(n)->flags, ~(f))
+
static void
notify_log(dns_notify_t *notify, int level, const char *fmt, ...) {
va_list ap;
@@ -800,3 +807,21 @@ dns_notify_cancel(dns_notifyctx_t *nctx) {
}
}
}
+
+void
+dns_notifyctx_setflag(dns_notifyctx_t *nctx, unsigned int flag) {
+ REQUIRE(nctx != NULL);
+ NOTIFY_SETFLAG(nctx, flag);
+}
+
+void
+dns_notifyctx_clearflag(dns_notifyctx_t *nctx, unsigned int flag) {
+ REQUIRE(nctx != NULL);
+ NOTIFY_CLRFLAG(nctx, flag);
+}
+
+bool
+dns_notifyctx_hasflag(dns_notifyctx_t *nctx, unsigned int flag) {
+ REQUIRE(nctx != NULL);
+ return NOTIFY_FLAG(nctx, flag);
+}