2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

1804. [bug] Ensure that if we are queried for glue that it fits

in the additional section or TC is set to tell the
                        client to retry using TCP. [RT #10114]
This commit is contained in:
Mark Andrews
2005-03-15 01:29:10 +00:00
parent 5218822573
commit e50b75e36c
4 changed files with 112 additions and 20 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: message.c,v 1.223 2004/05/05 01:32:58 marka Exp $ */
/* $Id: message.c,v 1.224 2005/03/15 01:29:09 marka Exp $ */
/***
*** Imports
@@ -1783,6 +1783,57 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
if (msg->reserved == 0 && (options & DNS_MESSAGERENDER_PARTIAL) != 0)
partial = ISC_TRUE;
/*
* Render required glue first. Set TC if it won't fit.
*/
name = ISC_LIST_HEAD(*section);
if (name != NULL) {
rdataset = ISC_LIST_HEAD(name->list);
if (rdataset != NULL &&
(rdataset->attributes & DNS_RDATASETATTR_REQUIREDGLUE) != 0 &&
(rdataset->attributes & DNS_RDATASETATTR_RENDERED) == 0) {
void *order_arg = msg->order_arg;
st = *(msg->buffer);
count = 0;
if (partial)
result = dns_rdataset_towirepartial(rdataset,
name,
msg->cctx,
msg->buffer,
msg->order,
order_arg,
rd_options,
&count,
NULL);
else
result = dns_rdataset_towiresorted(rdataset,
name,
msg->cctx,
msg->buffer,
msg->order,
order_arg,
rd_options,
&count);
total += count;
if (partial && result == ISC_R_NOSPACE) {
msg->flags |= DNS_MESSAGEFLAG_TC;
msg->buffer->length += msg->reserved;
msg->counts[sectionid] += total;
return (result);
}
if (result != ISC_R_SUCCESS) {
INSIST(st.used < 65536);
dns_compress_rollback(msg->cctx,
(isc_uint16_t)st.used);
*(msg->buffer) = st; /* rollback */
msg->buffer->length += msg->reserved;
msg->counts[sectionid] += total;
return (result);
}
rdataset->attributes |= DNS_RDATASETATTR_RENDERED;
}
}
do {
name = ISC_LIST_HEAD(*section);
if (name == NULL) {