]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Compress zone transfers properly
authorTony Finch <fanf@isc.org>
Tue, 29 Nov 2022 20:23:31 +0000 (20:23 +0000)
committerTony Finch <dot@dotat.at>
Wed, 30 Nov 2022 12:16:09 +0000 (12:16 +0000)
After change 5995, zone transfers were using a small
compression context that only had space for the first
few dozen names in each message. They now use a large
compression context with enough space for every name.

CHANGES
doc/notes/notes-current.rst
lib/dns/include/dns/compress.h
lib/ns/xfrout.c

diff --git a/CHANGES b/CHANGES
index efa050b83e1ca70f836d2a486ba45f63ab06e84e..e7c7613c3cda98140e45180017a50facb0a51213 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+6032.  [bug]           After change 5995, zone transfers were using a small
+                       compression context that only had space for the first
+                       few dozen names in each message. They now use a large
+                       compression context with enough space for every name.
+                       [GL #3706]
+
 6031.  [bug]           Move the "final reference detached" log message
                        from dns_zone unit to the DEBUG(1) log level.
                        [GL #3707]
index a036aa94770d4084e6429d08271896534c68a4f7..59138aee01cc1e24de2e7f585d9352581fe00bf3 100644 (file)
@@ -52,7 +52,6 @@ Bug Fixes
   10 to 100 to accomodate for some browsers that send more that 10
   headers by default. :gl:`#3670`
 
-
 - Copy TLS identifier when setting up primaries for catalog member
   zones. :gl:`#3638`
 
@@ -64,6 +63,10 @@ Bug Fixes
   :iscman:`named-checkzone` tool from superfluously logging this message
   in non-debug mode. :gl:`#3707`
 
+- The new name compression code in BIND 9.19.7 was not compressing
+  names in zone transfers that should have been compressed, so zone
+  transfers were larger than before. :gl:`#3706`
+
 Known Issues
 ~~~~~~~~~~~~
 
index b5930617be8f0ef05bf7d20bcd7e468a32cfd545..2ea37b548ea87c9149f085777332505369f5f6b3 100644 (file)
@@ -58,9 +58,10 @@ ISC_LANG_BEGINDECLS
  * few dozen names in the hash set. (We can't actually use every slot because
  * space is reserved for performance reasons.) For large messages, the number
  * of names is limited by the minimum size of an RR (owner, type, class, ttl,
- * length) which is 16 bytes when the owner has a new 3-character label
- * before the compressed zone name. Divide the maximum compression offset
- * 0x3FFF by 16 and you get roughly 1024.
+ * length) which is 12 bytes - call it 16 bytes to make space for a new label.
+ * Divide the maximum compression offset 0x4000 by 16 and you get 0x400 == 1024.
+ * In practice, the root zone (for example) uses less than 200 distinct names
+ * per message.
  */
 enum {
        DNS_COMPRESS_SMALLBITS = 6,
index 83494a3f5b43ba1637f073b473dd3b62d1b6a39a..5f7984bcdc11ab45aec02f270f71b8b523370ed6 100644 (file)
@@ -1527,7 +1527,8 @@ sendstream(xfrout_ctx_t *xfr) {
 
        if (is_tcp) {
                isc_region_t used;
-               dns_compress_init(&cctx, xfr->mctx, DNS_COMPRESS_CASE);
+               dns_compress_init(&cctx, xfr->mctx,
+                                 DNS_COMPRESS_CASE | DNS_COMPRESS_LARGE);
                cleanup_cctx = true;
                CHECK(dns_message_renderbegin(msg, &cctx, &xfr->txbuf));
                CHECK(dns_message_rendersection(msg, DNS_SECTION_QUESTION, 0));