diff --git a/bin/tests/named.conf b/bin/tests/named.conf index 68a23d99fc..b65d6057de 100644 --- a/bin/tests/named.conf +++ b/bin/tests/named.conf @@ -26,18 +26,16 @@ options { statistics-file "named.stats"; // _PATH_STATS memstatistics-file "named.memstats"; // _PATH_MEMSTATS + additional-data minimal; + max-cache-ttl 999; auth-nxdomain yes; // always set AA on NXDOMAIN. // don't set this to 'no' unless // you know what you're doing -- older // servers won't like it. # Obsolete - deallocate-on-exit no; // Painstakingly deallocate all - // objects when exiting instead of - // letting the OS clean up for us. - // Useful a memory leak is suspected. - // Final statistics are written to the - // memstatistics-file. + deallocate-on-exit no; + dialup yes; # Obsolete @@ -229,6 +227,7 @@ view "test-view" in { fetch-glue true; notify false; rfc2308-type1 false; + additional-data internal; transfer-source 10.0.0.55; transfer-source-v6 4:3:8:1:5:6:7:8; query-source port * address 10.0.0.54 ; @@ -239,6 +238,7 @@ view "test-view" in { min-roots 3; lame-ttl 477; max-ncache-ttl 333; + max-cache-ttl 777; transfer-format many-answers; zone "view-zone.com" { @@ -291,9 +291,16 @@ acl can_query { !1.2.3/24; any; }; // network 1.2.3.0 mask 255.255.255.0 acl can_axfr { 1.2.3.4; can_query; }; // host 1.2.3.4 and any host allowed // by can_query are OK +zone "disabled-zone.com" { + type master; + file "bar"; + + # Will make zone configurer skip this one. + enable-zone false; +}; + zone "non-default-acl.demo.zone" { type master; - disabled; file "foo"; allow-query { can_query; }; allow-transfer { can_axfr; }; diff --git a/lib/dns/config/confcommon.c b/lib/dns/config/confcommon.c index cfa7d84c31..2d92de703c 100644 --- a/lib/dns/config/confcommon.c +++ b/lib/dns/config/confcommon.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confcommon.c,v 1.27 2000/05/08 19:23:25 tale Exp $ */ +/* $Id: confcommon.c,v 1.28 2000/05/15 12:36:19 brister Exp $ */ #include @@ -467,6 +467,31 @@ dns_c_forward2string(dns_c_forw_t forw, +const char * +dns_c_addata2string(dns_c_addata_t addata, + isc_boolean_t printable) +{ + const char *rval = NULL; + + switch (addata) { + case dns_c_ad_internal: + rval = "internal"; + break; + + case dns_c_ad_minimal: + rval = "minimal"; + break; + + case dns_c_ad_maximal: + rval = "maximal"; + break; + } + + return (rval == NULL && printable ? "UNKNOWN_ADDITIONAL_DATA" : rval); +} + + + int dns_c_isanyaddr(isc_sockaddr_t *inaddr) { int result = 0; diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c index 2024840329..13618dc740 100644 --- a/lib/dns/config/confctx.c +++ b/lib/dns/config/confctx.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confctx.c,v 1.56 2000/05/08 19:23:27 tale Exp $ */ +/* $Id: confctx.c,v 1.57 2000/05/15 12:36:20 brister Exp $ */ #include @@ -368,6 +368,14 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } + if (dns_c_ctx_getmaxcachettl(cfg, &uintval) != ISC_R_NOTFOUND) { + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "option 'max-cache-ttl' is not yet " + "implemented."); + } + + if (dns_c_ctx_getminroots(cfg, &intval) != ISC_R_NOTFOUND) { isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -472,8 +480,12 @@ dns_c_checkconfig(dns_c_ctx_t *cfg) } - if (cfg->zlist != NULL) - result = dns_c_zonelist_checkzones(cfg->zlist); + if (cfg->zlist != NULL) { + tmpres = dns_c_zonelist_checkzones(cfg->zlist); + if (tmpres != ISC_R_SUCCESS) { + result = tmpres; + } + } if (cfg->views != NULL) { tmpres = dns_c_viewtable_checkviews(cfg->views); @@ -927,6 +939,7 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options) PRINT_AS_SIZE_CLAUSE(files, "files"); PRINT_INTEGER(max_ncache_ttl, "max-ncache-ttl"); + PRINT_INTEGER(max_cache_ttl, "max-cache-ttl"); PRINT_AS_BOOLEAN(expert_mode, "expert-mode"); PRINT_AS_BOOLEAN(fake_iquery, "fake-iquery"); @@ -954,13 +967,19 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options) ISC_TRUE)); } - PRINT_IP(transfer_source, "transfer-source"); PRINT_IP(transfer_source_v6, "transfer-source-v6"); PRINT_IPANDPORT(query_source, "query-source"); PRINT_IPANDPORT(query_source_v6, "query-source-v6"); + if (options->additional_data != NULL) { + dns_c_printtabs(fp, indent + 1); + fprintf(fp, "additional_data %s;\n", + dns_c_addata2string(*options->additional_data, + ISC_TRUE)); + } + PRINT_CHECKNAME(dns_trans_primary); PRINT_CHECKNAME(dns_trans_secondary); PRINT_CHECKNAME(dns_trans_response); @@ -1397,6 +1416,7 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options) opts->core_size = NULL; opts->files = NULL; opts->max_ncache_ttl = NULL; + opts->max_cache_ttl = NULL; opts->expert_mode = NULL; opts->fake_iquery = NULL; @@ -1421,7 +1441,8 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options) opts->transfer_source_v6 = NULL; opts->query_source = NULL; opts->query_source_v6 = NULL; - + + opts->additional_data = NULL; opts->forward = NULL; opts->tkeydhkeycp = NULL; @@ -1543,12 +1564,14 @@ dns_c_ctx_optionsdelete(dns_c_options_t **opts) FREEFIELD(core_size); FREEFIELD(files); FREEFIELD(max_ncache_ttl); + FREEFIELD(max_cache_ttl); FREEFIELD(transfer_source); FREEFIELD(transfer_source_v6); FREEFIELD(query_source); FREEFIELD(query_source_v6); + FREEFIELD(additional_data); FREEFIELD(forward); FREESTRING(tkeydomain); @@ -1714,6 +1737,10 @@ GETUINT32(maxncachettl, max_ncache_ttl) SETUINT32(maxncachettl, max_ncache_ttl) UNSETUINT32(maxncachettl, max_ncache_ttl) +GETUINT32(maxcachettl, max_cache_ttl) +SETUINT32(maxcachettl, max_cache_ttl) +UNSETUINT32(maxcachettl, max_cache_ttl) + GETINT32(transfersin, transfers_in) SETINT32(transfersin, transfers_in) UNSETINT32(transfersin, transfers_in) @@ -1822,6 +1849,10 @@ GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) UNSETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) +GETBYTYPE(dns_c_addata_t, additionaldata, additional_data) +SETBYTYPE(dns_c_addata_t, additionaldata, additional_data) +UNSETBYTYPE(dns_c_addata_t, additionaldata, additional_data) + diff --git a/lib/dns/config/confparser.y b/lib/dns/config/confparser.y index 8d35247f92..0673e9a8cb 100644 --- a/lib/dns/config/confparser.y +++ b/lib/dns/config/confparser.y @@ -16,7 +16,7 @@ * SOFTWARE. */ -/* $Id: confparser.y,v 1.80 2000/05/11 02:18:16 gson Exp $ */ +/* $Id: confparser.y,v 1.81 2000/05/15 12:36:23 brister Exp $ */ #include @@ -114,7 +114,6 @@ static isc_lexspecials_t specials; static isc_result_t tmpres; -static isc_boolean_t disabled; /* if "disabled" keyword was in zone */ static int debug_lexer; int yyparse(void); @@ -200,6 +199,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); struct confssu_s ssu; struct confrdtype_s rdatatypelist; dns_rdatatype_t rdatatype; + dns_c_addata_t addata; isc_boolean_t boolean; dns_rdataclass_t rrclass; @@ -227,6 +227,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_IP6ADDR %token L_ACL +%token L_ADDITIONAL_DATA %token L_ADDRESS %token L_ALGID %token L_ALLOW @@ -255,9 +256,9 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_DENY %token L_DIALUP %token L_DIRECTORY -%token L_DISABLED %token L_DUMP_FILE %token L_DYNAMIC +%token L_ENABLE_ZONE %token L_END_INCLUDE %token L_EOS %token L_EXPERT_MODE @@ -283,6 +284,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_INCLUDE %token L_INET %token L_INTERFACE_INTERVAL +%token L_INTERNAL %token L_IXFR_TMP %token L_KEYS %token L_LAME_TTL @@ -295,13 +297,16 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_MASTERS %token L_MATCH_CLIENTS %token L_MAX_LOG_SIZE_IXFR +%token L_MAX_CACHE_TTL %token L_MAX_NCACHE_TTL %token L_MAX_TRANSFER_IDLE_IN %token L_MAX_TRANSFER_IDLE_OUT %token L_MAX_TRANSFER_TIME_IN %token L_MAX_TRANSFER_TIME_OUT +%token L_MAXIMAL %token L_MEMSTATS_FILE %token L_MIN_ROOTS +%token L_MINIMAL %token L_MULTIPLE_CNAMES %token L_NAME %token L_NAMED_XFER @@ -376,6 +381,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_ZONE +%type additional_data %type grantp %type yea_or_nay %type forward_opt @@ -472,6 +478,13 @@ options_stmt: L_OPTIONS { dns_c_options_t *options; + if (currcfg->zlist != NULL || currcfg->views != NULL) { + parser_error(ISC_FALSE, + "options must come before all " + "zones and views"); + YYABORT; + } + tmpres = dns_c_ctx_getoptions(currcfg, &options); if (tmpres == ISC_R_SUCCESS) { parser_error(ISC_FALSE, "cannot redefine options"); @@ -1240,6 +1253,19 @@ option: /* Empty */ YYABORT; } } + | L_MAX_CACHE_TTL L_INTEGER + { + tmpres = dns_c_ctx_setmaxcachettl(currcfg, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine max-cache-ttl."); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set max-cache-ttl."); + YYABORT; + } + } | L_HEARTBEAT L_INTEGER { if ( int_too_big($2, 60) ) { @@ -1312,6 +1338,19 @@ option: /* Empty */ YYABORT; } } + | L_ADDITIONAL_DATA additional_data + { + tmpres = dns_c_ctx_setadditionaldata(currcfg, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine additional-data."); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set additional-data."); + YYABORT; + } + } ; @@ -1688,6 +1727,19 @@ maybe_zero_port : /* nothing */ } ; +additional_data: L_INTERNAL + { + $$ = dns_c_ad_internal; + } + | L_MINIMAL + { + $$ = dns_c_ad_minimal; + } + | L_MAXIMAL + { + $$ = dns_c_ad_maximal; + }; + yea_or_nay: L_YES { $$ = isc_boolean_true; @@ -3563,6 +3615,40 @@ view_option: L_FORWARD zone_forward_opt YYABORT; } } + | L_MAX_CACHE_TTL L_INTEGER + { + dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); + + INSIST(view != NULL); + + tmpres = dns_c_view_setmaxcachettl(view, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine view max-cache-ttl."); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set view max-cache-ttl."); + YYABORT; + } + } + | L_ADDITIONAL_DATA additional_data + { + dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); + + INSIST(view != NULL); + + tmpres = dns_c_view_setadditionaldata(view, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine view additional-data."); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set view additional-data."); + YYABORT; + } + } | L_TRANSFER_FORMAT transfer_format { dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); @@ -3837,8 +3923,6 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS { dns_c_zone_t *zone; - disabled = ISC_FALSE; - if (currcfg->zlist == NULL) { tmpres = dns_c_zonelist_new(currcfg->mem, &currcfg->zlist); @@ -3887,19 +3971,10 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS zone = dns_c_ctx_getcurrzone(currcfg); view = dns_c_ctx_getcurrview(currcfg); - if (disabled) { - isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, - DNS_LOGMODULE_CONFIG, - ISC_LOG_WARNING, "zone '%s' is disabled", - zone->name); - dns_c_zonelist_rmzone(currcfg->zlist, zone); - zone = NULL; - } else { - zone->view = view; + zone->view = view; - if (view != NULL) { - dns_c_view_addzone(view, zone); - } + if (view != NULL) { + dns_c_view_addzone(view, zone); } dns_c_ctx_setcurrzone(currcfg, NULL); @@ -4031,7 +4106,7 @@ zone_non_type_keywords: L_FILE | L_FILE_IXFR | L_IXFR_TMP | L_MASTERS | 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 | - L_DISABLED | L_DATABASE + L_ENABLE_ZONE | L_DATABASE ; @@ -4491,9 +4566,22 @@ zone_option: L_FILE L_QSTRING YYABORT; } } - | L_DISABLED + | L_ENABLE_ZONE yea_or_nay { - disabled = ISC_TRUE; + dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg); + + INSIST(zone != NULL); + + tmpres = dns_c_zone_setenabled(zone, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine enable-zone."); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set enable-zone."); + YYABORT; + } } | L_DATABASE L_QSTRING { @@ -4738,6 +4826,7 @@ static struct token keyword_tokens [] = { { "!", L_BANG }, { "acl", L_ACL }, + { "additional-data", L_ADDITIONAL_DATA }, { "address", L_ADDRESS }, { "algorithm", L_ALGID }, { "allow", L_ALLOW }, @@ -4764,9 +4853,9 @@ static struct token keyword_tokens [] = { { "default", L_DEFAULT }, { "dialup", L_DIALUP }, { "directory", L_DIRECTORY }, - { "disabled", L_DISABLED }, { "dump-file", L_DUMP_FILE }, { "dynamic", L_DYNAMIC }, + { "enable-zone", L_ENABLE_ZONE }, { "expert-mode", L_EXPERT_MODE }, { "fail", L_FAIL }, { "fake-iquery", L_FAKE_IQUERY }, @@ -4793,6 +4882,7 @@ static struct token keyword_tokens [] = { { "include", L_INCLUDE }, { "inet", L_INET }, { "interface-interval", L_INTERFACE_INTERVAL }, + { "internal", L_INTERNAL }, { "ixfr-base", L_FILE_IXFR }, { "ixfr-tmp-file", L_IXFR_TMP }, { "key", L_SEC_KEY }, @@ -4806,14 +4896,17 @@ static struct token keyword_tokens [] = { { "masters", L_MASTERS }, { "match-clients", L_MATCH_CLIENTS }, { "max-ixfr-log-size", L_MAX_LOG_SIZE_IXFR }, + { "max-cache-ttl", L_MAX_CACHE_TTL }, { "max-ncache-ttl", L_MAX_NCACHE_TTL }, { "max-transfer-time-in", L_MAX_TRANSFER_TIME_IN }, { "max-transfer-time-out", L_MAX_TRANSFER_TIME_OUT }, { "max-transfer-idle-in", L_MAX_TRANSFER_IDLE_IN }, { "max-transfer-idle-out", L_MAX_TRANSFER_IDLE_OUT }, + { "maximal", L_MAXIMAL }, { "memstatistics-file", L_MEMSTATS_FILE }, { "multiple-cnames", L_MULTIPLE_CNAMES }, { "min-roots", L_MIN_ROOTS }, + { "minimal", L_MINIMAL }, { "name", L_NAME }, { "named-xfer", L_NAMED_XFER }, { "no", L_NO }, diff --git a/lib/dns/config/confview.c b/lib/dns/config/confview.c index 69232e98ee..bd2993a401 100644 --- a/lib/dns/config/confview.c +++ b/lib/dns/config/confview.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confview.c,v 1.27 2000/05/08 19:23:29 tale Exp $ */ +/* $Id: confview.c,v 1.28 2000/05/15 12:36:26 brister Exp $ */ #include @@ -376,6 +376,12 @@ dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable) { "view 'max-ncache-ttl' is not yet " "implemented."); + if (dns_c_view_getmaxcachettl(elem, &bival) != ISC_R_NOTFOUND) + isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, + "view 'max-cache-ttl' is not yet " + "implemented."); + if (dns_c_view_getlamettl(elem, &bival) != ISC_R_NOTFOUND) isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING, @@ -474,7 +480,9 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass, view->min_roots = NULL; view->lamettl = NULL; view->max_ncache_ttl = NULL; + view->max_cache_ttl = NULL; + view->additional_data = NULL; view->transfer_format = NULL; view->keydefs = NULL; view->peerlist = NULL; @@ -636,7 +644,14 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) { PRINT_INT32(min_roots, "min-roots"); PRINT_INT32(lamettl, "lame-ttl"); PRINT_INT32(max_ncache_ttl, "max-ncache-ttl"); + PRINT_INT32(max_cache_ttl, "max-cache-ttl"); + if (view->additional_data != NULL) { + dns_c_printtabs(fp, indent + 1); + fprintf(fp, "additional-data %s;\n", + dns_c_addata2string(*view->additional_data, ISC_TRUE)); + } + if (view->transfer_format != NULL) { dns_c_printtabs(fp, indent + 1); fprintf(fp, "transfer-format %s;\n", @@ -750,7 +765,9 @@ dns_c_view_delete(dns_c_view_t **viewptr) { FREEFIELD(min_roots); FREEFIELD(lamettl); FREEFIELD(max_ncache_ttl); + FREEFIELD(max_cache_ttl); + FREEFIELD(additional_data); FREEFIELD(transfer_format); dns_c_view_unsetkeydefs(view); @@ -1308,6 +1325,14 @@ SETINT32(maxncachettl, max_ncache_ttl) GETINT32(maxncachettl, max_ncache_ttl) UNSETINT32(maxncachettl, max_ncache_ttl) +SETINT32(maxcachettl, max_cache_ttl) +GETINT32(maxcachettl, max_cache_ttl) +UNSETINT32(maxcachettl, max_cache_ttl) + + +GETBYTYPE(dns_c_addata_t, additionaldata, additional_data) +SETBYTYPE(dns_c_addata_t, additionaldata, additional_data) +UNSETBYTYPE(dns_c_addata_t, additionaldata, additional_data) GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format) diff --git a/lib/dns/config/confzone.c b/lib/dns/config/confzone.c index 6759b42f23..df64c804fa 100644 --- a/lib/dns/config/confzone.c +++ b/lib/dns/config/confzone.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confzone.c,v 1.41 2000/05/13 19:46:26 tale Exp $ */ +/* $Id: confzone.c,v 1.42 2000/05/15 12:36:28 brister Exp $ */ #include @@ -195,11 +195,16 @@ dns_c_zonelist_delete(dns_c_zonelist_t **zlist) { isc_result_t dns_c_zonelist_checkzones(dns_c_zonelist_t *list) { dns_c_zone_t *zone; - dns_c_ipmatchlist_t *ipmlist = NULL; + dns_c_ipmatchlist_t *ipmlist; + dns_c_iplist_t *iplist; dns_ssutable_t *ssutable = NULL; - isc_result_t result; - const char *autherr = "zone `%s': allow-update is ignored when " - "update-policy is also used."; + isc_result_t tmpres; + isc_result_t result = ISC_R_SUCCESS; + const char *autherr = "zone '%s': allow-update is ignored when " + "update-policy is also used"; + const char *nomasterserr = "zone '%s': missing 'masters' entry"; + const char *emptymasterserr = "zone '%s': 'masters' value is empty"; + REQUIRE(DNS_C_ZONELIST_VALID(list)); @@ -214,11 +219,12 @@ dns_c_zonelist_checkzones(dns_c_zonelist_t *list) { * Check for allow-update and update-policty together */ if (zone->ztype == dns_c_zone_master) { - result = dns_c_zone_getallowupd(zone, &ipmlist); - if (result == ISC_R_SUCCESS) { - result = dns_c_zone_getssuauth(zone, + ipmlist = NULL; + tmpres = dns_c_zone_getallowupd(zone, &ipmlist); + if (tmpres == ISC_R_SUCCESS) { + tmpres = dns_c_zone_getssuauth(zone, &ssutable); - if (result == ISC_R_SUCCESS) { + if (tmpres == ISC_R_SUCCESS) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, DNS_LOGMODULE_CONFIG, @@ -228,11 +234,28 @@ dns_c_zonelist_checkzones(dns_c_zonelist_t *list) { } dns_c_ipmatchlist_detach(&ipmlist); } + } else if (zone->ztype == dns_c_zone_slave) { + iplist = NULL; + tmpres = dns_c_zone_getmasterips(zone, &iplist); + if (tmpres != ISC_R_SUCCESS) { + isc_log_write(dns_lctx, + DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, + ISC_LOG_WARNING, nomasterserr, + zone->name); + result = ISC_R_FAILURE; + } else if (iplist->nextidx == 0) { + isc_log_write(dns_lctx, + DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, + ISC_LOG_WARNING, emptymasterserr, + zone->name); + result = ISC_R_FAILURE; + } } - } - return (ISC_R_SUCCESS); + return (result); } isc_result_t @@ -464,6 +487,7 @@ dns_c_zone_new(isc_mem_t *mem, newzone->ztype = ztype; newzone->zclass = zclass; newzone->view = NULL; + newzone->enabled = NULL; newzone->afteropts = ISC_FALSE; newzone->name = isc_mem_strdup(mem, name); newzone->internalname = (internalname == NULL ? @@ -576,10 +600,15 @@ dns_c_zone_print(FILE *fp, int indent, dns_c_zone_t *zone) { } if (zone->database != NULL) { - fprintf(fp, "\n"); dns_c_printtabs(fp, indent + 1); fprintf(fp, "database \"%s\";\n", zone->database); } + + if (zone->enabled != NULL) { + dns_c_printtabs(fp, indent + 1); + fprintf(fp, "enable-zone %s;\n", + (*zone->enabled ? "true" : "false")); + } dns_c_printtabs(fp, indent); fprintf(fp, "};\n"); @@ -3673,6 +3702,11 @@ zone_delete(dns_c_zone_t **zone) { isc_mem_free(z->mem, z->database); z->database = NULL; } + + if (z->enabled != NULL) { + isc_mem_put(z->mem, z->enabled, sizeof (z->enabled)); + z->enabled = NULL; + } switch(z->ztype) { case dns_c_zone_master: @@ -3976,3 +4010,63 @@ dns_c_zone_unsetdatabase(dns_c_zone_t *zone) } } + + + + +isc_result_t +dns_c_zone_setenabled(dns_c_zone_t *zone, isc_boolean_t enabled) +{ + isc_boolean_t existed = ISC_FALSE; + + REQUIRE(DNS_C_ZONE_VALID(zone)); + + if (zone->enabled != NULL) { + existed = ISC_TRUE; + } else { + zone->enabled = isc_mem_get(zone->mem, sizeof (zone->enabled)); + } + + *zone->enabled = enabled; + + if (existed) { + return (ISC_R_EXISTS); + } else { + return (ISC_R_SUCCESS); + } +} + + +isc_result_t +dns_c_zone_getenabled(dns_c_zone_t *zone, isc_boolean_t *retval) +{ + REQUIRE(DNS_C_ZONE_VALID(zone)); + REQUIRE(retval != NULL); + + if (zone->enabled == NULL) { + return (ISC_R_NOTFOUND); + } else { + *retval = *zone->enabled; + return (ISC_R_SUCCESS); + } +} + + + +isc_result_t +dns_c_zone_unsetenabled(dns_c_zone_t *zone) +{ + REQUIRE(DNS_C_ZONE_VALID(zone)); + + if (zone->enabled == NULL) { + return (ISC_R_NOTFOUND); + } else { + isc_mem_put(zone->mem, zone->enabled, sizeof (zone->enabled)); + zone->enabled = NULL; + return (ISC_R_SUCCESS); + } +} + + + + diff --git a/lib/dns/include/dns/confcommon.h b/lib/dns/include/dns/confcommon.h index 766fb4576d..092a4a4ac2 100644 --- a/lib/dns/include/dns/confcommon.h +++ b/lib/dns/include/dns/confcommon.h @@ -109,15 +109,6 @@ typedef enum { dns_c_forw_nodomain } dns_c_forw_t; -/* value of a 'check-names' method */ -#if 0 -typedef enum { - dns_c_severity_ignore, - dns_c_severity_warn, - dns_c_severity_fail -} dns_c_severity_t; -#endif - /* Value of a 'check-names' type. */ typedef enum { dns_trans_primary, @@ -142,13 +133,6 @@ typedef enum { } dns_c_ordering_t; - -#if 0 -typedef enum { - dns_one_answer, dns_many_answers -} dns_c_transferformat_t; -#endif - /* Possible zone types */ typedef enum { dns_c_zone_master, @@ -193,35 +177,13 @@ typedef enum { } dns_c_logseverity_t; -#if 0 /* XXXJAB remove this */ -/* Possible logging categories. */ +/* Type of additional-data field */ typedef enum { - dns_c_cat_default, - dns_c_cat_config, - dns_c_cat_parser, - dns_c_cat_queries, - dns_c_cat_lameservers, - dns_c_cat_statistics, - dns_c_cat_panic, - dns_c_cat_update, - dns_c_cat_ncache, - dns_c_cat_xferin, - dns_c_cat_xferout, - dns_c_cat_db, - dns_c_cat_eventlib, - dns_c_cat_packet, - dns_c_cat_notify, - dns_c_cat_cname, - dns_c_cat_security, - dns_c_cat_os, - dns_c_cat_insist, - dns_c_cat_maint, - dns_c_cat_load, - dns_c_cat_respchecks, - dns_c_cat_control, - dns_c_cat_none -} dns_c_category_t; -#endif + dns_c_ad_minimal, + dns_c_ad_maximal, + dns_c_ad_internal +} dns_c_addata_t; + /* Type of the bit sets used in various structures. Macros in confpvt.h * depending on this being an integer type, and some structures need more @@ -282,6 +244,9 @@ dns_c_nameseverity2string(dns_severity_t severity, isc_boolean_t printable); const char * dns_c_forward2string(dns_c_forw_t forw, isc_boolean_t printable); +const char * +dns_c_addata2string(dns_c_addata_t addata, isc_boolean_t printable); + /* * The following dns_c_string2xxx() functions will look up the string * argument in a table of values and will return the appropriate enum/integer diff --git a/lib/dns/include/dns/confctx.h b/lib/dns/include/dns/confctx.h index eafc086686..18341f3554 100644 --- a/lib/dns/include/dns/confctx.h +++ b/lib/dns/include/dns/confctx.h @@ -140,6 +140,7 @@ struct dns_c_options { isc_uint32_t *core_size; isc_uint32_t *files; isc_uint32_t *max_ncache_ttl; + isc_uint32_t *max_cache_ttl; isc_boolean_t *expert_mode; isc_boolean_t *fake_iquery; @@ -165,6 +166,8 @@ struct dns_c_options { isc_sockaddr_t *query_source; isc_sockaddr_t *query_source_v6; + dns_c_addata_t *additional_data; + dns_c_forw_t *forward; char *tkeydhkeycp; @@ -544,6 +547,7 @@ dns_c_ctx_getstacksize(dns_c_ctx_t *cfg, isc_result_t dns_c_ctx_unsetstacksize(dns_c_ctx_t *cfg); + isc_result_t dns_c_ctx_setcoresize(dns_c_ctx_t *cfg, isc_uint32_t newval); @@ -553,6 +557,7 @@ dns_c_ctx_getcoresize(dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_unsetcoresize(dns_c_ctx_t *cfg); + isc_result_t dns_c_ctx_setfiles(dns_c_ctx_t *cfg, isc_uint32_t newval); @@ -562,6 +567,7 @@ dns_c_ctx_getfiles(dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_unsetfiles(dns_c_ctx_t *cfg); + isc_result_t dns_c_ctx_setmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t newval); @@ -571,6 +577,17 @@ dns_c_ctx_getmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_unsetmaxncachettl(dns_c_ctx_t *cfg); + +isc_result_t +dns_c_ctx_setmaxcachettl(dns_c_ctx_t *cfg, isc_uint32_t newval); + +isc_result_t +dns_c_ctx_getmaxcachettl(dns_c_ctx_t *cfg, isc_uint32_t *retval); + +isc_result_t +dns_c_ctx_unsetmaxcachettl(dns_c_ctx_t *cfg); + + isc_result_t dns_c_ctx_setexpertmode(dns_c_ctx_t *cfg, isc_boolean_t newval); @@ -762,6 +779,7 @@ dns_c_ctx_getquerysource(dns_c_ctx_t *ctx, isc_sockaddr_t *query_source); isc_result_t dns_c_ctx_unsetquerysource(dns_c_ctx_t *ctx); + isc_result_t dns_c_ctx_setquerysourcev6(dns_c_ctx_t *ctx, isc_sockaddr_t query_source_v6); @@ -771,6 +789,18 @@ dns_c_ctx_getquerysourcev6(dns_c_ctx_t *ctx, isc_sockaddr_t *query_source_v6); isc_result_t dns_c_ctx_unsetquerysourcev6(dns_c_ctx_t *ctx); + +isc_result_t +dns_c_ctx_setadditionaldata(dns_c_ctx_t *ctx, dns_c_addata_t addata); + +isc_result_t +dns_c_ctx_getadditionaldata(dns_c_ctx_t *ctx, dns_c_addata_t *addata); + +isc_result_t +dns_c_ctx_unsetadditionaldata(dns_c_ctx_t *ctx); + + + isc_result_t dns_c_ctx_setforward(dns_c_ctx_t *cfg, dns_c_forw_t forward); diff --git a/lib/dns/include/dns/confview.h b/lib/dns/include/dns/confview.h index 16eec07dd8..ac38319d40 100644 --- a/lib/dns/include/dns/confview.h +++ b/lib/dns/include/dns/confview.h @@ -132,7 +132,9 @@ struct dns_c_view { isc_int32_t *min_roots; isc_int32_t *lamettl; isc_int32_t *max_ncache_ttl; + isc_int32_t *max_cache_ttl; + dns_c_addata_t *additional_data; dns_transfer_format_t *transfer_format; dns_c_kdeflist_t *keydefs; @@ -478,6 +480,7 @@ dns_c_view_setlamettl(dns_c_view_t *view, isc_int32_t newval); isc_result_t dns_c_view_unsetlamettl(dns_c_view_t *view); + isc_result_t dns_c_view_getmaxncachettl(dns_c_view_t *view, isc_int32_t *retval); @@ -487,6 +490,29 @@ dns_c_view_setmaxncachettl(dns_c_view_t *view, isc_int32_t newval); isc_result_t dns_c_view_unsetmaxncachettl(dns_c_view_t *view); + +isc_result_t +dns_c_view_getmaxcachettl(dns_c_view_t *view, isc_int32_t *retval); + +isc_result_t +dns_c_view_setmaxcachettl(dns_c_view_t *view, isc_int32_t newval); + +isc_result_t +dns_c_view_unsetmaxcachettl(dns_c_view_t *view); + + + +isc_result_t +dns_c_view_setadditionaldata(dns_c_view_t *view, dns_c_addata_t newval); + +isc_result_t +dns_c_view_getadditionaldata(dns_c_view_t *view, dns_c_addata_t *retval); + +isc_result_t +dns_c_view_unsetadditionaldata(dns_c_view_t *cfg); + + + isc_result_t dns_c_view_settransferformat(dns_c_view_t *view, dns_transfer_format_t tformat); diff --git a/lib/dns/include/dns/confzone.h b/lib/dns/include/dns/confzone.h index 41ed377fb4..ce1f9b3ab5 100644 --- a/lib/dns/include/dns/confzone.h +++ b/lib/dns/include/dns/confzone.h @@ -200,6 +200,7 @@ struct dns_c_zone { char *database; dns_rdataclass_t zclass; dns_c_view_t *view; + isc_boolean_t *enabled; dns_c_zonetype_t ztype; union @@ -457,6 +458,18 @@ isc_result_t dns_c_zone_unsetdatabase(dns_c_zone_t *zone); +isc_result_t +dns_c_zone_setenabled(dns_c_zone_t *zone, isc_boolean_t enabled); + +isc_result_t +dns_c_zone_getenabled(dns_c_zone_t *zone, isc_boolean_t *retval); + +isc_result_t +dns_c_zone_unsetenabled(dns_c_zone_t *zone); + + + + ISC_LANG_ENDDECLS #endif /* DNS_CONFZONE_H */