3011. [func] Change the default query timeout from 30 seconds
to 10. Allow setting this in named.conf using the new
'resolver-query-timeout' option, which specifies a max
time in seconds. 0 means 'default' and anything longer
than 30 will be silently set to 30. [RT #22852]
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
3011. [func] Change the default query timeout from 30 seconds
|
||||
to 10. Allow setting this in named.conf using the new
|
||||
'resolver-query-timeout' option, which specifies a max
|
||||
time in seconds. 0 means 'default' and anything longer
|
||||
than 30 will be silently set to 30. [RT #22852]
|
||||
|
||||
3010. [bug] Fixed a bug where "rndc reconfig" stopped the timer
|
||||
for refreshing managed-keys. [RT #22296]
|
||||
|
||||
|
||||
+2
-1
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: config.c,v 1.113 2010/12/16 09:51:27 jinmei Exp $ */
|
||||
/* $Id: config.c,v 1.113.16.1 2011/02/03 05:50:05 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -89,6 +89,7 @@ options {\n\
|
||||
#endif
|
||||
"\
|
||||
recursive-clients 1000;\n\
|
||||
resolver-query-timeout 30;\n\
|
||||
rrset-order {type NS order random; order cyclic; };\n\
|
||||
serial-queries 20;\n\
|
||||
serial-query-rate 20;\n\
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
- PERFORMANCE OF THIS SOFTWARE.
|
||||
-->
|
||||
|
||||
<!-- $Id: named.conf.docbook,v 1.49 2011/01/07 23:47:07 tbox Exp $ -->
|
||||
<!-- $Id: named.conf.docbook,v 1.49.14.1 2011/02/03 05:50:05 marka Exp $ -->
|
||||
<refentry>
|
||||
<refentryinfo>
|
||||
<date>Aug 13, 2004</date>
|
||||
@@ -255,6 +255,7 @@ options {
|
||||
queryport-pool-ports <replaceable>integer</replaceable>;
|
||||
queryport-pool-updateinterval <replaceable>integer</replaceable>;
|
||||
cleaning-interval <replaceable>integer</replaceable>;
|
||||
resolver-query-timeout <replaceable>integer</replaceable>;
|
||||
min-roots <replaceable>integer</replaceable>; // not implemented
|
||||
lame-ttl <replaceable>integer</replaceable>;
|
||||
max-ncache-ttl <replaceable>integer</replaceable>;
|
||||
@@ -442,6 +443,7 @@ view <replaceable>string</replaceable> <replaceable>optional_class</replaceable>
|
||||
queryport-pool-ports <replaceable>integer</replaceable>;
|
||||
queryport-pool-updateinterval <replaceable>integer</replaceable>;
|
||||
cleaning-interval <replaceable>integer</replaceable>;
|
||||
resolver-query-timeout <replaceable>integer</replaceable>;
|
||||
min-roots <replaceable>integer</replaceable>; // not implemented
|
||||
lame-ttl <replaceable>integer</replaceable>;
|
||||
max-ncache-ttl <replaceable>integer</replaceable>;
|
||||
|
||||
+11
-1
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.c,v 1.599.8.1 2011/02/03 00:20:50 each Exp $ */
|
||||
/* $Id: server.c,v 1.599.8.2 2011/02/03 05:50:05 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -1615,6 +1615,7 @@ configure_view(dns_view_t *view, cfg_parser_t* parser,
|
||||
cfg_parser_t *newzones_parser = NULL;
|
||||
cfg_obj_t *nzfconf = NULL;
|
||||
dns_acl_t *clients = NULL, *mapped = NULL, *excluded = NULL;
|
||||
unsigned int query_timeout;
|
||||
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
|
||||
@@ -2205,6 +2206,15 @@ configure_view(dns_view_t *view, cfg_parser_t* parser,
|
||||
if (lame_ttl > 1800)
|
||||
lame_ttl = 1800;
|
||||
dns_resolver_setlamettl(view->resolver, lame_ttl);
|
||||
|
||||
/*
|
||||
* Set the resolver's query timeout.
|
||||
*/
|
||||
obj = NULL;
|
||||
result = ns_config_get(maps, "resolver-query-timeout", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
query_timeout = cfg_obj_asuint32(obj);
|
||||
dns_resolver_settimeout(view->resolver, query_timeout);
|
||||
|
||||
/* Specify whether to use 0-TTL for negative response for SOA query */
|
||||
dns_resolver_setzeronosoattl(view->resolver, zero_no_soattl);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: Makefile.in,v 1.144 2011/01/11 23:47:12 tbox Exp $
|
||||
# $Id: Makefile.in,v 1.144.10.1 2011/02/03 05:50:05 marka Exp $
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
@@ -41,7 +41,8 @@ LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@
|
||||
|
||||
LIBS = @LIBS@
|
||||
|
||||
SUBDIRS = atomic db dst master mem hashes names net rbt sockaddr tasks timers system
|
||||
SUBDIRS = atomic db dst master mem hashes names net rbt resolver \
|
||||
sockaddr tasks timers system
|
||||
|
||||
# Test programs that are built by default:
|
||||
# cfg_test is needed for regenerating doc/misc/options
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Makefile
|
||||
.libs
|
||||
*.la
|
||||
*.lo
|
||||
t_resolver
|
||||
@@ -0,0 +1,58 @@
|
||||
# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 1999-2002 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: Makefile.in,v 1.2.2.2 2011/02/03 05:50:06 marka Exp $
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
@BIND9_MAKE_INCLUDES@
|
||||
|
||||
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES}
|
||||
|
||||
CDEFINES =
|
||||
CWARNINGS =
|
||||
|
||||
# Note that we do not want to use libtool for libt_api
|
||||
DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
|
||||
ISCLIBS = ../../../lib/isc/libisc.@A@
|
||||
|
||||
DNSDEPLIBS = ../../../lib/dns/libdns.@A@
|
||||
ISCDEPLIBS = ../../../lib/isc/libisc.@A@
|
||||
|
||||
DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
|
||||
|
||||
LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@
|
||||
|
||||
TLIB = ../../../lib/tests/libt_api.@A@
|
||||
|
||||
TARGETS = t_resolver@EXEEXT@
|
||||
|
||||
SRCS = t_resolver.c
|
||||
|
||||
@BIND9_MAKE_RULES@
|
||||
|
||||
t_resolver@EXEEXT@: t_resolver.@O@ ${DEPLIBS} ${TLIB}
|
||||
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ t_resolver.@O@ ${TLIB} ${LIBS}
|
||||
|
||||
test: t_resolver@EXEEXT@
|
||||
-@./t_resolver@EXEEXT@ -c @top_srcdir@/t_config -b @srcdir@ -a
|
||||
|
||||
testhelp:
|
||||
@./t_resolver@EXEEXT@ -h
|
||||
|
||||
clean distclean::
|
||||
rm -f ${TARGETS}
|
||||
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: t_resolver.c,v 1.2.2.2 2011/02/03 05:50:06 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/timer.h>
|
||||
#include <isc/task.h>
|
||||
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/resolver.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/view.h>
|
||||
|
||||
#include <tests/t_api.h>
|
||||
|
||||
char *progname;
|
||||
|
||||
#define CHECK(x) RUNTIME_CHECK(ISC_R_SUCCESS == (x))
|
||||
|
||||
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_timermgr_t *timer_manager = NULL;
|
||||
isc_socketmgr_t *socket_manager = NULL;
|
||||
isc_taskmgr_t *task_manager = NULL;
|
||||
dns_dispatchmgr_t *dispatch_manager = NULL;
|
||||
dns_view_t *view = NULL;
|
||||
dns_dispatch_t *dispatch_v4 = NULL;
|
||||
|
||||
static void
|
||||
setup_create_dispatch_v4(void)
|
||||
{
|
||||
isc_sockaddr_t local_address;
|
||||
isc_sockaddr_any(&local_address);
|
||||
|
||||
CHECK(dns_dispatch_getudp(dispatch_manager, socket_manager, task_manager,
|
||||
&local_address, 4096, 100, 100, 100, 500,
|
||||
0, 0, /* unsigned int attributes, unsigned int mask, */
|
||||
&dispatch_v4));
|
||||
}
|
||||
static void
|
||||
setup(void) {
|
||||
/* 1 */ CHECK(isc_mem_create(0, 0, &mctx));
|
||||
/* 2 */ CHECK(isc_timermgr_create(mctx, &timer_manager));
|
||||
/* 3 */ CHECK(isc_taskmgr_create(mctx, 1, 0, &task_manager));
|
||||
/* 4 */ CHECK(isc_socketmgr_create(mctx, &socket_manager));
|
||||
/* 5 */ CHECK(dns_dispatchmgr_create(mctx, NULL, &dispatch_manager));
|
||||
/* 6 */ CHECK(dns_view_create(mctx, dns_rdataclass_in, "testview", &view));
|
||||
/* 7 */ setup_create_dispatch_v4();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown(void) {
|
||||
/* 7 */ dns_dispatch_detach(&dispatch_v4);
|
||||
/* 6 */ dns_view_detach(&view);
|
||||
/* 5 */ dns_dispatchmgr_destroy(&dispatch_manager);
|
||||
/* 4 */ isc_socketmgr_destroy(&socket_manager);
|
||||
/* 3 */ isc_taskmgr_destroy(&task_manager);
|
||||
/* 2 */ isc_timermgr_destroy(&timer_manager);
|
||||
/* 1 */ isc_mem_destroy(&mctx);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
make_resolver(dns_resolver_t **resolverp) {
|
||||
isc_result_t result;
|
||||
|
||||
result = dns_resolver_create(view,
|
||||
task_manager, 1,
|
||||
socket_manager,
|
||||
timer_manager,
|
||||
0, /* unsigned int options, */
|
||||
dispatch_manager,
|
||||
dispatch_v4,
|
||||
NULL, /* dns_dispatch_t *dispatchv6, */
|
||||
resolverp);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_resolver(dns_resolver_t **resolverp) {
|
||||
dns_resolver_shutdown(*resolverp);
|
||||
dns_resolver_detach(resolverp);
|
||||
}
|
||||
|
||||
static void
|
||||
test_dns_resolver_create() {
|
||||
dns_resolver_t *resolver = NULL;
|
||||
|
||||
t_assert("test_dns_resolver_create", 1, T_REQUIRED, "%s",
|
||||
"a resolver can be created successfully");
|
||||
setup();
|
||||
CHECK(make_resolver(&resolver));
|
||||
|
||||
destroy_resolver(&resolver);
|
||||
teardown();
|
||||
|
||||
t_result(T_PASS);
|
||||
}
|
||||
|
||||
static void
|
||||
test_dns_resolver_gettimeout(void) {
|
||||
dns_resolver_t *resolver = NULL;
|
||||
int test_result;
|
||||
unsigned int timeout;
|
||||
|
||||
t_assert("test_dns_resolver_gettimeout", 1, T_REQUIRED, "%s",
|
||||
"The default timeout is returned from _gettimeout()");
|
||||
setup();
|
||||
CHECK(make_resolver(&resolver));
|
||||
|
||||
timeout = dns_resolver_gettimeout(resolver);
|
||||
t_info("The default timeout is %d second%s\n", timeout, (timeout == 1 ? "" : "s"));
|
||||
test_result = (timeout > 0) ? T_PASS : T_FAIL;
|
||||
|
||||
destroy_resolver(&resolver);
|
||||
teardown();
|
||||
|
||||
t_result(test_result);
|
||||
}
|
||||
|
||||
static void
|
||||
test_dns_resolver_settimeout(void) {
|
||||
dns_resolver_t *resolver = NULL;
|
||||
int test_result;
|
||||
unsigned int default_timeout, timeout;
|
||||
|
||||
t_assert("test_dns_resolver_settimeout", 1, T_REQUIRED, "%s",
|
||||
"_settimeout() can change the timeout to a non-default");
|
||||
setup();
|
||||
CHECK(make_resolver(&resolver));
|
||||
|
||||
default_timeout = dns_resolver_gettimeout(resolver);
|
||||
t_info("The default timeout is %d second%s\n", default_timeout,
|
||||
(default_timeout == 1 ? "" : "s"));
|
||||
|
||||
dns_resolver_settimeout(resolver, default_timeout - 1);
|
||||
timeout = dns_resolver_gettimeout(resolver);
|
||||
t_info("The new timeout is %d second%s\n", timeout,
|
||||
(timeout == 1 ? "" : "s"));
|
||||
test_result = (timeout == default_timeout - 1) ? T_PASS : T_FAIL;
|
||||
|
||||
destroy_resolver(&resolver);
|
||||
teardown();
|
||||
|
||||
t_result(test_result);
|
||||
}
|
||||
|
||||
static void
|
||||
test_dns_resolver_settimeout_to_default(void) {
|
||||
dns_resolver_t *resolver = NULL;
|
||||
int test_result;
|
||||
unsigned int default_timeout, timeout;
|
||||
|
||||
t_assert("test_dns_resolver_settimeout_to_default", 1, T_REQUIRED, "%s",
|
||||
"_settimeout() can change the timeout back to a default value"
|
||||
" by specifying 0 as the timeout.");
|
||||
setup();
|
||||
CHECK(make_resolver(&resolver));
|
||||
|
||||
default_timeout = dns_resolver_gettimeout(resolver);
|
||||
t_info("The default timeout is %d second%s\n", default_timeout,
|
||||
(default_timeout == 1 ? "" : "s"));
|
||||
|
||||
dns_resolver_settimeout(resolver, default_timeout - 1);
|
||||
timeout = dns_resolver_gettimeout(resolver);
|
||||
t_info("The new timeout is %d second%s\n", timeout,
|
||||
(timeout == 1 ? "" : "s"));
|
||||
|
||||
dns_resolver_settimeout(resolver, 0);
|
||||
timeout = dns_resolver_gettimeout(resolver);
|
||||
test_result = (timeout == default_timeout) ? T_PASS : T_FAIL;
|
||||
|
||||
destroy_resolver(&resolver);
|
||||
teardown();
|
||||
|
||||
t_result(test_result);
|
||||
}
|
||||
|
||||
static void
|
||||
test_dns_resolver_settimeout_over_maximum(void) {
|
||||
dns_resolver_t *resolver = NULL;
|
||||
int test_result;
|
||||
unsigned int timeout;
|
||||
|
||||
t_assert("test_dns_resolver_settimeout_over_maximum", 1, T_REQUIRED, "%s",
|
||||
"_settimeout() cannot set the value larger than the maximum.");
|
||||
setup();
|
||||
CHECK(make_resolver(&resolver));
|
||||
|
||||
dns_resolver_settimeout(resolver, 4000000);
|
||||
timeout = dns_resolver_gettimeout(resolver);
|
||||
t_info("The new timeout is %d second%s\n", timeout,
|
||||
(timeout == 1 ? "" : "s"));
|
||||
|
||||
test_result = (timeout < 4000000 && timeout > 0) ? T_PASS : T_FAIL;
|
||||
|
||||
destroy_resolver(&resolver);
|
||||
teardown();
|
||||
|
||||
t_result(test_result);
|
||||
}
|
||||
|
||||
|
||||
testspec_t T_testlist[] = {
|
||||
{ test_dns_resolver_create, "dns_resolver_create" },
|
||||
{ test_dns_resolver_settimeout, "dns_resolver_settimeout" },
|
||||
{ test_dns_resolver_gettimeout, "dns_resolver_gettimeout" },
|
||||
{ test_dns_resolver_settimeout_to_default, "test_dns_resolver_settimeout_to_default" },
|
||||
{ test_dns_resolver_settimeout_over_maximum, "test_dns_resolver_settimeout_over_maximum" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
+2
-1
@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
|
||||
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
|
||||
AC_DIVERT_POP()dnl
|
||||
|
||||
AC_REVISION($Revision: 1.512 $)
|
||||
AC_REVISION($Revision: 1.512.8.1 $)
|
||||
|
||||
AC_INIT(lib/dns/name.c)
|
||||
AC_PREREQ(2.59)
|
||||
@@ -3299,6 +3299,7 @@ AC_CONFIG_FILES([
|
||||
bin/tests/names/Makefile
|
||||
bin/tests/net/Makefile
|
||||
bin/tests/rbt/Makefile
|
||||
bin/tests/resolver/Makefile
|
||||
bin/tests/sockaddr/Makefile
|
||||
bin/tests/system/Makefile
|
||||
bin/tests/system/conf.sh
|
||||
|
||||
+14
-1
@@ -18,7 +18,7 @@
|
||||
- PERFORMANCE OF THIS SOFTWARE.
|
||||
-->
|
||||
|
||||
<!-- File: $Id: Bv9ARM-book.xml,v 1.478 2011/01/22 01:21:05 marka Exp $ -->
|
||||
<!-- File: $Id: Bv9ARM-book.xml,v 1.478.8.1 2011/02/03 05:50:06 marka Exp $ -->
|
||||
<book xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>BIND 9 Administrator Reference Manual</title>
|
||||
|
||||
@@ -5163,6 +5163,7 @@ badresp:1,adberr:0,findfail:0,valfail:0]
|
||||
<optional> disable-empty-zone <replaceable>zone_name</replaceable> ; </optional>
|
||||
<optional> zero-no-soa-ttl <replaceable>yes_or_no</replaceable> ; </optional>
|
||||
<optional> zero-no-soa-ttl-cache <replaceable>yes_or_no</replaceable> ; </optional>
|
||||
<optional> resolver-query-timeout <replaceable>number</replaceable> ; </optional>
|
||||
<optional> deny-answer-addresses { <replaceable>address_match_list</replaceable> } <optional> except-from { <replaceable>namelist</replaceable> } </optional>;</optional>
|
||||
<optional> deny-answer-aliases { <replaceable>namelist</replaceable> } <optional> except-from { <replaceable>namelist</replaceable> } </optional>;</optional>
|
||||
<optional> response-policy { <replaceable>zone_name</replaceable> <optional> policy <replaceable>given</replaceable> | <replaceable>no-op</replaceable> | <replaceable>nxdomain</replaceable> | <replaceable>nodata</replaceable> | <replaceable>cname domain</replaceable> </optional> ; } ; </optional>
|
||||
@@ -7217,6 +7218,18 @@ options {
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command>resolver-query-timeout</command></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The amount of time the resolver will spend attempting
|
||||
to resolve a recursive query before failing. The
|
||||
default is <literal>10</literal> and the maximum is
|
||||
<literal>30</literal>. Setting it to <literal>0</literal>
|
||||
will result in the default being used.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
</sect3>
|
||||
|
||||
+5
-3
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dispatch.c,v 1.168 2009/12/02 23:15:14 marka Exp $ */
|
||||
/* $Id: dispatch.c,v 1.168.248.1 2011/02/03 05:50:06 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -1747,8 +1747,10 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) {
|
||||
isc_mempool_destroy(&mgr->epool);
|
||||
isc_mempool_destroy(&mgr->rpool);
|
||||
isc_mempool_destroy(&mgr->dpool);
|
||||
isc_mempool_destroy(&mgr->bpool);
|
||||
isc_mempool_destroy(&mgr->spool);
|
||||
if (mgr->bpool != NULL)
|
||||
isc_mempool_destroy(&mgr->bpool);
|
||||
if (mgr->spool != NULL)
|
||||
isc_mempool_destroy(&mgr->spool);
|
||||
|
||||
DESTROYLOCK(&mgr->pool_lock);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: resolver.h,v 1.67 2010/07/11 00:12:57 each Exp $ */
|
||||
/* $Id: resolver.h,v 1.67.86.1 2011/02/03 05:50:07 marka Exp $ */
|
||||
|
||||
#ifndef DNS_RESOLVER_H
|
||||
#define DNS_RESOLVER_H 1
|
||||
@@ -492,6 +492,27 @@ dns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name,
|
||||
isc_boolean_t
|
||||
dns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name);
|
||||
|
||||
|
||||
void
|
||||
dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds);
|
||||
/*%<
|
||||
* Set the length of time the resolver will work on a query, in seconds.
|
||||
*
|
||||
* If timeout is 0, the default timeout will be applied.
|
||||
*
|
||||
* Requires:
|
||||
* \li resolver to be valid.
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
dns_resolver_gettimeout(dns_resolver_t *resolver);
|
||||
/*%<
|
||||
* Get the current length of time the resolver will work on a query, in seconds.
|
||||
*
|
||||
* Requires:
|
||||
* \li resolver to be valid.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_resolver_setclientsperquery(dns_resolver_t *resolver,
|
||||
isc_uint32_t min, isc_uint32_t max);
|
||||
|
||||
+31
-2
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: resolver.c,v 1.428 2011/01/27 23:47:21 tbox Exp $ */
|
||||
/* $Id: resolver.c,v 1.428.6.1 2011/02/03 05:50:07 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -105,6 +105,14 @@
|
||||
#define QTRACE(m)
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_QUERY_TIMEOUT
|
||||
#define DEFAULT_QUERY_TIMEOUT 10 /* The default time in seconds for the whole query to live. */
|
||||
#endif
|
||||
|
||||
#ifndef MAXIMUM_QUERY_TIMEOUT
|
||||
#define MAXIMUM_QUERY_TIMEOUT 30 /* The maximum time in seconds for the whole query to live. */
|
||||
#endif
|
||||
|
||||
/*%
|
||||
* Maximum EDNS0 input packet size.
|
||||
*/
|
||||
@@ -386,6 +394,7 @@ struct dns_resolver {
|
||||
unsigned int spillatmin;
|
||||
isc_timer_t * spillattimer;
|
||||
isc_boolean_t zero_no_soa_ttl;
|
||||
unsigned int query_timeout;
|
||||
|
||||
/* Locked by lock. */
|
||||
unsigned int references;
|
||||
@@ -3658,7 +3667,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
|
||||
/*
|
||||
* Compute an expiration time for the entire fetch.
|
||||
*/
|
||||
isc_interval_set(&interval, 30, 0); /* XXXRTH constant */
|
||||
isc_interval_set(&interval, res->query_timeout, 0);
|
||||
iresult = isc_time_nowplusinterval(&fctx->expires, &interval);
|
||||
if (iresult != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
@@ -7423,6 +7432,7 @@ dns_resolver_create(dns_view_t *view,
|
||||
res->spillatmax = 100;
|
||||
res->spillattimer = NULL;
|
||||
res->zero_no_soa_ttl = ISC_FALSE;
|
||||
res->query_timeout = DEFAULT_QUERY_TIMEOUT;
|
||||
res->ndisps = 0;
|
||||
res->nextdisp = 0; /* meaningless at this point, but init it */
|
||||
res->nbuckets = ntasks;
|
||||
@@ -8721,3 +8731,22 @@ dns_resolver_getoptions(dns_resolver_t *resolver) {
|
||||
|
||||
return (resolver->options);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
dns_resolver_gettimeout(dns_resolver_t *resolver) {
|
||||
REQUIRE(VALID_RESOLVER(resolver));
|
||||
|
||||
return (resolver->query_timeout);
|
||||
}
|
||||
|
||||
void
|
||||
dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds) {
|
||||
REQUIRE(VALID_RESOLVER(resolver));
|
||||
|
||||
if (seconds == 0)
|
||||
seconds = DEFAULT_QUERY_TIMEOUT;
|
||||
if (seconds > MAXIMUM_QUERY_TIMEOUT)
|
||||
seconds = MAXIMUM_QUERY_TIMEOUT;
|
||||
|
||||
resolver->query_timeout = seconds;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: task.h,v 1.69 2010/12/22 13:05:20 marka Exp $ */
|
||||
/* $Id: task.h,v 1.69.14.1 2011/02/03 05:50:07 marka Exp $ */
|
||||
|
||||
#ifndef ISC_TASK_H
|
||||
#define ISC_TASK_H 1
|
||||
@@ -657,8 +657,10 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_NOTHREADS No threads could be created.
|
||||
*\li #ISC_R_NOTHREADS No threads could be created.
|
||||
*\li #ISC_R_UNEXPECTED An unexpected error occurred.
|
||||
*\li #ISC_R_SHUTTINGDOWN The non-threaded, shared, task
|
||||
* manager shutting down.
|
||||
*/
|
||||
|
||||
void
|
||||
|
||||
+8
-3
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: task.c,v 1.115 2010/12/22 05:19:01 marka Exp $ */
|
||||
/* $Id: task.c,v 1.115.14.1 2011/02/03 05:50:07 marka Exp $ */
|
||||
|
||||
/*! \file
|
||||
* \author Principal Author: Bob Halley
|
||||
@@ -1210,6 +1210,8 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
if (taskmgr != NULL) {
|
||||
if (taskmgr->refs == 0)
|
||||
return (ISC_R_SHUTTINGDOWN);
|
||||
taskmgr->refs++;
|
||||
*managerp = (isc_taskmgr_t *)taskmgr;
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -1325,8 +1327,8 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
#endif /* USE_WORKER_THREADS */
|
||||
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
if (manager->refs > 1) {
|
||||
manager->refs--;
|
||||
manager->refs--;
|
||||
if (manager->refs > 0) {
|
||||
*managerp = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -1396,6 +1398,9 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
isc_mem_printallactive(stderr);
|
||||
#endif
|
||||
INSIST(ISC_LIST_EMPTY(manager->tasks));
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
taskmgr = NULL;
|
||||
#endif
|
||||
#endif /* USE_WORKER_THREADS */
|
||||
|
||||
manager_free(manager);
|
||||
|
||||
+4
-3
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: timer.c,v 1.95 2009/10/05 17:30:49 fdupont Exp $ */
|
||||
/* $Id: timer.c,v 1.95.302.1 2011/02/03 05:50:07 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -974,12 +974,13 @@ isc__timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
LOCK(&manager->lock);
|
||||
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
if (manager->refs > 1) {
|
||||
manager->refs--;
|
||||
manager->refs--;
|
||||
if (manager->refs > 0) {
|
||||
UNLOCK(&manager->lock);
|
||||
*managerp = NULL;
|
||||
return;
|
||||
}
|
||||
timermgr = NULL;
|
||||
#endif /* USE_SHARED_MANAGER */
|
||||
|
||||
#ifndef USE_TIMER_THREAD
|
||||
|
||||
+10
-15
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.c,v 1.333 2010/12/22 03:08:36 marka Exp $ */
|
||||
/* $Id: socket.c,v 1.333.14.1 2011/02/03 05:50:07 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
#ifndef USE_WATCHER_THREAD
|
||||
#include "socket_p.h"
|
||||
#include "../task_p.h"
|
||||
#endif /* USE_WATCHER_THREAD */
|
||||
|
||||
#if defined(SO_BSDCOMPAT) && defined(__linux__)
|
||||
@@ -4262,38 +4263,32 @@ isc__socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
if (manager->refs > 1) {
|
||||
manager->refs--;
|
||||
manager->refs--;
|
||||
if (manager->refs > 0) {
|
||||
*managerp = NULL;
|
||||
return;
|
||||
}
|
||||
socketmgr = NULL;
|
||||
#endif /* USE_SHARED_MANAGER */
|
||||
|
||||
LOCK(&manager->lock);
|
||||
|
||||
#ifdef USE_WATCHER_THREAD
|
||||
/*
|
||||
* Wait for all sockets to be destroyed.
|
||||
*/
|
||||
while (!ISC_LIST_EMPTY(manager->socklist)) {
|
||||
#ifdef USE_WATCHER_THREAD
|
||||
manager_log(manager, CREATION, "%s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_SOCKETSREMAIN,
|
||||
"sockets exist"));
|
||||
WAIT(&manager->shutdown_ok, &manager->lock);
|
||||
}
|
||||
#else /* USE_WATCHER_THREAD */
|
||||
/*
|
||||
* Hope all sockets have been destroyed.
|
||||
*/
|
||||
if (!ISC_LIST_EMPTY(manager->socklist)) {
|
||||
manager_log(manager, CREATION, "%s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_SOCKETSREMAIN,
|
||||
"sockets exist"));
|
||||
INSIST(0);
|
||||
}
|
||||
UNLOCK(&manager->lock);
|
||||
isc__taskmgr_dispatch(NULL);
|
||||
LOCK(&manager->lock);
|
||||
#endif /* USE_WATCHER_THREAD */
|
||||
}
|
||||
|
||||
UNLOCK(&manager->lock);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: namedconf.c,v 1.131 2011/01/13 01:59:28 marka Exp $ */
|
||||
/* $Id: namedconf.c,v 1.131.8.1 2011/02/03 05:50:08 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -1242,6 +1242,7 @@ view_clauses[] = {
|
||||
{ "recursion", &cfg_type_boolean, 0 },
|
||||
{ "request-ixfr", &cfg_type_boolean, 0 },
|
||||
{ "request-nsid", &cfg_type_boolean, 0 },
|
||||
{ "resolver-query-timeout", &cfg_type_uint32, 0 },
|
||||
{ "rfc2308-type1", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
|
||||
{ "root-delegation-only", &cfg_type_optional_exclude, 0 },
|
||||
{ "rrset-order", &cfg_type_rrsetorder, 0 },
|
||||
|
||||
Reference in New Issue
Block a user