diff --git a/CHANGES b/CHANGES index 7c8533529e..a4b5130437 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +3237. [bug] dig -6 didn't work with +trace. [RT #26906] + 3236. [bug] Backed out changes #3182 and #3202, related to EDNS(0) fallback behavior. [RT #26416] diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 5107db9c8f..fea96deb46 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.244 2011/11/04 14:19:17 each Exp $ */ +/* $Id: dig.c,v 1.245 2011/12/07 17:23:28 each Exp $ */ /*! \file */ @@ -1586,7 +1586,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, if (strncmp(rv[0], "%", 1) == 0) break; if (strncmp(rv[0], "@", 1) == 0) { - addresscount = getaddresses(lookup, &rv[0][1]); + addresscount = getaddresses(lookup, &rv[0][1], NULL); } else if (rv[0][0] == '+') { plus_option(&rv[0][1], is_batchfile, lookup); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 743885b039..994def7a80 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.344 2011/12/01 00:53:58 marka Exp $ */ +/* $Id: dighost.c,v 1.345 2011/12/07 17:23:28 each Exp $ */ /*! \file * \note @@ -1705,6 +1705,9 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) isc_result_t result; isc_boolean_t success = ISC_FALSE; int numLookups = 0; + int num; + isc_result_t lresult, addresses_result; + char bad_namestr[DNS_NAME_FORMATSIZE]; dns_name_t *domain; isc_boolean_t horizontal = ISC_FALSE, bad = ISC_FALSE; @@ -1712,6 +1715,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) debug("following up %s", query->lookup->textname); + addresses_result = ISC_R_SUCCESS; + bad_namestr[0] = '\0'; for (result = dns_message_firstname(msg, section); result == ISC_R_SUCCESS; result = dns_message_nextname(msg, section)) { @@ -1795,10 +1800,23 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) dns_name_copy(name, domain, NULL); } debug("adding server %s", namestr); - numLookups += getaddresses(lookup, namestr); + num = getaddresses(lookup, namestr, &lresult); + if (lresult != ISC_R_SUCCESS) { + debug("couldn't get address for '%s': %s", + namestr, isc_result_totext(lresult)); + if (addresses_result == ISC_R_SUCCESS) { + addresses_result = lresult; + strcpy(bad_namestr, namestr); + } + } + numLookups += num; dns_rdata_reset(&rdata); } } + if (numLookups == 0 && addresses_result != ISC_R_SUCCESS) { + fatal("couldn't get address for '%s': %s", + bad_namestr, isc_result_totext(result)); + } if (lookup == NULL && section == DNS_SECTION_ANSWER && @@ -3547,7 +3565,7 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) { } int -getaddresses(dig_lookup_t *lookup, const char *host) { +getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) { isc_result_t result; isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES]; isc_netaddr_t netaddr; @@ -3557,9 +3575,14 @@ getaddresses(dig_lookup_t *lookup, const char *host) { result = bind9_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES, &count); - if (result != ISC_R_SUCCESS) - fatal("couldn't get address for '%s': %s", - host, isc_result_totext(result)); + if (resultp != NULL) + *resultp = result; + if (result != ISC_R_SUCCESS) { + if (resultp == NULL) + fatal("couldn't get address for '%s': %s", + host, isc_result_totext(result)); + return 0; + } for (i = 0; i < count; i++) { isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]); diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index ae769c9878..b34542e30c 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.113 2011/03/01 23:48:05 tbox Exp $ */ +/* $Id: dig.h,v 1.114 2011/12/07 17:23:28 each Exp $ */ #ifndef DIG_H #define DIG_H @@ -289,7 +289,7 @@ isc_result_t get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr); int -getaddresses(dig_lookup_t *lookup, const char *host); +getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp); isc_result_t get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,