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

3237. [bug] dig -6 didn't work with +trace. [RT #26906]

This commit is contained in:
Evan Hunt 2011-12-07 17:23:28 +00:00
parent 0c36018172
commit 28c2bc2026
4 changed files with 35 additions and 10 deletions

View File

@ -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 3236. [bug] Backed out changes #3182 and #3202, related to
EDNS(0) fallback behavior. [RT #26416] EDNS(0) fallback behavior. [RT #26416]

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * 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 */ /*! \file */
@ -1586,7 +1586,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
if (strncmp(rv[0], "%", 1) == 0) if (strncmp(rv[0], "%", 1) == 0)
break; break;
if (strncmp(rv[0], "@", 1) == 0) { if (strncmp(rv[0], "@", 1) == 0) {
addresscount = getaddresses(lookup, &rv[0][1]); addresscount = getaddresses(lookup, &rv[0][1], NULL);
} else if (rv[0][0] == '+') { } else if (rv[0][0] == '+') {
plus_option(&rv[0][1], is_batchfile, plus_option(&rv[0][1], is_batchfile,
lookup); lookup);

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * 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 /*! \file
* \note * \note
@ -1705,6 +1705,9 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
isc_result_t result; isc_result_t result;
isc_boolean_t success = ISC_FALSE; isc_boolean_t success = ISC_FALSE;
int numLookups = 0; int numLookups = 0;
int num;
isc_result_t lresult, addresses_result;
char bad_namestr[DNS_NAME_FORMATSIZE];
dns_name_t *domain; dns_name_t *domain;
isc_boolean_t horizontal = ISC_FALSE, bad = ISC_FALSE; 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); debug("following up %s", query->lookup->textname);
addresses_result = ISC_R_SUCCESS;
bad_namestr[0] = '\0';
for (result = dns_message_firstname(msg, section); for (result = dns_message_firstname(msg, section);
result == ISC_R_SUCCESS; result == ISC_R_SUCCESS;
result = dns_message_nextname(msg, section)) { 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); dns_name_copy(name, domain, NULL);
} }
debug("adding server %s", namestr); 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); 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 && if (lookup == NULL &&
section == DNS_SECTION_ANSWER && section == DNS_SECTION_ANSWER &&
@ -3547,7 +3565,7 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
} }
int 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_result_t result;
isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES]; isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES];
isc_netaddr_t netaddr; isc_netaddr_t netaddr;
@ -3557,9 +3575,14 @@ getaddresses(dig_lookup_t *lookup, const char *host) {
result = bind9_getaddresses(host, 0, sockaddrs, result = bind9_getaddresses(host, 0, sockaddrs,
DIG_MAX_ADDRESSES, &count); DIG_MAX_ADDRESSES, &count);
if (result != ISC_R_SUCCESS) if (resultp != NULL)
*resultp = result;
if (result != ISC_R_SUCCESS) {
if (resultp == NULL)
fatal("couldn't get address for '%s': %s", fatal("couldn't get address for '%s': %s",
host, isc_result_totext(result)); host, isc_result_totext(result));
return 0;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]); isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]);

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * 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 #ifndef DIG_H
#define DIG_H #define DIG_H
@ -289,7 +289,7 @@ isc_result_t
get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr); get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr);
int int
getaddresses(dig_lookup_t *lookup, const char *host); getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp);
isc_result_t isc_result_t
get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int, get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,