2517. [bug] dig +trace with -4 or -6 failed when it chose a

			nameserver address of the unsupported address.
			[RT #18843]
parent cb30636a
2517. [bug] dig +trace with -4 or -6 failed when it chose a
nameserver address of the unsupported address.
[RT #18843]
2516. [bug] glue sort for responses was performed even when not
needed. [RT #19039]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.313 2008/12/13 02:43:25 jinmei Exp $ */
/* $Id: dighost.c,v 1.314 2008/12/16 02:57:24 jinmei Exp $ */
/*! \file
* \note
......@@ -2196,6 +2196,21 @@ bringup_timer(dig_query_t *query, unsigned int default_timeout) {
check_result(result, "isc_timer_create");
}
static void
force_timeout(dig_lookup_t *l, dig_query_t *query) {
isc_event_t *event;
event = isc_event_allocate(mctx, query, ISC_TIMEREVENT_IDLE,
connect_timeout, l,
sizeof(isc_event_t));
if (event == NULL) {
fatal("isc_event_allocate: %s",
isc_result_totext(ISC_R_NOMEMORY));
}
isc_task_send(global_task, &event);
}
static void
connect_done(isc_task_t *task, isc_event_t *event);
......@@ -2215,7 +2230,16 @@ send_tcp_connect(dig_query_t *query) {
l = query->lookup;
query->waiting_connect = ISC_TRUE;
query->lookup->current_query = query;
get_address(query->servname, port, &query->sockaddr);
result = get_address(query->servname, port, &query->sockaddr);
if (result == ISC_R_NOTFOUND) {
/*
* This servname doesn't have an address. Try the next server
* by triggering an immediate 'timeout' (we lie, but the effect
* is the same).
*/
force_timeout(l, query);
return;
}
if (specified_source &&
(isc_sockaddr_pf(&query->sockaddr) !=
......@@ -2288,7 +2312,12 @@ send_udp(dig_query_t *query) {
if (!query->recv_made) {
/* XXX Check the sense of this, need assertion? */
query->waiting_connect = ISC_FALSE;
get_address(query->servname, port, &query->sockaddr);
result = get_address(query->servname, port, &query->sockaddr);
if (result == ISC_R_NOTFOUND) {
/* This servname doesn't have an address. */
force_timeout(l, query);
return;
}
result = isc_socket_create(socketmgr,
isc_sockaddr_pf(&query->sockaddr),
......@@ -3241,7 +3270,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
* used in looking up server names, etc... and needs to use system-supplied
* routines, since they may be using a non-DNS system for these lookups.
*/
void
isc_result_t
get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
int count;
isc_result_t result;
......@@ -3250,9 +3279,11 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
result = bind9_getaddresses(host, port, sockaddr, 1, &count);
isc_app_unblock();
if (result != ISC_R_SUCCESS)
fatal("couldn't get address for '%s': %s",
host, isc_result_totext(result));
return (result);
INSIST(count == 1);
return (ISC_R_SUCCESS);
}
/*%
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.h,v 1.107 2008/04/03 06:09:04 tbox Exp $ */
/* $Id: dig.h,v 1.108 2008/12/16 02:57:24 jinmei Exp $ */
#ifndef DIG_H
#define DIG_H
......@@ -285,7 +285,7 @@ extern int idnoptions;
/*
* Routines in dighost.c.
*/
void
isc_result_t
get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr);
isc_result_t
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nslookup.c,v 1.117 2007/06/18 23:47:17 tbox Exp $ */
/* $Id: nslookup.c,v 1.118 2008/12/16 02:57:24 jinmei Exp $ */
#include <config.h>
......@@ -441,13 +441,16 @@ show_settings(isc_boolean_t full, isc_boolean_t serv_only) {
dig_server_t *srv;
isc_sockaddr_t sockaddr;
dig_searchlist_t *listent;
isc_result_t result;
srv = ISC_LIST_HEAD(server_list);
while (srv != NULL) {
char sockstr[ISC_SOCKADDR_FORMATSIZE];
get_address(srv->servername, port, &sockaddr);
result = get_address(srv->servername, port, &sockaddr);
check_result(result, "get_address");
isc_sockaddr_format(&sockaddr, sockstr, sizeof(sockstr));
printf("Default server: %s\nAddress: %s\n",
srv->userarg, sockstr);
......
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