add LWRES_CONTEXT_SERVERMODE
This commit is contained in:
@@ -213,7 +213,8 @@ parse_resolv_conf(isc_mem_t *mem) {
|
||||
int i;
|
||||
|
||||
lwctx = NULL;
|
||||
lwresult = lwres_context_create(&lwctx, mem, mem_alloc, mem_free);
|
||||
lwresult = lwres_context_create(&lwctx, mem, mem_alloc, mem_free,
|
||||
LWRES_CONTEXT_SERVERMODE);
|
||||
if (lwresult != LWRES_R_SUCCESS)
|
||||
return;
|
||||
|
||||
@@ -404,7 +405,8 @@ main(int argc, char **argv) {
|
||||
cmgr[i].mctx = mem;
|
||||
cmgr[i].lwctx = NULL;
|
||||
result = lwres_context_create(&cmgr[i].lwctx, mem,
|
||||
mem_alloc, mem_free);
|
||||
mem_alloc, mem_free,
|
||||
LWRES_CONTEXT_SERVERMODE);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_task_detach(&cmgr[i].task);
|
||||
break;
|
||||
|
||||
@@ -257,9 +257,9 @@ main(int argc, char *argv[]) {
|
||||
|
||||
ctx = NULL;
|
||||
#ifdef USE_ISC_MEM
|
||||
ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free);
|
||||
ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free, 0);
|
||||
#else
|
||||
ret = lwres_context_create(&ctx, NULL, NULL, NULL);
|
||||
ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0);
|
||||
#endif
|
||||
|
||||
CHECK(ret, "lwres_context_create");
|
||||
|
||||
@@ -71,9 +71,9 @@ main(int argc, char *argv[]) {
|
||||
|
||||
ctx = NULL;
|
||||
#ifdef USE_ISC_MEM
|
||||
ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free);
|
||||
ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free, 0);
|
||||
#else
|
||||
ret = lwres_context_create(&ctx, NULL, NULL, NULL);
|
||||
ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0);
|
||||
#endif
|
||||
CHECK(ret, "lwres_context_create");
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ context_connect(lwres_context_t *);
|
||||
lwres_result_t
|
||||
lwres_context_create(lwres_context_t **contextp, void *arg,
|
||||
lwres_malloc_t malloc_function,
|
||||
lwres_free_t free_function)
|
||||
lwres_free_t free_function,
|
||||
unsigned int flags)
|
||||
{
|
||||
lwres_context_t *ctx;
|
||||
|
||||
@@ -87,7 +88,8 @@ lwres_context_create(lwres_context_t **contextp, void *arg,
|
||||
ctx->timeout = LWRES_DEFAULT_TIMEOUT;
|
||||
ctx->serial = (lwres_uint32_t)ctx; /* XXXMLG */
|
||||
|
||||
(void)context_connect(ctx); /* XXXMLG */
|
||||
if ((flags & LWRES_CONTEXT_SERVERMODE) == 0)
|
||||
(void)context_connect(ctx); /* XXXMLG */
|
||||
|
||||
/*
|
||||
* Init resolv.conf bits.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* The Berkeley Software Design Inc. software License Agreement specifies
|
||||
* the terms and conditions for redistribution.
|
||||
*
|
||||
* BSDI $Id: getaddrinfo.c,v 1.21 2000/06/15 21:52:21 explorer Exp $
|
||||
* BSDI $Id: getaddrinfo.c,v 1.22 2000/06/15 23:48:07 explorer Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@@ -417,7 +417,7 @@ add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
|
||||
lwres_result_t lwres;
|
||||
int result = 0;
|
||||
|
||||
lwres = lwres_context_create(&lwrctx, NULL, NULL, NULL);
|
||||
lwres = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
|
||||
if (lwres != 0)
|
||||
ERR(EAI_FAIL);
|
||||
if (hostname == NULL && (flags & AI_PASSIVE) == 0) {
|
||||
@@ -470,7 +470,7 @@ add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
|
||||
lwres_result_t lwres;
|
||||
int result = 0;
|
||||
|
||||
lwres = lwres_context_create(&lwrctx, NULL, NULL, NULL);
|
||||
lwres = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
|
||||
if (lwres != 0)
|
||||
ERR(EAI_FAIL);
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ lwres_getipnodebyname(const char *name, int af, int flags, int *error_num) {
|
||||
return (copyandmerge(&he, NULL, af, error_num));
|
||||
}
|
||||
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL);
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
|
||||
if (n != 0) {
|
||||
*error_num = NO_RECOVERY;
|
||||
goto cleanup;
|
||||
@@ -269,7 +269,7 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
|
||||
|
||||
if (af == AF_INET6)
|
||||
cp += 12;
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL);
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
|
||||
if (n == 0)
|
||||
n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V4,
|
||||
INADDRSZ, cp, &by);
|
||||
@@ -306,7 +306,7 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL);
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
|
||||
if (n == 0)
|
||||
n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V6, IN6ADDRSZ,
|
||||
src, &by);
|
||||
|
||||
@@ -227,7 +227,7 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
INSIST(0);
|
||||
}
|
||||
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL);
|
||||
n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
|
||||
if (n == 0)
|
||||
n = lwres_getnamebyaddr(lwrctx, lwf, afd->a_addrlen,
|
||||
addr, &by);
|
||||
|
||||
@@ -49,10 +49,18 @@ typedef void (*lwres_free_t)(void *arg, void *mem, size_t length);
|
||||
* Share /etc/resolv.conf data between contexts.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _SERVERMODE
|
||||
* Don't allocate and connect a socket to the server, since the
|
||||
* caller _is_ a server.
|
||||
*/
|
||||
#define LWRES_CONTEXT_SERVERMODE 0x00000001U
|
||||
|
||||
lwres_result_t
|
||||
lwres_context_create(lwres_context_t **contextp, void *arg,
|
||||
lwres_malloc_t malloc_function,
|
||||
lwres_free_t free_function);
|
||||
lwres_free_t free_function,
|
||||
unsigned int flags);
|
||||
/*
|
||||
* Allocate a lwres context. This is used in all lwres calls.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user