From: Mark Andrews Date: Thu, 29 Aug 2024 01:26:58 +0000 (+1000) Subject: Add dns_db_getzoneversion X-Git-Tag: v9.21.7~34^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c126a7e66871063a3e92e4e4280d8003f46c4c8;p=thirdparty%2Fbind9.git Add dns_db_getzoneversion Provides a database method to return a database specific EDNS ZONEVERSION option. The default EDNS ZONEVERSION is serial. --- diff --git a/lib/dns/db.c b/lib/dns/db.c index 90ac276bc53..a623dbaf929 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -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; +} diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index fd8ab3323a1..e53f8a92e83 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -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 + */