]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fallback to normal procedure if creating of ixfr-from-differences fails
authorWitold Kręcicki <wpk@isc.org>
Wed, 27 Jun 2018 12:10:04 +0000 (14:10 +0200)
committerEvan Hunt <each@isc.org>
Thu, 28 Jun 2018 01:56:31 +0000 (18:56 -0700)
(cherry picked from commit b1254430df1a9795ff2afec1face7a4f5f4a78e0)
(cherry picked from commit e92d5421c37d03e48d4bcd17cee950cb0e4ce24d)

lib/dns/journal.c
lib/dns/zone.c

index 227e48b0701f01864da600539b0e2ed8bc09a2f9..942e227f571be22ce6e5ed1cfe3cf9565c4b0519 100644 (file)
@@ -1014,7 +1014,7 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
        dns_difftuple_t *t;
        isc_buffer_t buffer;
        void *mem = NULL;
-       size_t size;
+       isc_uint64_t size;
        isc_result_t result;
        isc_region_t used;
 
@@ -1045,7 +1045,11 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
        }
 
        if (size >= DNS_JOURNAL_SIZE_MAX) {
-               return (ISC_R_RANGE);
+               isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
+                             "dns_journal_writediff: %s: journal entry "
+                             "too big to be stored: %llu bytes", j->filename,
+                             size);
+               return (ISC_R_NOSPACE);
        }
 
        mem = isc_mem_get(j->mctx, size);
@@ -1101,6 +1105,7 @@ isc_result_t
 dns_journal_commit(dns_journal_t *j) {
        isc_result_t result;
        journal_rawheader_t rawheader;
+       isc_uint64_t total;
 
        REQUIRE(DNS_JOURNAL_VALID(j));
        REQUIRE(j->state == JOURNAL_STATE_TRANSACTION ||
@@ -1153,12 +1158,12 @@ dns_journal_commit(dns_journal_t *j) {
        /*
         * We currently don't support huge journal entries.
         */
-       unsigned long long total = j->x.pos[1].offset - j->x.pos[0].offset;
+       total = j->x.pos[1].offset - j->x.pos[0].offset;
        if (total >= DNS_JOURNAL_SIZE_MAX) {
                isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
-                            "transaction too big to be stored in journal :"
+                            "transaction too big to be stored in journal"
                             "%llub (max is %llub)", total,
-                            (unsigned long long)DNS_JOURNAL_SIZE_MAX);
+                            (isc_uint64_t)DNS_JOURNAL_SIZE_MAX);
                return (ISC_R_UNEXPECTED);
        }
 
index f9474bb0c8acf1a1bb175576c6c4461a210c1f6b..57612684abdbf5d572d27151d34c56b3573a1847 100644 (file)
@@ -14784,15 +14784,14 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
 
                result = dns_db_diff(zone->mctx, db, ver, zone->db, NULL,
                                     zone->journal);
-               if (result == ISC_R_RANGE) {
+               if (result != ISC_R_SUCCESS) {
+                       char strbuf[ISC_STRERRORSIZE];
+                       isc__strerror(errno, strbuf, sizeof(strbuf));
                        dns_zone_log(zone, ISC_LOG_ERROR,
                                     "ixfr-from-differences: failed: "
-                                    "difference too big to be stored "
-                                    "in journal");
-                       goto fail;
+                                    "%s", strbuf);
+                       goto fallback;
                }
-               if (result != ISC_R_SUCCESS)
-                       goto fail;
                if (dump)
                        zone_needdump(zone, DNS_DUMP_DELAY);
                else if (zone->journalsize != -1) {
@@ -14816,6 +14815,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
                if (zone->type == dns_zone_master && inline_raw(zone))
                        zone_send_secureserial(zone, serial);
        } else {
+ fallback:
                if (dump && zone->masterfile != NULL) {
                        /*
                         * If DNS_ZONEFLG_FORCEXFER was set we don't want