Commit 000a8970 authored by Mark Andrews's avatar Mark Andrews

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]
parent da6fe5c1
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 3010. [bug] Fixed a bug where "rndc reconfig" stopped the timer
for refreshing managed-keys. [RT #22296] for refreshing managed-keys. [RT #22296]
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: config.c,v 1.113 2010/12/16 09:51:27 jinmei Exp $ */ /* $Id: config.c,v 1.114 2011/02/03 05:41:52 marka Exp $ */
/*! \file */ /*! \file */
...@@ -89,6 +89,7 @@ options {\n\ ...@@ -89,6 +89,7 @@ options {\n\
#endif #endif
"\ "\
recursive-clients 1000;\n\ recursive-clients 1000;\n\
resolver-query-timeout 30;\n\
rrset-order {type NS order random; order cyclic; };\n\ rrset-order {type NS order random; order cyclic; };\n\
serial-queries 20;\n\ serial-queries 20;\n\
serial-query-rate 20;\n\ serial-query-rate 20;\n\
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
- PERFORMANCE OF THIS SOFTWARE. - 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.50 2011/02/03 05:41:52 marka Exp $ -->
<refentry> <refentry>
<refentryinfo> <refentryinfo>
<date>Aug 13, 2004</date> <date>Aug 13, 2004</date>
...@@ -255,6 +255,7 @@ options { ...@@ -255,6 +255,7 @@ options {
queryport-pool-ports <replaceable>integer</replaceable>; queryport-pool-ports <replaceable>integer</replaceable>;
queryport-pool-updateinterval <replaceable>integer</replaceable>; queryport-pool-updateinterval <replaceable>integer</replaceable>;
cleaning-interval <replaceable>integer</replaceable>; cleaning-interval <replaceable>integer</replaceable>;
resolver-query-timeout <replaceable>integer</replaceable>;
min-roots <replaceable>integer</replaceable>; // not implemented min-roots <replaceable>integer</replaceable>; // not implemented
lame-ttl <replaceable>integer</replaceable>; lame-ttl <replaceable>integer</replaceable>;
max-ncache-ttl <replaceable>integer</replaceable>; max-ncache-ttl <replaceable>integer</replaceable>;
...@@ -442,6 +443,7 @@ view <replaceable>string</replaceable> <replaceable>optional_class</replaceable> ...@@ -442,6 +443,7 @@ view <replaceable>string</replaceable> <replaceable>optional_class</replaceable>
queryport-pool-ports <replaceable>integer</replaceable>; queryport-pool-ports <replaceable>integer</replaceable>;
queryport-pool-updateinterval <replaceable>integer</replaceable>; queryport-pool-updateinterval <replaceable>integer</replaceable>;
cleaning-interval <replaceable>integer</replaceable>; cleaning-interval <replaceable>integer</replaceable>;
resolver-query-timeout <replaceable>integer</replaceable>;
min-roots <replaceable>integer</replaceable>; // not implemented min-roots <replaceable>integer</replaceable>; // not implemented
lame-ttl <replaceable>integer</replaceable>; lame-ttl <replaceable>integer</replaceable>;
max-ncache-ttl <replaceable>integer</replaceable>; max-ncache-ttl <replaceable>integer</replaceable>;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: server.c,v 1.600 2011/02/03 00:21:55 each Exp $ */ /* $Id: server.c,v 1.601 2011/02/03 05:41:52 marka Exp $ */
/*! \file */ /*! \file */
...@@ -1615,6 +1615,7 @@ configure_view(dns_view_t *view, cfg_parser_t* parser, ...@@ -1615,6 +1615,7 @@ configure_view(dns_view_t *view, cfg_parser_t* parser,
cfg_parser_t *newzones_parser = NULL; cfg_parser_t *newzones_parser = NULL;
cfg_obj_t *nzfconf = NULL; cfg_obj_t *nzfconf = NULL;
dns_acl_t *clients = NULL, *mapped = NULL, *excluded = NULL; dns_acl_t *clients = NULL, *mapped = NULL, *excluded = NULL;
unsigned int query_timeout;
REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(DNS_VIEW_VALID(view));
...@@ -2205,6 +2206,15 @@ configure_view(dns_view_t *view, cfg_parser_t* parser, ...@@ -2205,6 +2206,15 @@ configure_view(dns_view_t *view, cfg_parser_t* parser,
if (lame_ttl > 1800) if (lame_ttl > 1800)
lame_ttl = 1800; lame_ttl = 1800;
dns_resolver_setlamettl(view->resolver, lame_ttl); 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 */ /* Specify whether to use 0-TTL for negative response for SOA query */
dns_resolver_setzeronosoattl(view->resolver, zero_no_soattl); dns_resolver_setzeronosoattl(view->resolver, zero_no_soattl);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.144 2011/01/11 23:47:12 tbox Exp $ # $Id: Makefile.in,v 1.145 2011/02/03 05:41:53 marka Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
...@@ -41,7 +41,8 @@ LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@ ...@@ -41,7 +41,8 @@ LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@
LIBS = @LIBS@ 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: # Test programs that are built by default:
# cfg_test is needed for regenerating doc/misc/options # cfg_test is needed for regenerating doc/misc/options
......
Makefile
.libs
*.la
*.lo
t_resolver
# 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 2011/02/03 05:41:53 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}
/*
* 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 2011/02/03 05:41:53 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 }
};
...@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl ...@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.512 $) AC_REVISION($Revision: 1.513 $)
AC_INIT(lib/dns/name.c) AC_INIT(lib/dns/name.c)
AC_PREREQ(2.59) AC_PREREQ(2.59)
...@@ -3299,6 +3299,7 @@ AC_CONFIG_FILES([ ...@@ -3299,6 +3299,7 @@ AC_CONFIG_FILES([
bin/tests/names/Makefile bin/tests/names/Makefile
bin/tests/net/Makefile bin/tests/net/Makefile
bin/tests/rbt/Makefile bin/tests/rbt/Makefile
bin/tests/resolver/Makefile
bin/tests/sockaddr/Makefile bin/tests/sockaddr/Makefile
bin/tests/system/Makefile bin/tests/system/Makefile
bin/tests/system/conf.sh bin/tests/system/conf.sh
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
- PERFORMANCE OF THIS SOFTWARE. - 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.479 2011/02/03 05:41:53 marka Exp $ -->
<book xmlns:xi="http://www.w3.org/2001/XInclude"> <book xmlns:xi="http://www.w3.org/2001/XInclude">
<title>BIND 9 Administrator Reference Manual</title> <title>BIND 9 Administrator Reference Manual</title>
...@@ -5163,6 +5163,7 @@ badresp:1,adberr:0,findfail:0,valfail:0] ...@@ -5163,6 +5163,7 @@ badresp:1,adberr:0,findfail:0,valfail:0]
<optional> disable-empty-zone <replaceable>zone_name</replaceable> ; </optional> <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 <replaceable>yes_or_no</replaceable> ; </optional>
<optional> zero-no-soa-ttl-cache <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-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> 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> <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 { ...@@ -7217,6 +7218,18 @@ options {
</listitem> </listitem>
</varlistentry> </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> </variablelist>
</sect3> </sect3>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dispatch.c,v 1.168 2009/12/02 23:15:14 marka Exp $ */ /* $Id: dispatch.c,v 1.169 2011/02/03 05:41:54 marka Exp $ */
/*! \file */ /*! \file */
...@@ -1747,8 +1747,10 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) { ...@@ -1747,8 +1747,10 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) {
isc_mempool_destroy(&mgr->epool); isc_mempool_destroy(&mgr->epool);
isc_mempool_destroy(&mgr->rpool); isc_mempool_destroy(&mgr->rpool);
isc_mempool_destroy(&mgr->dpool); isc_mempool_destroy(&mgr->dpool);
isc_mempool_destroy(&mgr->bpool); if (mgr->bpool != NULL)
isc_mempool_destroy(&mgr->spool); isc_mempool_destroy(&mgr->bpool);
if (mgr->spool != NULL)
isc_mempool_destroy(&mgr->spool);
DESTROYLOCK(&mgr->pool_lock); DESTROYLOCK(&mgr->pool_lock);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: resolver.h,v 1.67 2010/07/11 00:12:57 each Exp $ */ /* $Id: resolver.h,v 1.68 2011/02/03 05:41:54 marka Exp $ */
#ifndef DNS_RESOLVER_H #ifndef DNS_RESOLVER_H
#define DNS_RESOLVER_H 1 #define DNS_RESOLVER_H 1
...@@ -492,6 +492,27 @@ dns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name, ...@@ -492,6 +492,27 @@ dns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name,
isc_boolean_t isc_boolean_t
dns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name); 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 void
dns_resolver_setclientsperquery(dns_resolver_t *resolver, dns_resolver_setclientsperquery(dns_resolver_t *resolver,
isc_uint32_t min, isc_uint32_t max); isc_uint32_t min, isc_uint32_t max);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: resolver.c,v 1.428 2011/01/27 23:47:21 tbox Exp $ */ /* $Id: resolver.c,v 1.429 2011/02/03 05:41:54 marka Exp $ */
/*! \file */ /*! \file */
...@@ -105,6 +105,14 @@ ...@@ -105,6 +105,14 @@
#define QTRACE(m) #define QTRACE(m)
#endif #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. * Maximum EDNS0 input packet size.
*/ */
...@@ -386,6 +394,7 @@ struct dns_resolver { ...@@ -386,6 +394,7 @@ struct dns_resolver {
unsigned int spillatmin; unsigned int spillatmin;
isc_timer_t * spillattimer; isc_timer_t * spillattimer;
isc_boolean_t zero_no_soa_ttl; isc_boolean_t zero_no_soa_ttl;
unsigned int query_timeout;
/* Locked by lock. */ /* Locked by lock. */
unsigned int references; unsigned int references;
...@@ -3658,7 +3667,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, ...@@ -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. * Compute an expiration time for the entire fetch.
*/ */
isc_interval_set(&interval, 30, 0); /* XXXRTH constant */