]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add dns_db_getzoneversion
authorMark Andrews <marka@isc.org>
Thu, 29 Aug 2024 01:26:58 +0000 (11:26 +1000)
committerMark Andrews <marka@isc.org>
Mon, 24 Mar 2025 22:16:09 +0000 (22:16 +0000)
Provides a database method to return a database specific EDNS
ZONEVERSION option.  The default EDNS ZONEVERSION is serial.

lib/dns/db.c
lib/dns/include/dns/db.h

index 90ac276bc53fb036343b788fb5499753ef0d57a0..a623dbaf929527732c4d139767b4ad0aa6a052c4 100644 (file)
@@ -1200,3 +1200,14 @@ dns__db_logtoomanyrecords(dns_db_t *db, const dns_name_t *name,
                (db->attributes & DNS_DBATTR_CACHE) != 0 ? "cache" : "zone",
                isc_result_totext(DNS_R_TOOMANYRECORDS), limit);
 }
+
+isc_result_t
+dns_db_getzoneversion(dns_db_t *db, isc_buffer_t *b) {
+       REQUIRE(db != NULL);
+       REQUIRE(b != NULL);
+
+       if (db->methods->getzoneversion != NULL) {
+               return (db->methods->getzoneversion)(db, b);
+       }
+       return ISC_R_NOTIMPLEMENTED;
+}
index fd8ab3323a1ef1823affd9da8fae9c7ca4df550e..e53f8a92e83389a7092db3768efa2a37af38f18b 100644 (file)
@@ -182,6 +182,7 @@ typedef struct dns_dbmethods {
                                     dns_name_t *name);
        void (*setmaxrrperset)(dns_db_t *db, uint32_t value);
        void (*setmaxtypepername)(dns_db_t *db, uint32_t value);
+       isc_result_t (*getzoneversion)(dns_db_t *db, isc_buffer_t *b);
 } dns_dbmethods_t;
 
 typedef isc_result_t (*dns_dbcreatefunc_t)(isc_mem_t       *mctx,
@@ -1805,3 +1806,21 @@ dns_db_setmaxtypepername(dns_db_t *db, uint32_t value);
  * stored at a given node, then any subsequent attempt to add an rdataset
  * with a new RR type will return ISC_R_TOOMANYRECORDS.
  */
+
+isc_result_t
+dns_db_getzoneversion(dns_db_t *db, isc_buffer_t *b);
+/*%<
+ * Provides a database specific EDNS ZONEVERSION option.
+ *
+ * Requires:
+ * \li 'db' is a valid database
+ * \li 'b' is a valid buffer
+ *
+ * Returns:
+ * \li ISC_R_SUCCESS when it has populated the buffer with the ZONEVERSION
+ *     response (maybe empty implying no ZONEVERSION to be returned).
+ * \li ISC_R_NOSPACE if the buffer is too small.
+ * \li ISC_R_NOTIMPLEMENTED if there is not a database specific
+ *     ZONEVERSION
+ * \li ISC_R_FAILURE other failures
+ */