mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Add primaries, parental-agents as synonyms
Add back the top blocks 'parental-agents', 'primaries', and 'masters' to the configuration. Do not document them as so many names for the same clause is confusing. This has a slight negative side effect that a top block 'primaries' can be referred to with a zone statement 'parental-agents' for example, but that shouldn't be a big issue.
This commit is contained in:
@@ -580,6 +580,9 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
|
||||
oldlen = newlen; \
|
||||
}
|
||||
|
||||
static const char *remotesnames[4] = { "remote-servers", "parental-agents",
|
||||
"primaries", "masters" };
|
||||
|
||||
isc_result_t
|
||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
|
||||
@@ -695,17 +698,22 @@ resume:
|
||||
continue;
|
||||
}
|
||||
list = NULL;
|
||||
tresult = named_config_getremotesdef(
|
||||
config, "remote-servers", listname, &list);
|
||||
tresult = ISC_R_NOTFOUND;
|
||||
for (size_t n = 0; n < ARRAY_SIZE(remotesnames); n++) {
|
||||
tresult = named_config_getremotesdef(
|
||||
config, remotesnames[n], listname,
|
||||
&list);
|
||||
if (tresult == ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tresult == ISC_R_NOTFOUND) {
|
||||
cfg_obj_log(addr, ISC_LOG_ERROR,
|
||||
"remote-servers \"%s\" not found",
|
||||
listname);
|
||||
|
||||
result = tresult;
|
||||
goto cleanup;
|
||||
}
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
goto cleanup;
|
||||
}
|
||||
lists[l++].name = listname;
|
||||
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
remote-servers duplicate { 1.2.3.4; };
|
||||
primaries duplicate { 4.3.2.1; };
|
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
remote-servers "one" {
|
||||
1.2.3.4;
|
||||
};
|
||||
|
||||
parental-agents "two" {
|
||||
1.2.3.5;
|
||||
};
|
||||
|
||||
primaries "three" {
|
||||
1.2.3.6;
|
||||
};
|
||||
|
||||
masters "four" {
|
||||
1.2.3.7;
|
||||
};
|
@@ -2113,6 +2113,19 @@ check_remoteserverlists(const cfg_obj_t *cctx, isc_mem_t *mctx) {
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
/* parental-agents, primaries, masters are treated as synonyms */
|
||||
tresult = check_remoteserverlist(cctx, "parental-agents", symtab, mctx);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
tresult = check_remoteserverlist(cctx, "primaries", symtab, mctx);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
tresult = check_remoteserverlist(cctx, "masters", symtab, mctx);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
}
|
||||
isc_symtab_destroy(&symtab);
|
||||
return result;
|
||||
}
|
||||
@@ -2381,8 +2394,8 @@ check_tls_definitions(const cfg_obj_t *config, isc_mem_t *mctx) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
get_remoteservers_def(const char *list, const char *name, const cfg_obj_t *cctx,
|
||||
const cfg_obj_t **ret) {
|
||||
get_remotes(const cfg_obj_t *cctx, const char *list, const char *name,
|
||||
const cfg_obj_t **ret) {
|
||||
isc_result_t result;
|
||||
const cfg_obj_t *obj = NULL;
|
||||
const cfg_listelt_t *elt = NULL;
|
||||
@@ -2410,6 +2423,26 @@ get_remoteservers_def(const char *list, const char *name, const cfg_obj_t *cctx,
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
get_remoteservers_def(const char *name, const cfg_obj_t *cctx,
|
||||
const cfg_obj_t **ret) {
|
||||
isc_result_t result;
|
||||
|
||||
result = get_remotes(cctx, "remote-servers", name, ret);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
result = get_remotes(cctx, "primaries", name, ret);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
result = get_remotes(cctx, "parental-agents", name, ret);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return get_remotes(cctx, "masters", name, ret);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
validate_remotes(const cfg_obj_t *obj, const cfg_obj_t *config,
|
||||
uint32_t *countp, isc_mem_t *mctx) {
|
||||
@@ -2515,8 +2548,7 @@ resume:
|
||||
if (tresult == ISC_R_EXISTS) {
|
||||
continue;
|
||||
}
|
||||
tresult = get_remoteservers_def("remote-servers", listname,
|
||||
config, &obj);
|
||||
tresult = get_remoteservers_def(listname, config, &obj);
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
|
@@ -1143,6 +1143,10 @@ static cfg_clausedef_t namedconf_clauses[] = {
|
||||
{ "masters", &cfg_type_remoteservers,
|
||||
CFG_CLAUSEFLAG_MULTI | CFG_CLAUSEFLAG_NODOC },
|
||||
{ "options", &cfg_type_options, 0 },
|
||||
{ "parental-agents", &cfg_type_remoteservers,
|
||||
CFG_CLAUSEFLAG_MULTI | CFG_CLAUSEFLAG_NODOC },
|
||||
{ "primaries", &cfg_type_remoteservers,
|
||||
CFG_CLAUSEFLAG_MULTI | CFG_CLAUSEFLAG_NODOC },
|
||||
{ "remote-servers", &cfg_type_remoteservers, CFG_CLAUSEFLAG_MULTI },
|
||||
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
|
||||
{ "statistics-channels", &cfg_type_statschannels,
|
||||
|
Reference in New Issue
Block a user