2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-23 02:28:55 +00:00

renamed named_g_config/defaults

For better clarity, the global variables named_g_config and
named_g_defaults have been changed to named_g_defaultconfig
and named_g_defaultoptions.
This commit is contained in:
Colin Vidal 2025-04-22 13:46:47 +02:00 committed by Evan Hunt
parent 6f17df074d
commit 8685ebdb99
5 changed files with 70 additions and 65 deletions

View File

@ -890,7 +890,7 @@ named_config_getport(const cfg_obj_t *config, const char *type,
if (options != NULL) { if (options != NULL) {
maps[i++] = options; maps[i++] = options;
} }
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
result = named_config_get(maps, type, &portobj); result = named_config_get(maps, type, &portobj);

View File

@ -71,7 +71,7 @@ EXTERN const char *named_g_version INIT(PACKAGE_VERSION);
EXTERN const char *named_g_product INIT(PACKAGE_NAME); EXTERN const char *named_g_product INIT(PACKAGE_NAME);
EXTERN const char *named_g_description INIT(PACKAGE_DESCRIPTION); EXTERN const char *named_g_description INIT(PACKAGE_DESCRIPTION);
EXTERN const char *named_g_srcid INIT(PACKAGE_SRCID); EXTERN const char *named_g_srcid INIT(PACKAGE_SRCID);
EXTERN const char *named_g_configargs INIT(PACKAGE_CONFIGARGS); EXTERN const char *named_g_defaultconfigargs INIT(PACKAGE_CONFIGARGS);
EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER); EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER);
EXTERN in_port_t named_g_port INIT(0); EXTERN in_port_t named_g_port INIT(0);
EXTERN in_port_t named_g_tlsport INIT(0); EXTERN in_port_t named_g_tlsport INIT(0);
@ -91,8 +91,8 @@ EXTERN unsigned int named_g_debuglevel INIT(0);
/* /*
* Current configuration information. * Current configuration information.
*/ */
EXTERN cfg_obj_t *named_g_config INIT(NULL); EXTERN cfg_obj_t *named_g_defaultconfig INIT(NULL);
EXTERN const cfg_obj_t *named_g_defaults INIT(NULL); EXTERN const cfg_obj_t *named_g_defaultoptions INIT(NULL);
EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf"); EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
EXTERN const char *named_g_defaultbindkeys INIT(NULL); EXTERN const char *named_g_defaultbindkeys INIT(NULL);
EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key"); EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key");
@ -126,7 +126,7 @@ EXTERN const char *named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR "/run/"
EXTERN const char *named_g_username INIT(NULL); EXTERN const char *named_g_username INIT(NULL);
EXTERN isc_time_t named_g_boottime; EXTERN isc_time_t named_g_boottime;
EXTERN isc_time_t named_g_configtime; EXTERN isc_time_t named_g_defaultconfigtime;
EXTERN bool named_g_memstatistics INIT(false); EXTERN bool named_g_memstatistics INIT(false);
EXTERN bool named_g_keepstderr INIT(false); EXTERN bool named_g_keepstderr INIT(false);

View File

@ -1131,7 +1131,7 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
} }
} }
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
dns_view_initsecroots(view); dns_view_initsecroots(view);
@ -1142,7 +1142,7 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
/* /*
* If bind.keys exists and is populated, it overrides * If bind.keys exists and is populated, it overrides
* the trust-anchors clause hard-coded in named_g_config. * the trust-anchors clause hard-coded in named_g_defaultconfig.
*/ */
if (bindkeys != NULL) { if (bindkeys != NULL) {
isc_log_write(DNS_LOGCATEGORY_SECURITY, isc_log_write(DNS_LOGCATEGORY_SECURITY,
@ -1170,8 +1170,8 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
"using built-in root key for view %s", "using built-in root key for view %s",
view->name); view->name);
(void)cfg_map_get(named_g_config, "trust-anchors", (void)cfg_map_get(named_g_defaultconfig,
&builtin_keys); "trust-anchors", &builtin_keys);
} }
if (builtin_keys != NULL) { if (builtin_keys != NULL) {
@ -3839,7 +3839,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
optionmaps[j++] = options; optionmaps[j++] = options;
} }
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
optionmaps[j] = NULL; optionmaps[j] = NULL;
if (config != NULL) { if (config != NULL) {
@ -4211,13 +4211,14 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
view->acceptexpired = cfg_obj_asboolean(obj); view->acceptexpired = cfg_obj_asboolean(obj);
obj = NULL; obj = NULL;
/* 'optionmaps', not 'maps': don't check named_g_defaults yet */ /* 'optionmaps', not 'maps': don't check named_g_defaultoptions yet */
(void)named_config_get(optionmaps, "dnssec-validation", &obj); (void)named_config_get(optionmaps, "dnssec-validation", &obj);
if (obj == NULL) { if (obj == NULL) {
/* /*
* Default to VALIDATION_DEFAULT as set in config.c. * Default to VALIDATION_DEFAULT as set in config.c.
*/ */
(void)cfg_map_get(named_g_defaults, "dnssec-validation", &obj); (void)cfg_map_get(named_g_defaultoptions, "dnssec-validation",
&obj);
INSIST(obj != NULL); INSIST(obj != NULL);
} }
if (obj != NULL) { if (obj != NULL) {
@ -4936,14 +4937,15 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
CHECK(configure_view_acl(vconfig, config, NULL, "allow-query-cache-on", CHECK(configure_view_acl(vconfig, config, NULL, "allow-query-cache-on",
NULL, actx, named_g_mctx, &view->cacheonacl)); NULL, actx, named_g_mctx, &view->cacheonacl));
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
"allow-query-on", NULL, actx, named_g_mctx, "allow-query-on", NULL, actx, named_g_mctx,
&view->queryonacl)); &view->queryonacl));
CHECK(configure_view_acl(vconfig, config, named_g_config, "allow-proxy", CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
NULL, actx, named_g_mctx, &view->proxyacl)); "allow-proxy", NULL, actx, named_g_mctx,
&view->proxyacl));
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
"allow-proxy-on", NULL, actx, named_g_mctx, "allow-proxy-on", NULL, actx, named_g_mctx,
&view->proxyonacl)); &view->proxyonacl));
@ -5018,28 +5020,30 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
if (view->recursionacl == NULL) { if (view->recursionacl == NULL) {
/* global default only */ /* global default only */
CHECK(configure_view_acl( CHECK(configure_view_acl(
NULL, NULL, named_g_config, "allow-recursion", NULL, NULL, named_g_defaultconfig,
NULL, actx, named_g_mctx, &view->recursionacl)); "allow-recursion", NULL, actx, named_g_mctx,
&view->recursionacl));
} }
if (view->recursiononacl == NULL) { if (view->recursiononacl == NULL) {
/* global default only */ /* global default only */
CHECK(configure_view_acl(NULL, NULL, named_g_config, CHECK(configure_view_acl(
"allow-recursion-on", NULL, NULL, NULL, named_g_defaultconfig,
actx, named_g_mctx, "allow-recursion-on", NULL, actx, named_g_mctx,
&view->recursiononacl)); &view->recursiononacl));
} }
if (view->cacheacl == NULL) { if (view->cacheacl == NULL) {
/* global default only */ /* global default only */
CHECK(configure_view_acl( CHECK(configure_view_acl(
NULL, NULL, named_g_config, "allow-query-cache", NULL, NULL, named_g_defaultconfig,
NULL, actx, named_g_mctx, &view->cacheacl)); "allow-query-cache", NULL, actx, named_g_mctx,
&view->cacheacl));
} }
if (view->cacheonacl == NULL) { if (view->cacheonacl == NULL) {
/* global default only */ /* global default only */
CHECK(configure_view_acl(NULL, NULL, named_g_config, CHECK(configure_view_acl(
"allow-query-cache-on", NULL, NULL, NULL, named_g_defaultconfig,
actx, named_g_mctx, "allow-query-cache-on", NULL, actx,
&view->cacheonacl)); named_g_mctx, &view->cacheonacl));
} }
} else { } else {
/* /*
@ -5060,7 +5064,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
*/ */
if (view->queryacl == NULL) { if (view->queryacl == NULL) {
/* global default only */ /* global default only */
CHECK(configure_view_acl(NULL, NULL, named_g_config, CHECK(configure_view_acl(NULL, NULL, named_g_defaultconfig,
"allow-query", NULL, actx, "allow-query", NULL, actx,
named_g_mctx, &view->queryacl)); named_g_mctx, &view->queryacl));
} }
@ -5070,7 +5074,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
* clients. This causes case not always to be preserved, * clients. This causes case not always to be preserved,
* and is needed by some broken clients. * and is needed by some broken clients.
*/ */
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
"no-case-compress", NULL, actx, named_g_mctx, "no-case-compress", NULL, actx, named_g_mctx,
&view->nocasecompress)); &view->nocasecompress));
@ -5086,7 +5090,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
/* /*
* Filter setting on addresses in the answer section. * Filter setting on addresses in the answer section.
*/ */
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
"deny-answer-addresses", "acl", actx, "deny-answer-addresses", "acl", actx,
named_g_mctx, &view->denyansweracl)); named_g_mctx, &view->denyansweracl));
CHECK(configure_view_nametable(vconfig, config, "deny-answer-addresses", CHECK(configure_view_nametable(vconfig, config, "deny-answer-addresses",
@ -5110,12 +5114,12 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
* read from there in zoneconf.c:configure_zone_acl() later.) * read from there in zoneconf.c:configure_zone_acl() later.)
*/ */
if (view->updateacl == NULL) { if (view->updateacl == NULL) {
CHECK(configure_view_acl(NULL, NULL, named_g_config, CHECK(configure_view_acl(NULL, NULL, named_g_defaultconfig,
"allow-update", NULL, actx, "allow-update", NULL, actx,
named_g_mctx, &view->updateacl)); named_g_mctx, &view->updateacl));
} }
if (view->upfwdacl == NULL) { if (view->upfwdacl == NULL) {
CHECK(configure_view_acl(NULL, NULL, named_g_config, CHECK(configure_view_acl(NULL, NULL, named_g_defaultconfig,
"allow-update-forwarding", NULL, actx, "allow-update-forwarding", NULL, actx,
named_g_mctx, &view->upfwdacl)); named_g_mctx, &view->upfwdacl));
} }
@ -5125,12 +5129,12 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
* can be inherited by zones. * can be inherited by zones.
*/ */
if (view->transferacl == NULL) { if (view->transferacl == NULL) {
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
"allow-transfer", NULL, actx, "allow-transfer", NULL, actx,
named_g_mctx, &view->transferacl)); named_g_mctx, &view->transferacl));
} }
if (view->notifyacl == NULL) { if (view->notifyacl == NULL) {
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_defaultconfig,
"allow-notify", NULL, actx, "allow-notify", NULL, actx,
named_g_mctx, &view->notifyacl)); named_g_mctx, &view->notifyacl));
} }
@ -7357,7 +7361,7 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
maps[i++] = options; maps[i++] = options;
} }
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
result = named_config_get(maps, "allow-new-zones", &nz); result = named_config_get(maps, "allow-new-zones", &nz);
@ -7921,14 +7925,15 @@ load_configuration(const char *filename, named_server_t *server,
*/ */
if (first_time) { if (first_time) {
result = named_config_parsedefaults(named_g_parser, result = named_config_parsedefaults(named_g_parser,
&named_g_config); &named_g_defaultconfig);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
named_main_earlyfatal("unable to load " named_main_earlyfatal("unable to load "
"internal defaults: %s", "internal defaults: %s",
isc_result_totext(result)); isc_result_totext(result));
} }
RUNTIME_CHECK(cfg_map_get(named_g_config, "options", RUNTIME_CHECK(cfg_map_get(named_g_defaultconfig, "options",
&named_g_defaults) == ISC_R_SUCCESS); &named_g_defaultoptions) ==
ISC_R_SUCCESS);
} }
/* /*
@ -8001,7 +8006,7 @@ load_configuration(const char *filename, named_server_t *server,
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
maps[i++] = options; maps[i++] = options;
} }
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
#if HAVE_LIBNGHTTP2 #if HAVE_LIBNGHTTP2
@ -8609,7 +8614,7 @@ load_configuration(const char *filename, named_server_t *server,
* Create the built-in kasp policies ("default", "insecure"). * Create the built-in kasp policies ("default", "insecure").
*/ */
kasps = NULL; kasps = NULL;
(void)cfg_map_get(named_g_config, "dnssec-policy", &kasps); (void)cfg_map_get(named_g_defaultconfig, "dnssec-policy", &kasps);
CFG_LIST_FOREACH (kasps, element) { CFG_LIST_FOREACH (kasps, element) {
cfg_obj_t *kconfig = cfg_listelt_value(element); cfg_obj_t *kconfig = cfg_listelt_value(element);
dns_kasp_t *kasp = NULL; dns_kasp_t *kasp = NULL;
@ -8770,8 +8775,8 @@ load_configuration(const char *filename, named_server_t *server,
* Create (or recreate) the built-in views. * Create (or recreate) the built-in views.
*/ */
builtin_views = NULL; builtin_views = NULL;
RUNTIME_CHECK(cfg_map_get(named_g_config, "view", &builtin_views) == RUNTIME_CHECK(cfg_map_get(named_g_defaultconfig, "view",
ISC_R_SUCCESS); &builtin_views) == ISC_R_SUCCESS);
CFG_LIST_FOREACH (builtin_views, element) { CFG_LIST_FOREACH (builtin_views, element) {
cfg_obj_t *vconfig = cfg_listelt_value(element); cfg_obj_t *vconfig = cfg_listelt_value(element);
dns_view_t *view = NULL; dns_view_t *view = NULL;
@ -9184,7 +9189,7 @@ load_configuration(const char *filename, named_server_t *server,
/* /*
* Record the time of most recent configuration * Record the time of most recent configuration
*/ */
named_g_configtime = isc_time_now(); named_g_defaultconfigtime = isc_time_now();
isc_loopmgr_resume(named_g_loopmgr); isc_loopmgr_resume(named_g_loopmgr);
exclusive = false; exclusive = false;
@ -9535,7 +9540,7 @@ shutdown_server(void *arg) {
cfg_aclconfctx_detach(&named_g_aclconfctx); cfg_aclconfctx_detach(&named_g_aclconfctx);
} }
cfg_obj_destroy(named_g_parser, &named_g_config); cfg_obj_destroy(named_g_parser, &named_g_defaultconfig);
cfg_parser_destroy(&named_g_parser); cfg_parser_destroy(&named_g_parser);
cfg_parser_destroy(&named_g_addparser); cfg_parser_destroy(&named_g_addparser);
@ -11880,7 +11885,7 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
isc_time_formathttptimestamp(&named_g_boottime, boottime, isc_time_formathttptimestamp(&named_g_boottime, boottime,
sizeof(boottime)); sizeof(boottime));
isc_time_formathttptimestamp(&named_g_configtime, configtime, isc_time_formathttptimestamp(&named_g_defaultconfigtime, configtime,
sizeof(configtime)); sizeof(configtime));
snprintf(line, sizeof(line), "version: %s (%s) <id:%s>%s%s%s\n", snprintf(line, sizeof(line), "version: %s (%s) <id:%s>%s%s%s\n",
@ -13623,7 +13628,7 @@ named_server_changezone(named_server_t *server, char *command,
addzone ? NAMED_COMMAND_ADDZONE : NAMED_COMMAND_MODZONE); addzone ? NAMED_COMMAND_ADDZONE : NAMED_COMMAND_MODZONE);
/* Changing a zone counts as reconfiguration */ /* Changing a zone counts as reconfiguration */
named_g_configtime = isc_time_now(); named_g_defaultconfigtime = isc_time_now();
cleanup: cleanup:
if (isc_buffer_usedlength(*text) > 0) { if (isc_buffer_usedlength(*text) > 0) {
@ -13934,7 +13939,7 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex,
zonename); zonename);
/* Removing a zone counts as reconfiguration */ /* Removing a zone counts as reconfiguration */
named_g_configtime = isc_time_now(); named_g_defaultconfigtime = isc_time_now();
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;

View File

@ -1779,7 +1779,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
isc_result_t result; isc_result_t result;
isc_time_formatISO8601ms(&named_g_boottime, boottime, sizeof boottime); isc_time_formatISO8601ms(&named_g_boottime, boottime, sizeof boottime);
isc_time_formatISO8601ms(&named_g_configtime, configtime, isc_time_formatISO8601ms(&named_g_defaultconfigtime, configtime,
sizeof configtime); sizeof configtime);
isc_time_formatISO8601ms(&now, nowstr, sizeof nowstr); isc_time_formatISO8601ms(&now, nowstr, sizeof nowstr);
@ -2856,7 +2856,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
now = isc_time_now(); now = isc_time_now();
isc_time_formatISO8601ms(&named_g_boottime, boottime, sizeof(boottime)); isc_time_formatISO8601ms(&named_g_boottime, boottime, sizeof(boottime));
isc_time_formatISO8601ms(&named_g_configtime, configtime, isc_time_formatISO8601ms(&named_g_defaultconfigtime, configtime,
sizeof configtime); sizeof configtime);
isc_time_formatISO8601ms(&now, nowstr, sizeof(nowstr)); isc_time_formatISO8601ms(&now, nowstr, sizeof(nowstr));

View File

@ -165,7 +165,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
maps[i++] = options; maps[i++] = options;
} }
} }
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
(void)named_config_get(maps, aclname, &aclobj); (void)named_config_get(maps, aclname, &aclobj);
@ -946,7 +946,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} }
nodefault[i] = NULL; nodefault[i] = NULL;
maps[i++] = named_g_defaults; maps[i++] = named_g_defaultoptions;
maps[i] = NULL; maps[i] = NULL;
if (vconfig != NULL) { if (vconfig != NULL) {
@ -1808,7 +1808,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_name_equal(dns_zone_getorigin(zone), dns_rootname)) dns_name_equal(dns_zone_getorigin(zone), dns_rootname))
{ {
result = named_config_getremotesdef( result = named_config_getremotesdef(
named_g_config, "remote-servers", named_g_defaultconfig, "remote-servers",
DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj); DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj);
CHECK(result); CHECK(result);
} }