mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
tweaks to dns_message_reply()
This commit is contained in:
@@ -672,18 +672,23 @@ dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section);
|
|||||||
* Ensures:
|
* Ensures:
|
||||||
*
|
*
|
||||||
* The message will have a rendering intent. If 'want_question_section'
|
* The message will have a rendering intent. If 'want_question_section'
|
||||||
* is true, and the question section in msg was present and properly
|
* is true, the message opcode is query, and the question section is
|
||||||
* formatted, then the question section will be included in the reply,
|
* present and properly formatted, then the question section will be
|
||||||
* otherwise the question section will be cleared. All other sections
|
* included in the reply. All other sections will be cleared. The QR
|
||||||
* will be cleared. The QR flag will be set, the RD flag will be
|
* flag will be set, the RD flag will be preserved, and all other flags
|
||||||
* preserved, and all other flags will be cleared.
|
* will be cleared.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
*
|
*
|
||||||
* DNS_R_SUCCESS -- all is well.
|
* DNS_R_SUCCESS -- all is well.
|
||||||
*
|
*
|
||||||
* DNS_R_FORMERR -- the header section of the message is
|
* DNS_R_FORMERR -- the header or question section of the
|
||||||
* invalid, replying is impossible.
|
* message is invalid, replying is impossible.
|
||||||
|
* If DNS_R_FORMERR is returned when
|
||||||
|
* want_question_section is ISC_FALSE, then
|
||||||
|
* it's the header section that's bad;
|
||||||
|
* otherwise either of the header or question
|
||||||
|
* sections may be bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
@@ -1605,10 +1605,13 @@ dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section) {
|
|||||||
|
|
||||||
if (!msg->header_ok)
|
if (!msg->header_ok)
|
||||||
return (DNS_R_FORMERR);
|
return (DNS_R_FORMERR);
|
||||||
|
if (msg->opcode != dns_opcode_query)
|
||||||
if (want_question_section && msg->question_ok)
|
want_question_section = ISC_FALSE;
|
||||||
|
if (want_question_section) {
|
||||||
|
if (!msg->question_ok)
|
||||||
|
return (DNS_R_FORMERR);
|
||||||
first_section = DNS_SECTION_ANSWER;
|
first_section = DNS_SECTION_ANSWER;
|
||||||
else
|
} else
|
||||||
first_section = DNS_SECTION_QUESTION;
|
first_section = DNS_SECTION_QUESTION;
|
||||||
msg->from_to_wire = DNS_MESSAGE_INTENTRENDER;
|
msg->from_to_wire = DNS_MESSAGE_INTENTRENDER;
|
||||||
msgresetnames(msg, first_section);
|
msgresetnames(msg, first_section);
|
||||||
|
Reference in New Issue
Block a user