mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
simplify flag printing, protect first with #ifdef USEINITALWS
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: printmsg.c,v 1.29 2007/06/19 23:46:59 tbox Exp $ */
|
/* $Id: printmsg.c,v 1.30 2011/08/25 13:28:00 marka Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -77,7 +77,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
dns_name_t empty_name;
|
dns_name_t empty_name;
|
||||||
char t[65536];
|
char t[65536];
|
||||||
|
#ifdef USEINITALWS
|
||||||
isc_boolean_t first;
|
isc_boolean_t first;
|
||||||
|
#endif
|
||||||
isc_boolean_t no_rdata;
|
isc_boolean_t no_rdata;
|
||||||
|
|
||||||
if (sectionid == DNS_SECTION_QUESTION)
|
if (sectionid == DNS_SECTION_QUESTION)
|
||||||
@@ -100,7 +102,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
dns_message_currentname(msg, sectionid, &name);
|
dns_message_currentname(msg, sectionid, &name);
|
||||||
|
|
||||||
isc_buffer_init(&target, t, sizeof(t));
|
isc_buffer_init(&target, t, sizeof(t));
|
||||||
|
#ifdef USEINITALWS
|
||||||
first = ISC_TRUE;
|
first = ISC_TRUE;
|
||||||
|
#endif
|
||||||
print_name = name;
|
print_name = name;
|
||||||
|
|
||||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||||
@@ -159,7 +163,6 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
|
|||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
printmessage(dns_message_t *msg) {
|
printmessage(dns_message_t *msg) {
|
||||||
isc_boolean_t did_flag = ISC_FALSE;
|
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_rdataset_t *opt, *tsig;
|
dns_rdataset_t *opt, *tsig;
|
||||||
dns_name_t *tsigname;
|
dns_name_t *tsigname;
|
||||||
@@ -169,35 +172,21 @@ printmessage(dns_message_t *msg) {
|
|||||||
printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
|
printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
|
||||||
opcodetext[msg->opcode], rcodetext[msg->rcode], msg->id);
|
opcodetext[msg->opcode], rcodetext[msg->rcode], msg->id);
|
||||||
|
|
||||||
printf(";; flags: ");
|
printf(";; flags:");
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0)
|
||||||
printf("qr");
|
printf(" qr");
|
||||||
did_flag = ISC_TRUE;
|
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0)
|
||||||
}
|
printf(" aa");
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0)
|
||||||
printf("%saa", did_flag ? " " : "");
|
printf(" tc");
|
||||||
did_flag = ISC_TRUE;
|
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0)
|
||||||
}
|
printf(" rd");
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0)
|
||||||
printf("%stc", did_flag ? " " : "");
|
printf(" ra");
|
||||||
did_flag = ISC_TRUE;
|
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0)
|
||||||
}
|
printf(" ad");
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0)
|
||||||
printf("%srd", did_flag ? " " : "");
|
printf(" cd");
|
||||||
did_flag = ISC_TRUE;
|
|
||||||
}
|
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0) {
|
|
||||||
printf("%sra", did_flag ? " " : "");
|
|
||||||
did_flag = ISC_TRUE;
|
|
||||||
}
|
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) {
|
|
||||||
printf("%sad", did_flag ? " " : "");
|
|
||||||
did_flag = ISC_TRUE;
|
|
||||||
}
|
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) {
|
|
||||||
printf("%scd", did_flag ? " " : "");
|
|
||||||
did_flag = ISC_TRUE;
|
|
||||||
}
|
|
||||||
printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n",
|
printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n",
|
||||||
msg->counts[DNS_SECTION_QUESTION],
|
msg->counts[DNS_SECTION_QUESTION],
|
||||||
msg->counts[DNS_SECTION_ANSWER],
|
msg->counts[DNS_SECTION_ANSWER],
|
||||||
|
Reference in New Issue
Block a user