2519. [bug] dig/host with -4 or -6 didn't work if more than two

			nameserver addresses of the excluded address family
			preceded in resolv.conf. [RT #19081]
parent 96eeb949
2519. [bug] dig/host with -4 or -6 didn't work if more than two
nameserver addresses of the excluded address family
preceded in resolv.conf. [RT #19081]
2518. [func] Add support for the new CERT types from RFC 4398.
[RT #19077]
2517. [bug] dig +trace with -4 or -6 failed when it chose a
nameserver address of the unsupported address.
nameserver address of the excluded address.
[RT #18843]
2516. [bug] glue sort for responses was performed even when not
......@@ -12,7 +16,7 @@
[RT #19063]
2514. [bug] dig/host failed with -4 or -6 when resolv.conf contains
a nameserver of the unsupported address family.
a nameserver of the excluded address family.
[RT #18848]
2513. [bug] Fix windows cli build. [RT #19062]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.314 2008/12/16 02:57:24 jinmei Exp $ */
/* $Id: dighost.c,v 1.315 2008/12/17 19:19:29 jinmei Exp $ */
/*! \file
* \note
......@@ -1011,10 +1011,18 @@ void
setup_system(void) {
dig_searchlist_t *domain = NULL;
lwres_result_t lwresult;
unsigned int lwresflags;
debug("setup_system()");
lwresult = lwres_context_create(&lwctx, mctx, mem_alloc, mem_free, 1);
lwresflags = LWRES_CONTEXT_SERVERMODE;
if (have_ipv4)
lwresflags |= LWRES_CONTEXT_USEIPV4;
if (have_ipv6)
lwresflags |= LWRES_CONTEXT_USEIPV6;
lwresult = lwres_context_create(&lwctx, mctx, mem_alloc, mem_free,
lwresflags);
if (lwresult != LWRES_R_SUCCESS)
fatal("lwres_context_create failed");
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: context.c,v 1.50 2007/06/18 23:47:51 tbox Exp $ */
/* $Id: context.c,v 1.51 2008/12/17 19:19:29 jinmei Exp $ */
/*! \file context.c
lwres_context_create() creates a #lwres_context_t structure for use in
......@@ -156,7 +156,6 @@ lwres_context_create(lwres_context_t **contextp, void *arg,
lwres_context_t *ctx;
REQUIRE(contextp != NULL && *contextp == NULL);
UNUSED(flags);
/*
* If we were not given anything special to use, use our own
......@@ -184,6 +183,17 @@ lwres_context_create(lwres_context_t **contextp, void *arg,
ctx->timeout = LWRES_DEFAULT_TIMEOUT;
ctx->serial = time(NULL); /* XXXMLG or BEW */
ctx->use_ipv4 = 1;
ctx->use_ipv6 = 1;
if ((flags & (LWRES_CONTEXT_USEIPV4 | LWRES_CONTEXT_USEIPV6)) ==
LWRES_CONTEXT_USEIPV6) {
ctx->use_ipv4 = 0;
}
if ((flags & (LWRES_CONTEXT_USEIPV4 | LWRES_CONTEXT_USEIPV6)) ==
LWRES_CONTEXT_USEIPV4) {
ctx->use_ipv6 = 0;
}
/*
* Init resolv.conf bits.
*/
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: context_p.h,v 1.17 2007/06/19 23:47:22 tbox Exp $ */
/* $Id: context_p.h,v 1.18 2008/12/17 19:19:29 jinmei Exp $ */
#ifndef LWRES_CONTEXT_P_H
#define LWRES_CONTEXT_P_H 1
......@@ -46,6 +46,8 @@ struct lwres_context {
*/
int sock; /*%< socket to send on */
lwres_addr_t address; /*%< address to send to */
int use_ipv4; /*%< use IPv4 transaction */
int use_ipv6; /*%< use IPv6 transaction */
/*@{*/
/*
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: context.h,v 1.21 2007/06/19 23:47:23 tbox Exp $ */
/* $Id: context.h,v 1.22 2008/12/17 19:19:29 jinmei Exp $ */
#ifndef LWRES_CONTEXT_H
#define LWRES_CONTEXT_H 1
......@@ -57,8 +57,15 @@ typedef void (*lwres_free_t)(void *arg, void *mem, size_t length);
* _SERVERMODE
* Don't allocate and connect a socket to the server, since the
* caller _is_ a server.
*
* _USEIPV4, _USEIPV6
* Use IPv4 and IPv6 transactions with remote servers, respectively.
* For backward compatibility, regard both flags as being set when both
* are cleared.
*/
#define LWRES_CONTEXT_SERVERMODE 0x00000001U
#define LWRES_CONTEXT_USEIPV4 0x00000002U
#define LWRES_CONTEXT_USEIPV6 0x00000004U
lwres_result_t
lwres_context_create(lwres_context_t **contextp, void *arg,
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwconfig.c,v 1.46 2007/06/19 23:47:22 tbox Exp $ */
/* $Id: lwconfig.c,v 1.47 2008/12/17 19:19:29 jinmei Exp $ */
/*! \file */
......@@ -313,8 +313,11 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
return (LWRES_R_FAILURE); /* Extra junk on line. */
res = lwres_create_addr(word, &address, 1);
if (res == LWRES_R_SUCCESS)
if (res == LWRES_R_SUCCESS &&
((address.family == LWRES_ADDRTYPE_V4 && ctx->use_ipv4 == 1) ||
(address.family == LWRES_ADDRTYPE_V6 && ctx->use_ipv6 == 1))) {
confdata->nameservers[confdata->nsnext++] = address;
}
return (LWRES_R_SUCCESS);
}
......
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