2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

Track QUESTION section presence using a boolean

The 'nmsg' field of the xfrout_ctx_t structure is an integer, even
though it is only ever compared against 0 (for tracking whether the
QUESTION section has already been sent to the client).  Use a boolean
instead as it is more appropriate and also enables 'nmsg' to be
repurposed.
This commit is contained in:
Michał Kępień
2019-01-31 15:43:58 +01:00
committed by Evan Hunt
parent 08ef7222aa
commit c20d81fd06

View File

@@ -662,7 +662,8 @@ typedef struct {
dns_dbversion_t *ver; dns_dbversion_t *ver;
isc_quota_t *quota; isc_quota_t *quota;
rrstream_t *stream; /* The XFR RR stream */ rrstream_t *stream; /* The XFR RR stream */
bool end_of_stream; /* EOS has been reached */ bool question_added; /* QUESTION section sent? */
bool end_of_stream; /* EOS has been reached */
isc_buffer_t buf; /* Buffer for message owner isc_buffer_t buf; /* Buffer for message owner
names and rdatas */ names and rdatas */
isc_buffer_t txlenbuf; /* Transmit length buffer */ isc_buffer_t txlenbuf; /* Transmit length buffer */
@@ -672,10 +673,10 @@ typedef struct {
unsigned int nmsg; /* Number of messages sent */ unsigned int nmsg; /* Number of messages sent */
dns_tsigkey_t *tsigkey; /* Key used to create TSIG */ dns_tsigkey_t *tsigkey; /* Key used to create TSIG */
isc_buffer_t *lasttsig; /* the last TSIG */ isc_buffer_t *lasttsig; /* the last TSIG */
bool verified_tsig; /* verified request MAC */ bool verified_tsig; /* verified request MAC */
bool many_answers; bool many_answers;
int sends; /* Send in progress */ int sends; /* Send in progress */
bool shuttingdown; bool shuttingdown;
const char *mnemonic; /* Style of transfer */ const char *mnemonic; /* Style of transfer */
} xfrout_ctx_t; } xfrout_ctx_t;
@@ -1180,6 +1181,7 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id,
dns_zone_attach(zone, &xfr->zone); dns_zone_attach(zone, &xfr->zone);
dns_db_attach(db, &xfr->db); dns_db_attach(db, &xfr->db);
dns_db_attachversion(db, ver, &xfr->ver); dns_db_attachversion(db, ver, &xfr->ver);
xfr->question_added = false;
xfr->end_of_stream = false; xfr->end_of_stream = false;
xfr->tsigkey = tsigkey; xfr->tsigkey = tsigkey;
xfr->lasttsig = lasttsig; xfr->lasttsig = lasttsig;
@@ -1344,7 +1346,7 @@ sendstream(xfrout_ctx_t *xfr) {
* BIND 8.2.1 will not recognize an IXFR if it does not * BIND 8.2.1 will not recognize an IXFR if it does not
* have a question section. * have a question section.
*/ */
if (xfr->nmsg == 0) { if (!xfr->question_added) {
dns_name_t *qname = NULL; dns_name_t *qname = NULL;
isc_region_t r; isc_region_t r;
@@ -1376,6 +1378,7 @@ sendstream(xfrout_ctx_t *xfr) {
ISC_LIST_APPEND(qname->list, qrdataset, link); ISC_LIST_APPEND(qname->list, qrdataset, link);
dns_message_addname(msg, qname, DNS_SECTION_QUESTION); dns_message_addname(msg, qname, DNS_SECTION_QUESTION);
xfr->question_added = true;
} else { } else {
/* /*
* Reserve space for the 12-byte message header * Reserve space for the 12-byte message header