summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/lwres/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind9/lib/lwres/context.c')
-rw-r--r--contrib/bind9/lib/lwres/context.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/contrib/bind9/lib/lwres/context.c b/contrib/bind9/lib/lwres/context.c
index c731bb7..464a2cf 100644
--- a/contrib/bind9/lib/lwres/context.c
+++ b/contrib/bind9/lib/lwres/context.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,9 +15,9 @@
* 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.50.332.2 2008/12/30 23:46:49 tbox Exp $ */
-/*! \file context.c
+/*! \file context.c
lwres_context_create() creates a #lwres_context_t structure for use in
lightweight resolver operations. It holds a socket and other data
needed for communicating with a resolver daemon. The new
@@ -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.
*/
@@ -194,9 +204,9 @@ lwres_context_create(lwres_context_t **contextp, void *arg,
}
/*%
-Destroys a #lwres_context_t, closing its socket.
-contextp is a pointer to a pointer to the context that is
-to be destroyed. The pointer will be set to NULL
+Destroys a #lwres_context_t, closing its socket.
+contextp is a pointer to a pointer to the context that is
+to be destroyed. The pointer will be set to NULL
when the context has been destroyed.
*/
void
@@ -449,7 +459,7 @@ lwres_context_sendrecv(lwres_context_t *ctx,
struct timeval timeout;
/*
- * Type of tv_sec is 32 bits long.
+ * Type of tv_sec is 32 bits long.
*/
if (ctx->timeout <= 0x7FFFFFFFU)
timeout.tv_sec = (int)ctx->timeout;
@@ -465,7 +475,7 @@ lwres_context_sendrecv(lwres_context_t *ctx,
FD_ZERO(&readfds);
FD_SET(ctx->sock, &readfds);
ret2 = select(ctx->sock + 1, &readfds, NULL, NULL, &timeout);
-
+
/*
* What happened with select?
*/
@@ -477,6 +487,6 @@ lwres_context_sendrecv(lwres_context_t *ctx,
result = lwres_context_recv(ctx, recvbase, recvlen, recvd_len);
if (result == LWRES_R_RETRY)
goto again;
-
+
return (result);
}
OpenPOWER on IntegriCloud