From 3e7a76892ad1fc136be63a102de3e75cd92b9dfc Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 17 Jul 2003 07:46:55 +0000 Subject: [PATCH] 1484. [bug] The number of records reported after a AXFR was wrong. [RT #6229] 1483. [bug] dig axfr failed if the message id in the answer failed to match that in the request. Only the id in the first message is required to match. [RT #8138] --- CHANGES | 11 ++++++++++ bin/dig/dighost.c | 44 +++++++++++++++++++++++++-------------- bin/dig/include/dig/dig.h | 5 +++-- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 0f43f55980..8d6ecbed9c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ +1484. [bug] The number of records reported after a AXFR was wrong. + [RT #6229] + +1483. [bug] dig axfr failed if the message id in the answer failed + to match that in the request. Only the id in the first + message is required to match. [RT #8138] + +1482. [bug] named could fail to start if the kernel supports + IPv6 but no interfaces are configured. Similarly + for IPv4. [RT #6229] + 1482. [bug] Named could fail to start if the kernel supports IPv6 but no interfaces are configured. Similarly for IPv4. [RT #6229] diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 9fea8d6bae..6aeeb8af74 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.221.2.16 2003/05/15 01:17:54 marka Exp $ */ +/* $Id: dighost.c,v 1.221.2.17 2003/07/17 07:46:55 marka Exp $ */ /* * Notice to programmers: Do not use this code as an example of how to @@ -1399,6 +1399,7 @@ setup_lookup(dig_lookup_t *lookup) { query->first_soa_rcvd = ISC_FALSE; query->second_rr_rcvd = ISC_FALSE; query->first_repeat_rcvd = ISC_FALSE; + query->warn_id = ISC_TRUE; query->first_rr_serial = 0; query->second_rr_serial = 0; query->servname = serv->servername; @@ -1704,14 +1705,15 @@ connect_timeout(isc_task_t *task, isc_event_t *event) { l->retries); l->retries--; n = requeue_lookup(l, ISC_TRUE); - n->origin = query->lookup->origin; cancel_lookup(l); + check_next_lookup(l); } } else { fputs(l->cmdline, stdout); printf(";; connection timed out; no servers could be " "reached\n"); cancel_lookup(l); + check_next_lookup(l); if (exitcode < 9) exitcode = 9; } @@ -2007,7 +2009,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, query->second_rr_rcvd = ISC_TRUE; query->second_rr_serial = 0; debug("got the second rr as nonsoa"); - continue; + goto next_rdata; } /* @@ -2191,25 +2193,35 @@ recv_done(isc_task_t *task, isc_event_t *event) { result = dns_message_peekheader(b, &id, &msgflags); if (result != ISC_R_SUCCESS || l->sendmsg->id != id) { + match = ISC_FALSE; if (l->tcp_mode) { - if (result == ISC_R_SUCCESS) - printf(";; ERROR: ID mismatch: " - "expected ID %u, got %u\n", - l->sendmsg->id, id); - else + isc_boolean_t fail = ISC_TRUE; + if (result == ISC_R_SUCCESS) { + if (!query->first_soa_rcvd || + query->warn_id) + printf(";; %s: ID mismatch: " + "expected ID %u, got %u\n", + query->first_soa_rcvd ? + "WARNING" : "ERROR", + l->sendmsg->id, id); + if (query->first_soa_rcvd) + fail = ISC_FALSE; + query->warn_id = ISC_FALSE; + } else printf(";; ERROR: short (< header size) message\n"); - isc_event_free(&event); - clear_query(query); - check_next_lookup(l); - UNLOCK_LOOKUP; - return; - } - if (result == ISC_R_SUCCESS) + if (fail) { + isc_event_free(&event); + clear_query(query); + check_next_lookup(l); + UNLOCK_LOOKUP; + return; + } + match = ISC_TRUE; + } else if (result == ISC_R_SUCCESS) printf(";; Warning: ID mismatch: " "expected ID %u, got %u\n", l->sendmsg->id, id); else printf(";; Warning: short (< header size) message received\n"); - match = ISC_FALSE; } if (!match) { diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index bbe1aa35e2..d7ca858ff9 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.71.2.3 2001/11/15 01:24:13 marka Exp $ */ +/* $Id: dig.h,v 1.71.2.4 2003/07/17 07:46:55 marka Exp $ */ #ifndef DIG_H #define DIG_H @@ -152,7 +152,8 @@ struct dig_query { first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, - recv_made; + recv_made, + warn_id; isc_uint32_t first_rr_serial; isc_uint32_t second_rr_serial; isc_uint32_t rr_count;