From 191fdb73be2cfdcb490a4be7da25066d18b409fa Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Tue, 19 Feb 2002 22:39:25 +0000 Subject: [PATCH] pullup: 1198. [bug] OPT printing style was not consistant with the way the header fields are printed. The DO bit was not reported if set. Report if any of the MBZ bits are set. --- CHANGES | 4 ++++ lib/dns/message.c | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 83bb41a174..ec83e2705e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ --- 9.2.1rc1 released --- +1198. [bug] OPT printing style was not consistant with the way the + header fields are printed. The DO bit was not reported + if set. Report if any of the MBZ bits are set. + 1197. [bug] Attempts to define the same acl multiple times were not detected. diff --git a/lib/dns/message.c b/lib/dns/message.c index 4a7beb82a0..68847c7165 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.194.2.5 2002/02/19 22:12:58 gson Exp $ */ +/* $Id: message.c,v 1.194.2.6 2002/02/19 22:39:25 gson Exp $ */ /*** *** Imports @@ -2903,6 +2903,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_name_t *name = NULL; isc_result_t result; char buf[sizeof("1234567890")]; + isc_uint32_t mbz; REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(target != NULL); @@ -2916,13 +2917,22 @@ dns_message_pseudosectiontotext(dns_message_t *msg, if ((flags & DNS_MESSAGETEXTFLAG_NOCOMMENTS) == 0) ADD_STRING(target, ";; OPT PSEUDOSECTION:\n"); ADD_STRING(target, "; EDNS: version: "); - sprintf(buf, "%4u", - (unsigned int)((ps->ttl & + snprintf(buf, sizeof(buf), "%u", + (unsigned int)((ps->ttl & 0x00ff0000 >> 16))); ADD_STRING(target, buf); - ADD_STRING(target, ", udp="); - sprintf(buf, "%7u\n", - (unsigned int)ps->rdclass); + ADD_STRING(target, ", flags:"); + if ((ps->ttl & DNS_MESSAGEEXTFLAG_DO) != 0) + ADD_STRING(target, " do"); + mbz = ps->ttl & ~DNS_MESSAGEEXTFLAG_DO & 0xffff; + if (mbz != 0) { + ADD_STRING(target, "; MBZ: "); + snprintf(buf, sizeof(buf), "%.4x ", mbz); + ADD_STRING(target, buf); + ADD_STRING(target, ", udp: "); + } else + ADD_STRING(target, "; udp: "); + snprintf(buf, sizeof(buf), "%u\n", (unsigned int)ps->rdclass); ADD_STRING(target, buf); return (ISC_R_SUCCESS); case DNS_PSEUDOSECTION_TSIG: