Commit 7cc56325 authored by Evan Hunt's avatar Evan Hunt
Browse files

3042. [bug] dig +trace could fail attempting to use IPv6

			addresses on systems with only IPv4 connectivity.
			[RT #23797]
parent d31e7b32
3042. [bug] dig +trace could fail attempting to use IPv6
addresses on systems with only IPv4 connectivity.
[RT #23797]
3041. [bug] dnssec-signzone failed to generate new signatures on
ttl changes. [RT #23330]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.237 2010/05/13 00:40:46 marka Exp $ */
/* $Id: dig.c,v 1.238 2011/02/25 23:11:13 each Exp $ */
/*! \file */
......@@ -44,8 +44,6 @@
#include <dns/result.h>
#include <dns/tsig.h>
#include <bind9/getaddresses.h>
#include <dig/dig.h>
#define ADD_STRING(b, s) { \
......@@ -1437,30 +1435,6 @@ preparse_args(int argc, char **argv) {
}
}
static void
getaddresses(dig_lookup_t *lookup, const char *host) {
isc_result_t result;
isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES];
isc_netaddr_t netaddr;
int count, i;
dig_server_t *srv;
char tmp[ISC_NETADDR_FORMATSIZE];
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));
for (i = 0; i < count; i++) {
isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]);
isc_netaddr_format(&netaddr, tmp, sizeof(tmp));
srv = make_server(tmp, host);
ISC_LIST_APPEND(lookup->my_server_list, srv, link);
}
addresscount = count;
}
static void
parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
int argc, char **argv) {
......@@ -1555,7 +1529,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) {
getaddresses(lookup, &rv[0][1]);
addresscount = getaddresses(lookup, &rv[0][1]);
} else if (rv[0][0] == '+') {
plus_option(&rv[0][1], is_batchfile,
lookup);
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.338 2011/02/21 23:47:44 tbox Exp $ */
/* $Id: dighost.c,v 1.339 2011/02/25 23:11:13 each Exp $ */
/*! \file
* \note
......@@ -1765,8 +1765,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
dns_rdata_freestruct(&ns);
/* Initialize lookup if we've not yet */
debug("found NS %d %s", numLookups, namestr);
numLookups++;
debug("found NS %s", namestr);
if (!success) {
success = ISC_TRUE;
lookup_counter++;
......@@ -1788,9 +1787,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
domain = dns_fixedname_name(&lookup->fdomain);
dns_name_copy(name, domain, NULL);
}
srv = make_server(namestr, namestr);
debug("adding server %s", srv->servername);
ISC_LIST_APPEND(lookup->my_server_list, srv, link);
debug("adding server %s", namestr);
numLookups += getaddresses(lookup, namestr);
dns_rdata_reset(&rdata);
}
}
......@@ -3539,6 +3537,31 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
return (ISC_R_SUCCESS);
}
int
getaddresses(dig_lookup_t *lookup, const char *host) {
isc_result_t result;
isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES];
isc_netaddr_t netaddr;
int count, i;
dig_server_t *srv;
char tmp[ISC_NETADDR_FORMATSIZE];
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));
for (i = 0; i < count; i++) {
isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]);
isc_netaddr_format(&netaddr, tmp, sizeof(tmp));
srv = make_server(tmp, host);
ISC_LIST_APPEND(lookup->my_server_list, srv, link);
}
return count;
}
/*%
* Initiate either a TCP or UDP lookup
*/
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.h,v 1.111 2009/09/29 15:06:06 fdupont Exp $ */
/* $Id: dig.h,v 1.112 2011/02/25 23:11:13 each Exp $ */
#ifndef DIG_H
#define DIG_H
......@@ -288,6 +288,9 @@ extern int idnoptions;
isc_result_t
get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr);
int
getaddresses(dig_lookup_t *lookup, const char *host);
isc_result_t
get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
isc_boolean_t strict);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment