+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]
+
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
needed. [RT #19039]
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]
2511. [cleanup] dns_rdata_tofmttext() add const to linebreak.
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.259.18.52 2008/12/16 03:00:06 jinmei Exp $ */
+/* $Id: dighost.c,v 1.259.18.53 2008/12/17 19:23:27 jinmei Exp $ */
/*! \file
* \note
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");
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: context.c,v 1.45.18.7 2007/08/28 07:20:06 tbox Exp $ */
+/* $Id: context.c,v 1.45.18.8 2008/12/17 19:23:27 jinmei Exp $ */
/*! \file context.c
lwres_context_create() creates a #lwres_context_t structure for use in
lwres_context_t *ctx;
REQUIRE(contextp != NULL && *contextp == NULL);
- UNUSED(flags);
/*
* If we were not given anything special to use, use our own
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.
*/
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: context_p.h,v 1.13.18.2 2005/04/29 00:17:17 marka Exp $ */
+/* $Id: context_p.h,v 1.13.18.3 2008/12/17 19:23:27 jinmei Exp $ */
#ifndef LWRES_CONTEXT_P_H
#define LWRES_CONTEXT_P_H 1
*/
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 */
/*@{*/
/*
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: context.h,v 1.15.18.2 2005/04/29 00:17:21 marka Exp $ */
+/* $Id: context.h,v 1.15.18.3 2008/12/17 19:23:27 jinmei Exp $ */
#ifndef LWRES_CONTEXT_H
#define LWRES_CONTEXT_H 1
* _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,
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwconfig.c,v 1.38.18.5 2006/10/03 23:50:51 marka Exp $ */
+/* $Id: lwconfig.c,v 1.38.18.6 2008/12/17 19:23:27 jinmei Exp $ */
/*! \file */
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);
}