mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
simplify flag printing, protect first with #ifdef USEINITALWS
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* 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>
|
||||
|
||||
@@ -77,7 +77,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
isc_region_t r;
|
||||
dns_name_t empty_name;
|
||||
char t[65536];
|
||||
#ifdef USEINITALWS
|
||||
isc_boolean_t first;
|
||||
#endif
|
||||
isc_boolean_t no_rdata;
|
||||
|
||||
if (sectionid == DNS_SECTION_QUESTION)
|
||||
@@ -100,7 +102,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||
dns_message_currentname(msg, sectionid, &name);
|
||||
|
||||
isc_buffer_init(&target, t, sizeof(t));
|
||||
#ifdef USEINITALWS
|
||||
first = ISC_TRUE;
|
||||
#endif
|
||||
print_name = name;
|
||||
|
||||
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
|
||||
printmessage(dns_message_t *msg) {
|
||||
isc_boolean_t did_flag = ISC_FALSE;
|
||||
isc_result_t result;
|
||||
dns_rdataset_t *opt, *tsig;
|
||||
dns_name_t *tsigname;
|
||||
@@ -169,35 +172,21 @@ printmessage(dns_message_t *msg) {
|
||||
printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
|
||||
opcodetext[msg->opcode], rcodetext[msg->rcode], msg->id);
|
||||
|
||||
printf(";; flags: ");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) {
|
||||
printf("qr");
|
||||
did_flag = ISC_TRUE;
|
||||
}
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) {
|
||||
printf("%saa", did_flag ? " " : "");
|
||||
did_flag = ISC_TRUE;
|
||||
}
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) {
|
||||
printf("%stc", did_flag ? " " : "");
|
||||
did_flag = ISC_TRUE;
|
||||
}
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) {
|
||||
printf("%srd", did_flag ? " " : "");
|
||||
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(";; flags:");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0)
|
||||
printf(" qr");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0)
|
||||
printf(" aa");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0)
|
||||
printf(" tc");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0)
|
||||
printf(" rd");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0)
|
||||
printf(" ra");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0)
|
||||
printf(" ad");
|
||||
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0)
|
||||
printf(" cd");
|
||||
printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n",
|
||||
msg->counts[DNS_SECTION_QUESTION],
|
||||
msg->counts[DNS_SECTION_ANSWER],
|
||||
|
Reference in New Issue
Block a user