From 6ca3b786b458ebe894482c014e40e86cd1eb9279 Mon Sep 17 00:00:00 2001 From: James Brister Date: Mon, 17 Jan 2000 14:41:24 +0000 Subject: [PATCH] Support new 'tcp-clients' and 'recursive-clients' statements. --- lib/dns/config/confctx.c | 87 +++++++++++++++++++++++++++++++++++ lib/dns/config/confparser.y | 33 ++++++++++++- lib/dns/include/dns/confctx.h | 12 ++++- 3 files changed, 129 insertions(+), 3 deletions(-) diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c index f9e6a53922..d49a2cf6b7 100644 --- a/lib/dns/config/confctx.c +++ b/lib/dns/config/confctx.c @@ -74,6 +74,8 @@ #define FORWARD_BIT 36 #define EXPERT_MODE_BIT 37 #define RFC2308_TYPE1_BIT 38 +#define TCP_CLIENTS_BIT 39 +#define RECURSIVE_CLIENTS_BIT 40 static isc_result_t cfg_set_iplist(dns_c_options_t *options, @@ -1225,6 +1227,45 @@ dns_c_ctx_setmaxtransferidleout(dns_c_ctx_t *cfg, isc_int32_t newval) } +isc_result_t +dns_c_ctx_settcpclients(dns_c_ctx_t *cfg, isc_int32_t newval) +{ + isc_result_t res; + + REQUIRE(DNS_C_CONFCTX_VALID(cfg)); + + res = make_options(cfg); + if (res != ISC_R_SUCCESS) { + return (res); + } + + return (cfg_set_int32(cfg->options, + &cfg->options->tcp_clients, + newval, + &cfg->options->setflags1, + TCP_CLIENTS_BIT)); +} + +isc_result_t +dns_c_ctx_setrecursiveclients(dns_c_ctx_t *cfg, isc_int32_t newval) +{ + isc_result_t res; + + REQUIRE(DNS_C_CONFCTX_VALID(cfg)); + + res = make_options(cfg); + if (res != ISC_R_SUCCESS) { + return (res); + } + + return (cfg_set_int32(cfg->options, + &cfg->options->recursive_clients, + newval, + &cfg->options->setflags1, + RECURSIVE_CLIENTS_BIT)); +} + + isc_result_t dns_c_ctx_setdatasize(dns_c_ctx_t *cfg, isc_uint32_t newval) { @@ -2466,6 +2507,44 @@ dns_c_ctx_getmaxtransferidleout(dns_c_ctx_t *cfg, isc_int32_t *retval) } +isc_result_t +dns_c_ctx_gettcpclients(dns_c_ctx_t *cfg, isc_int32_t *retval) +{ + REQUIRE(DNS_C_CONFCTX_VALID(cfg)); + REQUIRE(retval != NULL); + + if (cfg->options == NULL) { + return (ISC_R_NOTFOUND); + } + + + return (cfg_get_int32(cfg->options, + &cfg->options->tcp_clients, + retval, + &cfg->options->setflags1, + TCP_CLIENTS_BIT)); +} + + +isc_result_t +dns_c_ctx_getrecursiveclients(dns_c_ctx_t *cfg, isc_int32_t *retval) +{ + REQUIRE(DNS_C_CONFCTX_VALID(cfg)); + REQUIRE(retval != NULL); + + if (cfg->options == NULL) { + return (ISC_R_NOTFOUND); + } + + + return (cfg_get_int32(cfg->options, + &cfg->options->recursive_clients, + retval, + &cfg->options->setflags1, + RECURSIVE_CLIENTS_BIT)); +} + + isc_result_t dns_c_ctx_getdatasize(dns_c_ctx_t *cfg, isc_uint32_t *retval) { @@ -3188,6 +3267,9 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options) opts->rfc2308_type1 = ISC_FALSE; opts->dialup = ISC_FALSE; + opts->tcp_clients = 0; + opts->recursive_clients = 0; + opts->max_transfer_time_in = 0; opts->max_transfer_time_out = 0; opts->max_transfer_idle_in = 0; @@ -3419,6 +3501,11 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options) "transfers-out", setflags1); PRINT_INTEGER(max_log_size_ixfr, MAX_LOG_SIZE_IXFR_BIT, "max-ixfr-log-size", setflags1); + PRINT_INTEGER(tcp_clients, TCP_CLIENTS_BIT, + "tcp-clients", setflags1); + PRINT_INTEGER(recursive_clients, RECURSIVE_CLIENTS_BIT, + "recursive-clients", setflags1); + PRINT_INTEGER(max_ncache_ttl, MAX_NCACHE_TTL_BIT, "max-ncache-ttl", setflags1); diff --git a/lib/dns/config/confparser.y b/lib/dns/config/confparser.y index 5515ee926c..ab772801fc 100644 --- a/lib/dns/config/confparser.y +++ b/lib/dns/config/confparser.y @@ -17,7 +17,7 @@ */ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: confparser.y,v 1.32 1999/12/17 18:32:38 brister Exp $"; +static char rcsid[] = "$Id: confparser.y,v 1.33 2000/01/17 14:41:21 brister Exp $"; #endif /* not lint */ #include @@ -243,6 +243,8 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_MAX_TRANSFER_TIME_OUT %token L_MAX_TRANSFER_IDLE_IN %token L_MAX_TRANSFER_IDLE_OUT +%token L_TCP_CLIENTS +%token L_RECURSIVE_CLIENTS %token L_ONE_ANSWER %token L_MANY_ANSWERS %token L_NOTIFY @@ -847,7 +849,31 @@ option: /* Empty */ YYABORT; } } - | L_CLEAN_INTERVAL L_INTEGER + | L_TCP_CLIENTS L_INTEGER + { + tmpres = dns_c_ctx_settcpclients(currcfg, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "Redefining tcp-clients."); + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "Failed to set tcp-clients."); + YYABORT; + } + } + | L_RECURSIVE_CLIENTS L_INTEGER + { + tmpres = dns_c_ctx_setrecursiveclients(currcfg, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "Redefining recursive-clients."); + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "Failed to set recursive-clients."); + YYABORT; + } + } + | L_CLEAN_INTERVAL L_INTEGER { if ( int_too_big($2, 60) ) { parser_error(ISC_FALSE, @@ -2678,6 +2704,7 @@ zone_option_list: zone_option L_EOS zone_non_type_keywords: L_FILE | L_FILE_IXFR | L_IXFR_TMP | L_MASTERS | L_TRANSFER_SOURCE | L_CHECK_NAMES | L_ALLOW_UPDATE | L_ALLOW_QUERY | L_ALLOW_TRANSFER | L_FORWARD | L_FORWARDERS | L_MAX_TRANSFER_TIME_IN | + L_TCP_CLIENTS | L_RECURSIVE_CLIENTS | L_MAX_TRANSFER_TIME_OUT | L_MAX_TRANSFER_IDLE_IN | L_MAX_TRANSFER_IDLE_OUT | L_MAX_LOG_SIZE_IXFR | L_NOTIFY | L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP @@ -3539,6 +3566,7 @@ static struct token keyword_tokens [] = { { "rfc2308-type1", L_RFC2308_TYPE1 }, { "rrset-order", L_RRSET_ORDER }, { "recursion", L_RECURSION }, + { "recursive-clients", L_RECURSIVE_CLIENTS }, { "response", L_RESPONSE }, { "secret", L_SECRET }, { "server", L_SERVER }, @@ -3552,6 +3580,7 @@ static struct token keyword_tokens [] = { { "stub", L_STUB }, { "support-ixfr", L_SUPPORT_IXFR }, { "syslog", L_SYSLOG }, + { "tcp-clients", L_TCP_CLIENTS }, { "tkey-domain", L_TKEY_DOMAIN }, { "tkey-dhkey", L_TKEY_DHKEY }, { "topology", L_TOPOLOGY }, diff --git a/lib/dns/include/dns/confctx.h b/lib/dns/include/dns/confctx.h index 4fa159f607..e49ebc1b92 100644 --- a/lib/dns/include/dns/confctx.h +++ b/lib/dns/include/dns/confctx.h @@ -154,8 +154,9 @@ struct dns_c_options isc_int32_t max_transfer_idle_in; isc_int32_t max_transfer_idle_out; isc_int32_t lamettl; /* XXX not implemented yet */ + isc_int32_t tcp_clients; + isc_int32_t recursive_clients; - isc_uint32_t data_size; isc_uint32_t stack_size; isc_uint32_t core_size; @@ -323,6 +324,10 @@ isc_result_t dns_c_ctx_setmaxtransferidlein(dns_c_ctx_t *cfg, isc_int32_t newval); isc_result_t dns_c_ctx_setmaxtransferidleout(dns_c_ctx_t *cfg, isc_int32_t newval); +isc_result_t dns_c_ctx_settcpclients(dns_c_ctx_t *cfg, isc_int32_t newval); +isc_result_t dns_c_ctx_setrecursiveclients(dns_c_ctx_t *cfg, + isc_int32_t newval); + isc_result_t dns_c_ctx_setdatasize(dns_c_ctx_t *cfg, isc_uint32_t newval); isc_result_t dns_c_ctx_setstacksize(dns_c_ctx_t *cfg, isc_uint32_t newval); @@ -449,6 +454,11 @@ isc_result_t dns_c_ctx_getmaxtransferidlein(dns_c_ctx_t *cfg, isc_int32_t *retval); isc_result_t dns_c_ctx_getmaxtransferidleout(dns_c_ctx_t *cfg, isc_int32_t *retval); +isc_result_t dns_c_ctx_gettcpclients(dns_c_ctx_t *cfg, + isc_int32_t *retval); +isc_result_t dns_c_ctx_getrecursiveclients(dns_c_ctx_t *cfg, + isc_int32_t *retval); + isc_result_t dns_c_ctx_getdatasize(dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_getstacksize(dns_c_ctx_t *cfg,