diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index b1d2e43846..611d6493d4 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zoneconf.c,v 1.58 2000/08/14 21:47:42 gson Exp $ */ +/* $Id: zoneconf.c,v 1.59 2000/08/17 13:13:35 marka Exp $ */ #include @@ -243,6 +243,28 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, uintval = 0; dns_zone_setmaxnames(zone, uintval); } + + if (czone->ztype != dns_c_zone_stub) { + result = dns_c_zone_getnotifyany(czone, &boolean); + if (result != ISC_R_SUCCESS && cview != NULL) + result = dns_c_view_getnotifyany(cview, &boolean); + if (result != ISC_R_SUCCESS) + result = dns_c_ctx_getnotifyany(cctx, &boolean); + if (result != ISC_R_SUCCESS) + boolean = ISC_FALSE; + dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFYANY, boolean); + } + + if (czone->ztype != dns_c_zone_stub) { + result = dns_c_zone_getnotifyrelay(czone, &boolean); + if (result != ISC_R_SUCCESS && cview != NULL) + result = dns_c_view_getnotifyrelay(cview, &boolean); + if (result != ISC_R_SUCCESS) + result = dns_c_ctx_getnotifyrelay(cctx, &boolean); + if (result != ISC_R_SUCCESS) + boolean = ISC_FALSE; + dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFYRELAY, boolean); + } #endif /* NOMINUM_PUBLIC */ /* diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c index 3768db2f2b..d22f638525 100644 --- a/lib/dns/config/confctx.c +++ b/lib/dns/config/confctx.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confctx.c,v 1.81 2000/08/11 21:50:58 gson Exp $ */ +/* $Id: confctx.c,v 1.82 2000/08/17 13:13:34 marka Exp $ */ #include @@ -1102,6 +1102,10 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options) PRINT_AS_BOOLEAN(treat_cr_as_space, "treat-cr-as-space"); PRINT_AS_BOOLEAN(additional_from_auth, "additional-from-auth"); PRINT_AS_BOOLEAN(additional_from_cache, "additional-from-cache"); +#ifndef NOMINUM_PUBLIC + PRINT_AS_BOOLEAN(notify_any, "notify-any"); + PRINT_AS_BOOLEAN(notify_relay, "notify-relay"); +#endif /* NOMINUM_PUBLIC */ if (options->transfer_format != NULL) { dns_c_printtabs(fp, indent + 1); @@ -1628,6 +1632,10 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options) opts->treat_cr_as_space = NULL; opts->additional_from_auth = NULL; opts->additional_from_cache = NULL; +#ifndef NOMINUM_PUBLIC + opts->notify_any = NULL; + opts->notify_relay = NULL; +#endif /* NOMINUM_PUBLIC */ opts->transfer_source = NULL; opts->transfer_source_v6 = NULL; @@ -1774,6 +1782,8 @@ dns_c_ctx_optionsdelete(dns_c_options_t **opts) #ifndef NOMINUM_PUBLIC FREEFIELD(max_names); + FREEFIELD(notify_any); + FREEFIELD(notify_relay); #endif /* NOMINMUM_PUBLIC */ FREEFIELD(transfer_source); @@ -1898,6 +1908,11 @@ BOOL_FUNCS(fetchglue, fetch_glue) NOTIFYTYPE_FUNCS(notify, notify) +#ifndef NOMINUM_PUBLIC +BOOL_FUNCS(notifyany, notify_any) +BOOL_FUNCS(notifyrelay, notify_relay) +#endif /* NOMINMUM_PUBLIC */ + BOOL_FUNCS(hoststatistics, host_statistics) BOOL_FUNCS(dealloconexit, dealloc_on_exit) BOOL_FUNCS(useixfr, use_ixfr) diff --git a/lib/dns/config/confparser.y.dirty b/lib/dns/config/confparser.y.dirty index 6f3db6e34b..16d62a154a 100644 --- a/lib/dns/config/confparser.y.dirty +++ b/lib/dns/config/confparser.y.dirty @@ -16,7 +16,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confparser.y.dirty,v 1.9 2000/08/11 00:20:59 bwelling Exp $ */ +/* $Id: confparser.y.dirty,v 1.10 2000/08/17 13:13:32 marka Exp $ */ #include @@ -333,6 +333,10 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult); %token L_NAMED_XFER %token L_NO %token L_NOTIFY +#ifndef NOMINUM_PUBLIC +%token L_NOTIFY_RELAY +%token L_NOTIFY_ANY +#endif /* NOMINUM_PUBLIC */ %token L_NULL_OUTPUT %token L_ONE_ANSWER %token L_ONLY @@ -753,6 +757,27 @@ option: /* Empty */ YYABORT; } } +#ifndef NOMINUM_PUBLIC + | L_NOTIFY_RELAY yea_or_nay + { + tmpres = dns_c_ctx_setnotifyrelay(currcfg, ISC_FALSE); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine notify-relay"); + YYABORT; + } + } + | + | L_NOTIFY_ANY yea_or_nay + { + tmpres = dns_c_ctx_setnotifyany(currcfg, ISC_FALSE); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine notify-any"); + YYABORT; + } + } +#endif /* NOMINUM_PUBLIC */ | L_RECURSION yea_or_nay { tmpres = dns_c_ctx_setrecursion(currcfg, $2); @@ -3684,6 +3709,42 @@ view_option: L_FORWARD zone_forward_opt YYABORT; } } +#ifndef NOMINUM_PUBLIC + | L_NOTIFY_ANY yea_or_nay + { + dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); + + INSIST(view != NULL); + + tmpres = dns_c_view_setnotifyany(view, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine view notify-any"); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set view notify-any"); + YYABORT; + } + } + | L_NOTIFY_RELAY yea_or_nay + { + dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); + + INSIST(view != NULL); + + tmpres = dns_c_view_setnotifyrelay(view, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine view notify-relay"); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set view notify-relay"); + YYABORT; + } + } +#endif /* NOMINUM_PUBLIC */ | L_RECURSION yea_or_nay { dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); @@ -5169,6 +5230,42 @@ zone_option: L_FILE L_QSTRING YYABORT; } } +#ifndef NOMINUM_PUBLIC + | L_NOTIFY_ANY yea_or_nay + { + dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg); + + INSIST(zone != NULL); + + tmpres = dns_c_zone_setnotifyany(zone, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine zone notify-any"); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set zone notify-any"); + YYABORT; + } + } + | L_NOTIFY_RELAY yea_or_nay + { + dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg); + + INSIST(zone != NULL); + + tmpres = dns_c_zone_setnotifyrelay(zone, $2); + if (tmpres == ISC_R_EXISTS) { + parser_error(ISC_FALSE, + "cannot redefine zone notify-relay"); + YYABORT; + } else if (tmpres != ISC_R_SUCCESS) { + parser_error(ISC_FALSE, + "failed to set zone notify-relay"); + YYABORT; + } + } +#endif /* NOMINUM_PUBLIC */ | L_PUBKEY L_INTEGER L_INTEGER L_INTEGER L_QSTRING { dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg); @@ -5613,6 +5710,10 @@ static struct token keyword_tokens [] = { { "named-xfer", L_NAMED_XFER }, { "no", L_NO }, { "notify", L_NOTIFY }, +#ifndef NOMINUM_PUBLIC + { "notify-any", L_NOTIFY_ANY }, + { "notify-relay", L_NOTIFY_RELAY }, +#endif /* NOMINUM_PUBLIC */ { "null", L_NULL_OUTPUT }, { "one-answer", L_ONE_ANSWER }, { "only", L_ONLY }, diff --git a/lib/dns/config/confview.c b/lib/dns/config/confview.c index 93f2621f44..b1433115ff 100644 --- a/lib/dns/config/confview.c +++ b/lib/dns/config/confview.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confview.c,v 1.44 2000/08/11 21:51:00 gson Exp $ */ +/* $Id: confview.c,v 1.45 2000/08/17 13:13:31 marka Exp $ */ #include @@ -529,6 +529,8 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass, #ifndef NOMINUM_PUBLIC view->max_names = NULL; + view->notify_any = NULL; + view->notify_relay = NULL; #endif /* NOMINMUM_PUBLIC */ view->additional_data = NULL; @@ -722,7 +724,10 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) { PRINT_AS_BOOLEAN(rfc2308_type1, "rfc2308-type1"); PRINT_AS_BOOLEAN(additional_from_auth, "additional-from-auth"); PRINT_AS_BOOLEAN(additional_from_cache, "additional-from-cache"); - +#ifndef NOMINUM_PUBLIC + PRINT_AS_BOOLEAN(notify_any, "notify-any"); + PRINT_AS_BOOLEAN(notify_relay, "notify-relay"); +#endif /* NOMINUM_PUBLIC */ PRINT_IP(transfer_source, "transfer-source"); PRINT_IP(transfer_source_v6, "transfer-source-v6"); @@ -893,6 +898,8 @@ dns_c_view_delete(dns_c_view_t **viewptr) { #ifndef NOMINUM_PUBLIC FREEFIELD(max_names); + FREEFIELD(notify_any); + FREEFIELD(notify_relay); #endif /* NOMINMUM_PUBLIC */ FREEFIELD(additional_data); @@ -1505,6 +1512,11 @@ BOOL_FUNCS(fetchglue, fetch_glue) NOTIFYTYPE_FUNCS(notify, notify) +#ifndef NOMINUM_PUBLIC +BOOL_FUNCS(notifyany, notify_any) +BOOL_FUNCS(notifyrelay, notify_relay) +#endif /* NOMINUM_PUBLIC */ + BOOL_FUNCS(rfc2308type1, rfc2308_type1) BOOL_FUNCS(additionalfromcache, additional_from_cache) BOOL_FUNCS(additionalfromauth, additional_from_auth) @@ -1531,7 +1543,7 @@ UINT32_FUNCS(maxrefreshtime, max_refresh_time) #ifndef NOMINUM_PUBLIC UINT32_FUNCS(maxnames, max_names) -#endif /* NOMINMUM_PUBLIC */ +#endif /* NOMINUM_PUBLIC */ BYTYPE_FUNCS(dns_c_addata_t, additionaldata, additional_data) BYTYPE_FUNCS(dns_transfer_format_t, transferformat, transfer_format) diff --git a/lib/dns/config/confzone.c b/lib/dns/config/confzone.c index b9d7dc2d34..addb04cc1d 100644 --- a/lib/dns/config/confzone.c +++ b/lib/dns/config/confzone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confzone.c,v 1.55 2000/08/14 21:59:57 gson Exp $ */ +/* $Id: confzone.c,v 1.56 2000/08/17 13:13:29 marka Exp $ */ #include @@ -44,11 +44,15 @@ #define MZ_SIG_VALID_INTERVAL_BIT 8 #ifndef NOMINUM_PUBLIC #define MZ_MAX_NAMES_BIT 9 -#endif /* NOMINMUM_PUBLIC */ +#endif /* NOMINUM_PUBLIC */ #define MZ_MIN_RETRY_TIME_BIT 10 #define MZ_MAX_RETRY_TIME_BIT 11 #define MZ_MIN_REFRESH_TIME_BIT 12 #define MZ_MAX_REFRESH_TIME_BIT 13 +#ifndef NOMINUM_PUBLIC +#define MZ_NOTIFY_ANY_BIT 14 +#define MZ_NOTIFY_RELAY_BIT 15 +#endif /* NOMINUM_PUBLIC */ /* @@ -69,12 +73,15 @@ #define SZ_FORWARD_BIT 12 #ifndef NOMINUM_PUBLIC #define SZ_MAX_NAMES_BIT 13 -#endif /* NOMINMUM_PUBLIC */ +#endif /* NOMINUM_PUBLIC */ #define SZ_MIN_RETRY_TIME_BIT 14 #define SZ_MAX_RETRY_TIME_BIT 15 #define SZ_MIN_REFRESH_TIME_BIT 16 #define SZ_MAX_REFRESH_TIME_BIT 17 - +#ifndef NOMINUM_PUBLIC +#define SZ_NOTIFY_ANY_BIT 18 +#define SZ_NOTIFY_RELAY_BIT 19 +#endif /* NOMINUM_PUBLIC */ /* Bit positions of the stub zones */ @@ -1701,6 +1708,212 @@ dns_c_zone_getalsonotify(dns_c_zone_t *zone, dns_c_iplist_t **retval) { return (res); } +#ifndef NOMINUM_PUBLIC + +/* + * + */ + +isc_result_t +dns_c_zone_setnotifyany(dns_c_zone_t *zone, isc_boolean_t newval) { + isc_boolean_t existed = ISC_FALSE; + + REQUIRE(DNS_C_ZONE_VALID(zone)); + + switch (zone->ztype) { + case dns_c_zone_master: + zone->u.mzone.notify_any = newval; + existed = DNS_C_CHECKBIT(MZ_NOTIFY_ANY_BIT, + &zone->u.mzone.setflags); + DNS_C_SETBIT(MZ_NOTIFY_ANY_BIT, &zone->u.mzone.setflags); + break; + + case dns_c_zone_slave: + zone->u.szone.notify_any = newval; + existed = DNS_C_CHECKBIT(SZ_NOTIFY_ANY_BIT, + &zone->u.szone.setflags); + DNS_C_SETBIT(SZ_NOTIFY_ANY_BIT, &zone->u.szone.setflags); + break; + + case dns_c_zone_stub: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "stub zones do not have a notify-any field"); + return (ISC_R_FAILURE); + + case dns_c_zone_hint: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "hint zones do not have a notify-any field"); + return (ISC_R_FAILURE); + + case dns_c_zone_forward: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "forward zones do not have a notify-any field"); + return (ISC_R_FAILURE); + } + + return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); +} + + +/* + * + */ + +isc_result_t +dns_c_zone_getnotifyany(dns_c_zone_t *zone, isc_boolean_t *retval) { + isc_result_t res = ISC_R_SUCCESS; + + REQUIRE(DNS_C_ZONE_VALID(zone)); + REQUIRE(retval != NULL); + + switch (zone->ztype) { + case dns_c_zone_master: + if (DNS_C_CHECKBIT(MZ_NOTIFY_ANY_BIT, + &zone->u.mzone.setflags)) { + *retval = zone->u.mzone.notify_any; + res = ISC_R_SUCCESS; + } else { + res = ISC_R_NOTFOUND; + } + break; + + case dns_c_zone_slave: + if (DNS_C_CHECKBIT(SZ_NOTIFY_ANY_BIT, &zone->u.szone.setflags)) { + *retval = zone->u.szone.notify_any; + res = ISC_R_SUCCESS; + } else { + res = ISC_R_NOTFOUND; + } + break; + + case dns_c_zone_stub: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "stub zones do not have a notify-any field"); + break; + + case dns_c_zone_hint: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "hint zones do not have a notify-any field"); + return (ISC_R_FAILURE); + + case dns_c_zone_forward: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "forward zones do not have a notify-any field"); + return (ISC_R_FAILURE); + } + + return (res); +} + +/* + * + */ + +isc_result_t +dns_c_zone_setnotifyrelay(dns_c_zone_t *zone, isc_boolean_t newval) { + isc_boolean_t existed = ISC_FALSE; + + REQUIRE(DNS_C_ZONE_VALID(zone)); + + switch (zone->ztype) { + case dns_c_zone_master: + zone->u.mzone.notify_relay = newval; + existed = DNS_C_CHECKBIT(MZ_NOTIFY_RELAY_BIT, + &zone->u.mzone.setflags); + DNS_C_SETBIT(MZ_NOTIFY_RELAY_BIT, &zone->u.mzone.setflags); + break; + + case dns_c_zone_slave: + zone->u.szone.notify_relay = newval; + existed = DNS_C_CHECKBIT(SZ_NOTIFY_RELAY_BIT, + &zone->u.szone.setflags); + DNS_C_SETBIT(SZ_NOTIFY_RELAY_BIT, &zone->u.szone.setflags); + break; + + case dns_c_zone_stub: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "stub zones do not have a notify-relay field"); + return (ISC_R_FAILURE); + + case dns_c_zone_hint: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "hint zones do not have a notify-relay field"); + return (ISC_R_FAILURE); + + case dns_c_zone_forward: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "forward zones do not have a notify-relay field"); + return (ISC_R_FAILURE); + } + + return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); +} + + +/* + * + */ + +isc_result_t +dns_c_zone_getnotifyrelay(dns_c_zone_t *zone, isc_boolean_t *retval) { + isc_result_t res = ISC_R_SUCCESS; + + REQUIRE(DNS_C_ZONE_VALID(zone)); + REQUIRE(retval != NULL); + + switch (zone->ztype) { + case dns_c_zone_master: + if (DNS_C_CHECKBIT(MZ_NOTIFY_RELAY_BIT, + &zone->u.mzone.setflags)) { + *retval = zone->u.mzone.notify_relay; + res = ISC_R_SUCCESS; + } else { + res = ISC_R_NOTFOUND; + } + break; + + case dns_c_zone_slave: + if (DNS_C_CHECKBIT(SZ_NOTIFY_RELAY_BIT, + &zone->u.szone.setflags)) { + *retval = zone->u.szone.notify_relay; + res = ISC_R_SUCCESS; + } else { + res = ISC_R_NOTFOUND; + } + break; + + case dns_c_zone_stub: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "stub zones do not have a notify-relay field"); + return (ISC_R_FAILURE); + + case dns_c_zone_hint: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "hint zones do not have a notifyrelay field"); + return (ISC_R_FAILURE); + + case dns_c_zone_forward: + isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG, + DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL, + "forward zones do not have a notify-relay field"); + return (ISC_R_FAILURE); + } + + return (res); +} +#endif /* NOMINUM_PUBLIC */ + /* * @@ -3654,7 +3867,7 @@ dns_c_zone_getmaxnames(dns_c_zone_t *zone, isc_uint32_t *retval) { return (res); } -#endif /* NOMINMUM_PUBLIC */ +#endif /* NOMINUM_PUBLIC */ /* @@ -4429,7 +4642,19 @@ master_zone_print(FILE *fp, int indent, dns_c_masterzone_t *mzone) { dns_c_printtabs(fp, indent); fprintf(fp, "max-names %d;\n", mzone->max_names); } -#endif + + if (DNS_C_CHECKBIT(MZ_NOTIFY_ANY_BIT, &mzone->setflags)) { + dns_c_printtabs(fp, indent); + fprintf(fp, "notify-any %s;\n", + (mzone->notify_any ? "true" : "false")); + } + + if (DNS_C_CHECKBIT(MZ_NOTIFY_RELAY_BIT, &mzone->setflags)) { + dns_c_printtabs(fp, indent); + fprintf(fp, "notify-relay %s;\n", + (mzone->notify_relay ? "true" : "false")); + } +#endif /* NOMINUM_PUBLIC */ if (mzone->pubkeylist != NULL) { fprintf(fp, "\n"); @@ -4638,7 +4863,19 @@ slave_zone_print(FILE *fp, int indent, dns_c_slavezone_t *szone) { dns_c_printtabs(fp, indent); fprintf(fp, "max-names %d;\n", szone->max_names); } -#endif + + if (DNS_C_CHECKBIT(SZ_NOTIFY_ANY_BIT, &szone->setflags)) { + dns_c_printtabs(fp, indent); + fprintf(fp, "notify-any %s;\n", + (szone->notify_any ? "true" : "false")); + } + + if (DNS_C_CHECKBIT(SZ_NOTIFY_RELAY_BIT, &szone->setflags)) { + dns_c_printtabs(fp, indent); + fprintf(fp, "notify-relay %s;\n", + (szone->notify_relay ? "true" : "false")); + } +#endif /* NOMINUM_PUBLIC */ if (szone->also_notify != NULL) { dns_c_printtabs(fp, indent); diff --git a/lib/dns/include/dns/confctx.h b/lib/dns/include/dns/confctx.h index 774aa2ec8a..c6dc87caac 100644 --- a/lib/dns/include/dns/confctx.h +++ b/lib/dns/include/dns/confctx.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confctx.h,v 1.49 2000/08/02 20:44:25 brister Exp $ */ +/* $Id: confctx.h,v 1.50 2000/08/17 13:13:24 marka Exp $ */ #ifndef DNS_CONFCTX_H #define DNS_CONFCTX_H 1 @@ -155,8 +155,9 @@ struct dns_c_options { isc_uint32_t *min_refresh_time; isc_uint32_t *max_refresh_time; +#ifndef NOMINUM_PUBLIC isc_uint32_t *max_names; - +#endif /* NOMINUM_PUBLIC */ isc_boolean_t *expert_mode; isc_boolean_t *fake_iquery; @@ -177,6 +178,10 @@ struct dns_c_options { isc_boolean_t *treat_cr_as_space; isc_boolean_t *additional_from_cache; isc_boolean_t *additional_from_auth; +#ifndef NOMINUM_PUBLIC + isc_boolean_t *notify_any; + isc_boolean_t *notify_relay; +#endif /* NOMINUM_PUBLIC */ isc_sockaddr_t *transfer_source; isc_sockaddr_t *transfer_source_v6; @@ -503,11 +508,11 @@ isc_result_t dns_c_ctx_getmaxrefreshtime(dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_unsetmaxrefreshtime(dns_c_ctx_t *cfg); - +#ifndef NOMINUM_PUBLIC isc_result_t dns_c_ctx_setmaxnames(dns_c_ctx_t *cfg, isc_uint32_t newval); isc_result_t dns_c_ctx_getmaxnames(dns_c_ctx_t *cfg, isc_uint32_t *retval); isc_result_t dns_c_ctx_unsetmaxnames(dns_c_ctx_t *cfg); - +#endif /* NOMINUM_PUBLIC */ isc_result_t dns_c_ctx_setmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t newval); isc_result_t dns_c_ctx_getmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t *retval); @@ -528,6 +533,15 @@ isc_result_t dns_c_ctx_setfakeiquery(dns_c_ctx_t *cfg, isc_boolean_t newval); isc_result_t dns_c_ctx_getfakeiquery(dns_c_ctx_t *cfg, isc_boolean_t *retval); isc_result_t dns_c_ctx_unsetfakeiquery(dns_c_ctx_t *cfg); +#ifndef NOMINUM_PUBLIC +isc_result_t dns_c_ctx_setnotifyany(dns_c_ctx_t *cfg, isc_boolean_t newval); +isc_result_t dns_c_ctx_getnotifyany(dns_c_ctx_t *cfg, isc_boolean_t *retval); +isc_result_t dns_c_ctx_unsetnotifyany(dns_c_ctx_t *cfg); + +isc_result_t dns_c_ctx_setnotifyrelay(dns_c_ctx_t *cfg, isc_boolean_t newval); +isc_result_t dns_c_ctx_getnotifyrelay(dns_c_ctx_t *cfg, isc_boolean_t *retval); +isc_result_t dns_c_ctx_unsetnotifyrelay(dns_c_ctx_t *cfg); +#endif /* NOMINUM_PUBLIC */ isc_result_t dns_c_ctx_setrecursion(dns_c_ctx_t *cfg, isc_boolean_t newval); isc_result_t dns_c_ctx_getrecursion(dns_c_ctx_t *cfg, isc_boolean_t *retval); diff --git a/lib/dns/include/dns/confview.h b/lib/dns/include/dns/confview.h index acdeacbcfc..5806e7e45f 100644 --- a/lib/dns/include/dns/confview.h +++ b/lib/dns/include/dns/confview.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confview.h,v 1.38 2000/08/11 21:51:02 gson Exp $ */ +/* $Id: confview.h,v 1.39 2000/08/17 13:13:25 marka Exp $ */ #ifndef DNS_CONFVIEW_H #define DNS_CONFVIEW_H 1 @@ -124,6 +124,10 @@ struct dns_c_view { isc_boolean_t *rfc2308_type1; isc_boolean_t *additional_from_auth; isc_boolean_t *additional_from_cache; +#ifndef NOMINUM_PUBLIC + isc_boolean_t *notify_any; + isc_boolean_t *notify_relay; +#endif /* NOMINUM_PUBLIC */ isc_sockaddr_t *query_source; isc_sockaddr_t *query_source_v6; @@ -351,8 +355,21 @@ isc_result_t dns_c_view_setnotify(dns_c_view_t *view, dns_notifytype_t newval); isc_result_t dns_c_view_unsetnotify(dns_c_view_t *view); +#ifndef NOMINUM_PUBLIC +isc_result_t dns_c_view_getnotifyany(dns_c_view_t *view, + isc_boolean_t *retval); +isc_result_t dns_c_view_setnotifyany(dns_c_view_t *view, + isc_boolean_t newval); +isc_result_t dns_c_view_unsetnotifyany(dns_c_view_t *view); +isc_result_t dns_c_view_getnotifyrelay(dns_c_view_t *view, + isc_boolean_t *retval); +isc_result_t dns_c_view_setnotifyrelay(dns_c_view_t *view, + isc_boolean_t newval); +isc_result_t dns_c_view_unsetnotifyrelay(dns_c_view_t *view); +#endif /* NOMINUM_PUBLIC */ + isc_result_t dns_c_view_getrfc2308type1(dns_c_view_t *view, isc_boolean_t *retval); isc_result_t dns_c_view_setrfc2308type1(dns_c_view_t *view, @@ -501,13 +518,13 @@ isc_result_t dns_c_view_setmaxrefreshtime(dns_c_view_t *view, isc_uint32_t newval); isc_result_t dns_c_view_unsetmaxrefreshtime(dns_c_view_t *view); - +#ifndef NOMINUM_PUBLIC isc_result_t dns_c_view_getmaxnames(dns_c_view_t *view, isc_uint32_t *retval); isc_result_t dns_c_view_setmaxnames(dns_c_view_t *view, isc_uint32_t newval); isc_result_t dns_c_view_unsetmaxnames(dns_c_view_t *view); - +#endif /* NOMINUM_PUBLIC */ isc_result_t dns_c_view_setadditionaldata(dns_c_view_t *view, dns_c_addata_t newval); diff --git a/lib/dns/include/dns/confzone.h b/lib/dns/include/dns/confzone.h index 95d6175fb5..685351e2d2 100644 --- a/lib/dns/include/dns/confzone.h +++ b/lib/dns/include/dns/confzone.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confzone.h,v 1.41 2000/08/11 21:51:04 gson Exp $ */ +/* $Id: confzone.h,v 1.42 2000/08/17 13:13:27 marka Exp $ */ #ifndef DNS_CONFZONE_H #define DNS_CONFZONE_H 1 @@ -105,6 +105,10 @@ struct dns_c_master_zone { dns_c_ipmatchlist_t *allow_transfer; isc_boolean_t dialup; dns_notifytype_t notify; +#ifndef NOMINUM_PUBLIC + isc_boolean_t notify_any; + isc_boolean_t notify_relay; +#endif /* NOMINUM_PUBLIC */ dns_c_iplist_t *also_notify; char *ixfr_base; char *ixfr_tmp; @@ -117,7 +121,7 @@ struct dns_c_master_zone { #ifndef NOMINUM_PUBLIC isc_uint32_t max_names; -#endif /* NOMINMUM_PUBLIC */ +#endif /* NOMINUM_PUBLIC */ isc_uint32_t min_retry_time; isc_uint32_t max_retry_time; @@ -140,6 +144,10 @@ struct dns_c_slave_zone { dns_c_ipmatchlist_t *allow_transfer; dns_c_iplist_t *also_notify; dns_notifytype_t notify; +#ifndef NOMINUM_PUBLIC + isc_boolean_t notify_any; + isc_boolean_t notify_relay; +#endif /* NOMINUM_PUBLIC */ isc_boolean_t dialup; char *ixfr_base; char *ixfr_tmp; @@ -335,6 +343,18 @@ isc_result_t dns_c_zone_setdialup(dns_c_zone_t *zone, isc_boolean_t newval); isc_result_t dns_c_zone_getdialup(dns_c_zone_t *zone, isc_boolean_t *retval); +#ifndef NOMINUM_PUBLIC +isc_result_t dns_c_zone_setnotifyany(dns_c_zone_t *zone, + isc_boolean_t newval); +isc_result_t dns_c_zone_getnotifyany(dns_c_zone_t *zone, + isc_boolean_t *retval); + + +isc_result_t dns_c_zone_setnotifyrelay(dns_c_zone_t *zone, + isc_boolean_t newval); +isc_result_t dns_c_zone_getnotifyrelay(dns_c_zone_t *zone, + isc_boolean_t *retval); +#endif /* NOMINUM_PUBLIC */ isc_result_t dns_c_zone_setnotify(dns_c_zone_t *zone, dns_notifytype_t newval); @@ -445,10 +465,12 @@ isc_result_t dns_c_zone_getmaxrefreshtime(dns_c_zone_t *zone, isc_uint32_t *retval); +#ifndef NOMINUM_PUBLIC isc_result_t dns_c_zone_setmaxnames(dns_c_zone_t *zone, isc_uint32_t newval); isc_result_t dns_c_zone_getmaxnames(dns_c_zone_t *zone, isc_uint32_t *retval); +#endif /* NOMINUM_PUBLIC */ diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index c5e7350158..8305c6653a 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.h,v 1.70 2000/08/16 02:16:49 marka Exp $ */ +/* $Id: zone.h,v 1.71 2000/08/17 13:13:28 marka Exp $ */ #ifndef DNS_ZONE_H #define DNS_ZONE_H 1 @@ -43,6 +43,13 @@ typedef enum { #define DNS_ZONEOPT_CHILDREN 0x00000004U /* perform child checks */ #define DNS_ZONEOPT_DIALUP 0x00000008U /* zone xfr over dialup link */ #define DNS_ZONEOPT_NOTIFY 0x00000010U /* perform NOTIFY */ +#ifndef NOMINUM_PUBLIC +/* + * Nominum specific options build down. + */ +#define DNS_ZONEOPT_NOTIFYRELAY 0x40000000U /* relay notify to master */ +#define DNS_ZONEOPT_NOTIFYANY 0x80000000U /* accept all notifies */ +#endif /* NOMINUM_PUBLIC */ #ifndef DNS_ZONE_MINREFRESH #define DNS_ZONE_MINREFRESH 300 /* 5 minutes */ diff --git a/lib/dns/zone.c b/lib/dns/zone.c index a3d4005eae..935680b203 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.186 2000/08/17 00:18:10 gson Exp $ */ +/* $Id: zone.c,v 1.187 2000/08/17 13:13:37 marka Exp $ */ #include @@ -213,6 +213,9 @@ struct dns_zonemgr { */ struct dns_notify { isc_int32_t magic; +#ifndef NOMINUM_PUBLIC + unsigned int flags; +#endif /* NOMINUM_PUBLIC */ isc_mem_t *mctx; dns_zone_t *zone; dns_adbfind_t *find; @@ -222,6 +225,10 @@ struct dns_notify { ISC_LINK(dns_notify_t) link; }; +#ifndef NOMINUM_PUBLIC +#define DNS_NOTIFY_NOSOA 0x0001U +#endif /* NOMINUM_PUBLIC */ + /* * dns_stub holds state while performing a 'stub' transfer. * 'db' is the zone's 'db' or a new one if this is the initial @@ -268,8 +275,15 @@ static int message_count(dns_message_t *msg, dns_section_t section, dns_rdatatype_t type); static void notify_find_address(dns_notify_t *notify); static void notify_send(dns_notify_t *notify); +#ifdef NOMINUM_PUBLIC static isc_result_t notify_createmessage(dns_zone_t *zone, dns_message_t **messagep); +#else /* NOMINUM_PUBLIC */ +static isc_result_t notify_createmessage(dns_zone_t *zone, + unsigned int flags, + dns_message_t **messagep); +static void zone_notifyrelay(dns_zone_t *zone); +#endif /* NOMINUM_PUBLIC */ static void notify_done(isc_task_t *task, isc_event_t *event); static void notify_send_toaddr(isc_task_t *task, isc_event_t *event); static isc_result_t zone_dump(dns_zone_t *); @@ -1509,6 +1523,9 @@ zone_expire(dns_zone_t *zone) { /* * 'zone' locked by caller. */ + + REQUIRE(ISLOCKED(&zone->lock)); + if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP)) { result = zone_dump(zone); if (result != ISC_R_SUCCESS) @@ -1592,6 +1609,8 @@ zone_dump(dns_zone_t *zone) { */ REQUIRE(DNS_ZONE_VALID(zone)); + REQUIRE(ISLOCKED(&zone->lock)); + buflen = strlen(zone->dbname) + 20; buf = isc_mem_get(zone->mctx, buflen); if (buf == NULL) @@ -1663,7 +1682,13 @@ dns_zone_unload(dns_zone_t *zone) { static void zone_unload(dns_zone_t *zone) { - /* caller to lock */ + + /* + * Locked by caller. + */ + + REQUIRE(ISLOCKED(&zone->lock)); + dns_db_detach(&zone->db); zone->flags &= ~DNS_ZONEFLG_LOADED; } @@ -1678,7 +1703,12 @@ static void zone_deletefile(dns_zone_t *zone) { const char me[] = "zone_deletefile"; isc_result_t result; - /* caller to lock */ + + /* + * Locked by caller. + */ + REQUIRE(ISLOCKED(&zone->lock)); + if (zone->dbname == NULL) return; result = isc_file_remove(zone->dbname); @@ -1805,6 +1835,9 @@ notify_create(isc_mem_t *mctx, dns_notify_t **notifyp) { notify->mctx = NULL; isc_mem_attach(mctx, ¬ify->mctx); +#ifndef NOMINUM_PUBLIC + notify->flags = 0; +#endif /* NOMINUM_PUBLIC */ notify->zone = NULL; notify->find = NULL; notify->request = NULL; @@ -1941,7 +1974,11 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) { goto cleanup; } +#ifdef NOMINUM_PUBLIC result = notify_createmessage(notify->zone, &message); +#else /* NOMINUM_PUBLIC */ + result = notify_createmessage(notify->zone, notify->flags, &message); +#endif /* NOMINUM_PUBLIC */ if (result != ISC_R_SUCCESS) goto cleanup; @@ -1977,7 +2014,13 @@ notify_send(dns_notify_t *notify) { */ REQUIRE(DNS_NOTIFY_VALID(notify)); + REQUIRE(ISLOCKED(¬ify->zone->lock)); + +#ifdef NOMINUM_PUBLIC result = notify_createmessage(notify->zone, &message); +#else /* NOMINUM_PUBLIC */ + result = notify_createmessage(notify->zone, notify->flags, &message); +#endif /* NOMINUM_PUBLIC */ if (result != ISC_R_SUCCESS) return; @@ -2007,6 +2050,50 @@ notify_send(dns_notify_t *notify) { dns_message_destroy(&message); } +#ifndef NOMINUM_PUBLIC +static void +zone_notifyrelay(dns_zone_t *zone) { + isc_result_t result; + const char me[] = "zone_notifyrelay"; + dns_notify_t *notify = NULL; + unsigned int i; + isc_sockaddr_t dst; + + /* + * Locked by caller. + */ + + REQUIRE(DNS_ZONE_VALID(zone)); + + REQUIRE(ISLOCKED(&zone->lock)); + + DNS_ENTER; + + /* + * Enqueue notify requests for 'also-notify' servers. + */ + for (i = 0; i < zone->masterscnt; i++) { + dst = zone->masters[i]; + if (notify_isqueued(zone, NULL, &dst)) + continue; + result = notify_create(zone->mctx, ¬ify); + if (result != ISC_R_SUCCESS) { + return; + } + dns_zone_iattach(zone, ¬ify->zone); + notify->dst = dst; + notify->flags |= DNS_NOTIFY_NOSOA; + ISC_LIST_APPEND(zone->notifies, notify, link); + result = notify_send_queue(notify); + if (result != ISC_R_SUCCESS) { + notify_destroy(notify); + return; + } + notify = NULL; + } +} +#endif /* NOMINUM_PUBLIC */ + void dns_zone_notify(dns_zone_t *zone) { dns_dbnode_t *node = NULL; @@ -3090,12 +3177,15 @@ static void cancel_refresh(dns_zone_t *zone) { const char me[] = "cancel_refresh"; isc_stdtime_t now; + /* - * caller to lock. + * Locked by caller. */ REQUIRE(DNS_ZONE_VALID(zone)); + REQUIRE(ISLOCKED(&zone->lock)); + DNS_ENTER; zone->flags &= ~DNS_ZONEFLG_REFRESH; @@ -3105,7 +3195,12 @@ cancel_refresh(dns_zone_t *zone) { } static isc_result_t +#ifdef NOMINUM_PUBLIC notify_createmessage(dns_zone_t *zone, dns_message_t **messagep) +#else /* NOMINUM_PUBLIC */ +notify_createmessage(dns_zone_t *zone, unsigned int flags, + dns_message_t **messagep) +#endif /* NOMINUM_PUBLIC */ { dns_dbnode_t *node = NULL; dns_dbversion_t *version = NULL; @@ -3156,6 +3251,10 @@ notify_createmessage(dns_zone_t *zone, dns_message_t **messagep) tempname = NULL; temprdataset = NULL; +#ifndef NOMINUM_PUBLIC + if ((flags & DNS_NOTIFY_NOSOA) != 0) + goto done; +#endif /* NOMINUM_PUBLIC */ /* * If the zone is dialup we are done as we don't want to send * the current soa so as to force a refresh query. @@ -3317,6 +3416,18 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, if (isc_sockaddr_eqaddr(from, &zone->masters[i])) break; +#ifndef NOMINUM_PUBLIC + if ((DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NOTIFYRELAY) || + DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NOTIFYANY)) && + (i >= zone->masterscnt)) { + + if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NOTIFYRELAY)) { + zone_notifyrelay(zone); + UNLOCK(&zone->lock); + return (ISC_R_SUCCESS); + } + } else +#endif if (i >= zone->masterscnt) { UNLOCK(&zone->lock); zone_log(zone, me, ISC_LOG_DEBUG(3), diff --git a/lib/dns/zoneconf.c b/lib/dns/zoneconf.c index b1d2e43846..611d6493d4 100644 --- a/lib/dns/zoneconf.c +++ b/lib/dns/zoneconf.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zoneconf.c,v 1.58 2000/08/14 21:47:42 gson Exp $ */ +/* $Id: zoneconf.c,v 1.59 2000/08/17 13:13:35 marka Exp $ */ #include @@ -243,6 +243,28 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, uintval = 0; dns_zone_setmaxnames(zone, uintval); } + + if (czone->ztype != dns_c_zone_stub) { + result = dns_c_zone_getnotifyany(czone, &boolean); + if (result != ISC_R_SUCCESS && cview != NULL) + result = dns_c_view_getnotifyany(cview, &boolean); + if (result != ISC_R_SUCCESS) + result = dns_c_ctx_getnotifyany(cctx, &boolean); + if (result != ISC_R_SUCCESS) + boolean = ISC_FALSE; + dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFYANY, boolean); + } + + if (czone->ztype != dns_c_zone_stub) { + result = dns_c_zone_getnotifyrelay(czone, &boolean); + if (result != ISC_R_SUCCESS && cview != NULL) + result = dns_c_view_getnotifyrelay(cview, &boolean); + if (result != ISC_R_SUCCESS) + result = dns_c_ctx_getnotifyrelay(cctx, &boolean); + if (result != ISC_R_SUCCESS) + boolean = ISC_FALSE; + dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFYRELAY, boolean); + } #endif /* NOMINUM_PUBLIC */ /*