The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.
It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.
(cherry picked from commit
4156995431290ed6ac1a96424fc3527a453ffb7c)
#include <dns/log.h>
#include <dns/master.h>
#include <dns/rdata.h>
+#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
(db->methods->setmaxtypepername)(db, value);
}
}
+
+void
+dns__db_logtoomanyrecords(dns_db_t *db, const dns_name_t *name,
+ dns_rdatatype_t type, const char *op,
+ uint32_t limit) {
+ char namebuf[DNS_NAME_FORMATSIZE];
+ char originbuf[DNS_NAME_FORMATSIZE];
+ char typebuf[DNS_RDATATYPE_FORMATSIZE];
+ char clsbuf[DNS_RDATACLASS_FORMATSIZE];
+
+ dns_name_format(name, namebuf, sizeof(namebuf));
+ dns_name_format(&db->origin, originbuf, sizeof(originbuf));
+ dns_rdatatype_format(type, typebuf, sizeof(typebuf));
+ dns_rdataclass_format(db->rdclass, clsbuf, sizeof(clsbuf));
+
+ isc_log_write(
+ dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_RBTDB,
+ ISC_LOG_ERROR,
+ "error %s '%s/%s' in '%s/%s' (%s): %s (must not exceed %u)", op,
+ namebuf, typebuf, originbuf, clsbuf,
+ (db->attributes & DNS_DBATTR_CACHE) != 0 ? "cache" : "zone",
+ isc_result_totext(DNS_R_TOOMANYRECORDS), limit);
+}
* RR type that would exceed the number of already stored RR types will return
* ISC_R_NOSPACE.
*/
+
+void
+dns__db_logtoomanyrecords(dns_db_t *db, const dns_name_t *name,
+ dns_rdatatype_t type, const char *op, uint32_t limit);
+/*
+ * Emit a log message when adding an rdataset of name/type would exceed the
+ * 'maxrrperset' limit. 'op' is 'adding' or 'updating' depending on whether
+ * the addition is to create a new rdataset or to merge to an existing one.
+ */
ISC_LANG_ENDDECLS
header->resign_lsb;
}
} else {
+ if (result == DNS_R_TOOMANYRECORDS) {
+ dns__db_logtoomanyrecords(
+ (dns_db_t *)rbtdb, nodename,
+ (dns_rdatatype_t)(header->type),
+ "updating", rbtdb->maxrrperset);
+ }
free_rdataset(rbtdb, rbtdb->common.mctx,
newheader);
return result;
®ion, sizeof(rdatasetheader_t),
rbtdb->maxrrperset);
if (result != ISC_R_SUCCESS) {
+ if (result == DNS_R_TOOMANYRECORDS) {
+ name = dns_fixedname_initname(&fixed);
+ dns_db_nodefullname(db, node, name);
+ dns__db_logtoomanyrecords((dns_db_t *)rbtdb, name,
+ rdataset->type, "adding",
+ rbtdb->maxrrperset);
+ }
return result;
}
®ion, sizeof(rdatasetheader_t),
rbtdb->maxrrperset);
if (result != ISC_R_SUCCESS) {
+ if (result == DNS_R_TOOMANYRECORDS) {
+ dns__db_logtoomanyrecords((dns_db_t *)rbtdb, name,
+ rdataset->type, "adding",
+ rbtdb->maxrrperset);
+ }
return result;
}
newheader = (rdatasetheader_t *)region.base;