]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3237. [bug] dig -6 didn't work with +trace. [RT #26906]
authorEvan Hunt <each@isc.org>
Wed, 7 Dec 2011 17:23:28 +0000 (17:23 +0000)
committerEvan Hunt <each@isc.org>
Wed, 7 Dec 2011 17:23:28 +0000 (17:23 +0000)
CHANGES
bin/dig/dig.c
bin/dig/dighost.c
bin/dig/include/dig/dig.h

diff --git a/CHANGES b/CHANGES
index 7c8533529ec694663371a7a0cd4cc642054482d0..a4b5130437f2e6b81d432d2d7906115a3963e998 100644 (file)
--- 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]
 
index 5107db9c8f6ab594b6e273ac78a7c59d37d15c37..fea96deb46c24d319c5c1ca2356d884f054619af 100644 (file)
@@ -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);
index 743885b0393fb5cbcad9ad53cb1e206acb991244..994def7a804a2b0a175ca9e4cd9009fa4bc3beb6 100644 (file)
@@ -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]);
index ae769c987811e35a58955d6e5a3b816f6d055f1d..b34542e30cda89cdad692feaa9e439bfb6aa3b80 100644 (file)
@@ -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,