]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add dns_zone_isexpired API
authorColin Vidal <colin@isc.org>
Fri, 31 Oct 2025 11:12:20 +0000 (12:12 +0100)
committerColin Vidal <colin@isc.org>
Mon, 3 Nov 2025 16:34:25 +0000 (17:34 +0100)
Introduce the `dns_zone_isexpired()` API which returns `true` when a
secondary, mirror, etc. zone is expired.

This internally use the `DNS_ZONEFLG_EXPIRED` which was already set when
the zone gets expired, but never used.

The flag `DNS_ZONEFLG_EXPIRED` is also now cleared when the expiration
time of the zone is updated and in the future.

lib/dns/include/dns/zone.h
lib/dns/zone.c

index b45c842c9a60bdc1d2185b3094745c4bd4075f5a..70b79471a4ada09667fa05f4db9f8ead6fc7f1af 100644 (file)
@@ -2792,6 +2792,15 @@ dns_zone_getcfg(dns_zone_t *zone);
  * \li 'zone' to be a valid zone.
  */
 
+bool
+dns_zone_isexpired(dns_zone_t *zone);
+/*%<
+ * Return true if a (secondary, mirror, etc.) zone is expired
+ *
+ * Requires:
+ * \li  'zone\ to be a valid zone.
+ */
+
 #if DNS_ZONE_TRACE
 #define dns_zone_ref(ptr)   dns_zone__ref(ptr, __func__, __FILE__, __LINE__)
 #define dns_zone_unref(ptr) dns_zone__unref(ptr, __func__, __FILE__, __LINE__)
index d0bc8b65c4b5115b9ff2c4d867f81888665b3e03..a196d5b96cbcdf7a5c5a82143d8f963da4eacd09 100644 (file)
@@ -17617,6 +17617,7 @@ again:
                    isc_time_compare(&expiretime, &zone->expiretime) > 0)
                {
                        zone->expiretime = expiretime;
+                       DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_EXPIRED);
                }
 
                /*
@@ -24249,3 +24250,10 @@ dns_zone_getcfg(dns_zone_t *zone) {
 
        return zone->cfg;
 }
+
+bool
+dns_zone_isexpired(dns_zone_t *zone) {
+       REQUIRE(DNS_ZONE_VALID(zone));
+
+       return DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXPIRED);
+}