2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

2888. [bug] Only the first EDNS option was displayed. [RT #21273]

This commit is contained in:
Mark Andrews 2010-05-13 00:40:46 +00:00
parent 7a1448aa57
commit e18c62b1da
3 changed files with 53 additions and 39 deletions

View File

@ -1,3 +1,5 @@
2888. [bug] Only the first EDNS option was displayed. [RT #21273]
2887. [bug] Report the keytag times in UTC in the .key file, 2887. [bug] Report the keytag times in UTC in the .key file,
local time is presented as a comment within the local time is presented as a comment within the
comment. [RT #21223] comment. [RT #21223]

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dig.c,v 1.236 2010/05/12 01:31:37 marka Exp $ */ /* $Id: dig.c,v 1.237 2010/05/13 00:40:46 marka Exp $ */
/*! \file */ /*! \file */
@ -513,6 +513,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
printf(" ad"); printf(" ad");
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0)
printf(" cd"); printf(" cd");
if ((msg->flags & 0x0040U) != 0)
printf("; MBZ: 0x4");
printf("; QUERY: %u, ANSWER: %u, " printf("; QUERY: %u, ANSWER: %u, "
"AUTHORITY: %u, ADDITIONAL: %u\n", "AUTHORITY: %u, ADDITIONAL: %u\n",

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: message.c,v 1.252 2010/03/12 03:34:56 marka Exp $ */ /* $Id: message.c,v 1.253 2010/05/13 00:40:46 marka Exp $ */
/*! \file */ /*! \file */
@ -3214,7 +3214,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
ADD_STRING(target, ", flags:"); ADD_STRING(target, ", flags:");
if ((ps->ttl & DNS_MESSAGEEXTFLAG_DO) != 0) if ((ps->ttl & DNS_MESSAGEEXTFLAG_DO) != 0)
ADD_STRING(target, " do"); ADD_STRING(target, " do");
mbz = ps->ttl & ~DNS_MESSAGEEXTFLAG_DO & 0xffff; mbz = ps->ttl & 0xffff;
mbz &= ~DNS_MESSAGEEXTFLAG_DO; /* Known Flags. */
if (mbz != 0) { if (mbz != 0) {
ADD_STRING(target, "; MBZ: "); ADD_STRING(target, "; MBZ: ");
snprintf(buf, sizeof(buf), "%.4x ", mbz); snprintf(buf, sizeof(buf), "%.4x ", mbz);
@ -3232,13 +3233,14 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
/* Print EDNS info, if any */ /* Print EDNS info, if any */
dns_rdata_init(&rdata); dns_rdata_init(&rdata);
dns_rdataset_current(ps, &rdata); dns_rdataset_current(ps, &rdata);
if (rdata.length < 4)
return (ISC_R_SUCCESS);
isc_buffer_init(&optbuf, rdata.data, rdata.length); isc_buffer_init(&optbuf, rdata.data, rdata.length);
isc_buffer_add(&optbuf, rdata.length); isc_buffer_add(&optbuf, rdata.length);
while (isc_buffer_remaininglength(&optbuf) != 0) {
INSIST(isc_buffer_remaininglength(&optbuf) >= 4U);
optcode = isc_buffer_getuint16(&optbuf); optcode = isc_buffer_getuint16(&optbuf);
optlen = isc_buffer_getuint16(&optbuf); optlen = isc_buffer_getuint16(&optbuf);
INSIST(isc_buffer_remaininglength(&optbuf) >= optlen);
if (optcode == DNS_OPT_NSID) { if (optcode == DNS_OPT_NSID) {
ADD_STRING(target, "; NSID"); ADD_STRING(target, "; NSID");
@ -3252,7 +3254,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
int i; int i;
ADD_STRING(target, ": "); ADD_STRING(target, ": ");
optdata = rdata.data + 4; optdata = isc_buffer_current(&optbuf);
for (i = 0; i < optlen; i++) { for (i = 0; i < optlen; i++) {
sprintf(buf, "%02x ", optdata[i]); sprintf(buf, "%02x ", optdata[i]);
ADD_STRING(target, buf); ADD_STRING(target, buf);
@ -3260,14 +3262,17 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
for (i = 0; i < optlen; i++) { for (i = 0; i < optlen; i++) {
ADD_STRING(target, " ("); ADD_STRING(target, " (");
if (isprint(optdata[i])) if (isprint(optdata[i]))
isc_buffer_putmem(target, &optdata[i], isc_buffer_putmem(target,
&optdata[i],
1); 1);
else else
isc_buffer_putstr(target, "."); isc_buffer_putstr(target, ".");
ADD_STRING(target, ")"); ADD_STRING(target, ")");
} }
isc_buffer_forward(&optbuf, optlen);
} }
ADD_STRING(target, "\n"); ADD_STRING(target, "\n");
}
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
case DNS_PSEUDOSECTION_TSIG: case DNS_PSEUDOSECTION_TSIG:
ps = dns_message_gettsig(msg, &name); ps = dns_message_gettsig(msg, &name);
@ -3317,21 +3322,26 @@ dns_message_totext(dns_message_t *msg, const dns_master_style_t *style,
ADD_STRING(target, ", id: "); ADD_STRING(target, ", id: ");
snprintf(buf, sizeof(buf), "%6u", msg->id); snprintf(buf, sizeof(buf), "%6u", msg->id);
ADD_STRING(target, buf); ADD_STRING(target, buf);
ADD_STRING(target, "\n;; flags: "); ADD_STRING(target, "\n;; flags:");
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0)
ADD_STRING(target, "qr "); ADD_STRING(target, " qr");
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0)
ADD_STRING(target, "aa "); ADD_STRING(target, " aa");
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0)
ADD_STRING(target, "tc "); ADD_STRING(target, " tc");
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0)
ADD_STRING(target, "rd "); ADD_STRING(target, " rd");
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0) if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0)
ADD_STRING(target, "ra "); ADD_STRING(target, " ra");
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0)
ADD_STRING(target, "ad "); ADD_STRING(target, " ad");
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0)
ADD_STRING(target, "cd "); ADD_STRING(target, " cd");
/*
* The final unnamed flag must be zero.
*/
if ((msg->flags & 0x0040U) != 0)
ADD_STRING(target, "; MBZ: 0x4");
if (msg->opcode != dns_opcode_update) { if (msg->opcode != dns_opcode_update) {
ADD_STRING(target, "; QUESTION: "); ADD_STRING(target, "; QUESTION: ");
} else { } else {