From c896e07277f61e1b99ac04bedd49619aaeb00b7e Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 12 Dec 2023 13:50:33 +1100 Subject: [PATCH] Log what change generated a 'not exact' error --- lib/dns/diff.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/dns/diff.c b/lib/dns/diff.c index e4bfceefa8..afbf87c5e8 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -240,6 +240,22 @@ setownercase(dns_rdataset_t *rdataset, const dns_name_t *name) { } } +static const char * +optotext(dns_diffop_t op) { + switch (op) { + case DNS_DIFFOP_ADD: + return ("add"); + case DNS_DIFFOP_ADDRESIGN: + return ("add-resign"); + case DNS_DIFFOP_DEL: + return ("del"); + case DNS_DIFFOP_DELRESIGN: + return ("del-resign"); + default: + return ("unknown"); + } +} + static isc_result_t diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, bool warn) { dns_difftuple_t *t; @@ -269,6 +285,7 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, bool warn) { while (t != NULL && dns_name_equal(&t->name, name)) { dns_rdatatype_t type, covers; + dns_rdataclass_t rdclass; dns_diffop_t op; dns_rdatalist_t rdl; dns_rdataset_t rds; @@ -277,6 +294,7 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, bool warn) { op = t->op; type = t->rdata.type; + rdclass = t->rdata.rdclass; covers = rdata_covers(&t->rdata); /* @@ -439,6 +457,22 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, bool warn) { dns_rdataset_disassociate(&ardataset); } } else { + if (result == DNS_R_NOTEXACT) { + dns_name_format(name, namebuf, + sizeof(namebuf)); + dns_rdatatype_format(type, typebuf, + sizeof(typebuf)); + dns_rdataclass_format(rdclass, classbuf, + sizeof(classbuf)); + isc_log_write( + DIFF_COMMON_LOGARGS, + ISC_LOG_ERROR, + "dns_diff_apply: %s/%s/%s: %s " + "%s", + namebuf, typebuf, classbuf, + optotext(op), + isc_result_totext(result)); + } if (dns_rdataset_isassociated(&ardataset)) { dns_rdataset_disassociate(&ardataset); }