summaryrefslogtreecommitdiff
path: root/bin/named/xfrout.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/named/xfrout.c')
-rw-r--r--bin/named/xfrout.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c
index f8535b21ea7bf..351b6166559ef 100644
--- a/bin/named/xfrout.c
+++ b/bin/named/xfrout.c
@@ -1246,6 +1246,7 @@ sendstream(xfrout_ctx_t *xfr) {
dns_rdataset_t *msgrds = NULL;
dns_compress_t cctx;
isc_boolean_t cleanup_cctx = ISC_FALSE;
+ isc_boolean_t is_tcp;
int n_rrs;
@@ -1253,7 +1254,8 @@ sendstream(xfrout_ctx_t *xfr) {
isc_buffer_clear(&xfr->txlenbuf);
isc_buffer_clear(&xfr->txbuf);
- if ((xfr->client->attributes & NS_CLIENTATTR_TCP) == 0) {
+ is_tcp = ISC_TF((xfr->client->attributes & NS_CLIENTATTR_TCP) != 0);
+ if (!is_tcp) {
/*
* In the UDP case, we put the response data directly into
* the client message.
@@ -1442,9 +1444,17 @@ sendstream(xfrout_ctx_t *xfr) {
if (! xfr->many_answers)
break;
+ /*
+ * At this stage, at least 1 RR has been rendered into
+ * the message. Check if we want to clamp this message
+ * here (TCP only). 20480 was set as an upper limit to
+ * improve message compression.
+ */
+ if ((isc_buffer_usedlength(&xfr->buf) >= 20480) && is_tcp)
+ break;
}
- if ((xfr->client->attributes & NS_CLIENTATTR_TCP) != 0) {
+ if (is_tcp) {
CHECK(dns_compress_init(&cctx, -1, xfr->mctx));
dns_compress_setsensitive(&cctx, ISC_TRUE);
cleanup_cctx = ISC_TRUE;