Commit 79c2400d authored by Evan Hunt's avatar Evan Hunt

[master] allow primary/secondary as synonyms for master/slave

4848.	[func]		Zone types "primary" and "secondary" can now be used
			as synonyms for "master" and "slave" in named.conf.
			[RT #46713]
parent d40f4c98
4848. [func] Zone types "primary" and "secondary" can now be used
as synonyms for "master" and "slave" in named.conf.
[RT #46713]
4847. [bug] dnssec-dnskey-kskonly was not being honoured for
CDS and CDNSKEY. [RT #46755]
......
......@@ -126,8 +126,13 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
element = cfg_list_next(element)) {
value = cfg_listelt_value(element);
type = cfg_tuple_get(value, "type");
if (strcasecmp(cfg_obj_asstring(type), "master") != 0)
if ((strcasecmp(cfg_obj_asstring(type),
"primary") != 0) &&
(strcasecmp(cfg_obj_asstring(type),
"master") != 0))
{
continue;
}
*obj = cfg_tuple_get(value, "mode");
return (ISC_TRUE);
}
......@@ -243,11 +248,14 @@ configure_zone(const char *vclass, const char *view,
* Skip loading checks for any type other than
* master and redirect
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0)
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0) {
return (configure_hint(zfile, zclass, mctx));
else if ((strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
} else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
{
return (ISC_R_SUCCESS);
}
/*
* Is the redirect zone configured as a slave?
......
......@@ -422,18 +422,23 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
const char *str;
str = cfg_obj_asstring(zonetypeobj);
if (strcasecmp(str, "master") == 0)
if (strcasecmp(str, "primary") == 0 ||
strcasecmp(str, "master") == 0)
{
ztype = dns_zone_master;
else if (strcasecmp(str, "slave") == 0)
} else if (strcasecmp(str, "secondary") == 0 ||
strcasecmp(str, "slave") == 0)
{
ztype = dns_zone_slave;
else if (strcasecmp(str, "stub") == 0)
} else if (strcasecmp(str, "stub") == 0) {
ztype = dns_zone_stub;
else if (strcasecmp(str, "static-stub") == 0)
} else if (strcasecmp(str, "static-stub") == 0) {
ztype = dns_zone_staticstub;
else if (strcasecmp(str, "redirect") == 0)
} else if (strcasecmp(str, "redirect") == 0) {
ztype = dns_zone_redirect;
else
} else {
INSIST(0);
}
return (ztype);
}
......
......@@ -6031,7 +6031,9 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
dns_zone_setadded(zone, added);
signing = NULL;
if ((strcasecmp(ztypestr, "master") == 0 ||
if ((strcasecmp(ztypestr, "primary") == 0 ||
strcasecmp(ztypestr, "master") == 0 ||
strcasecmp(ztypestr, "secondary") == 0 ||
strcasecmp(ztypestr, "slave") == 0) &&
cfg_map_get(zoptions, "inline-signing", &signing) == ISC_R_SUCCESS &&
cfg_obj_asboolean(signing))
......
......@@ -1310,16 +1310,21 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL;
result = named_config_get(maps, "ixfr-from-differences", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
if (cfg_obj_isboolean(obj))
if (cfg_obj_isboolean(obj)) {
ixfrdiff = cfg_obj_asboolean(obj);
else if (!strcasecmp(cfg_obj_asstring(obj), "master") &&
ztype == dns_zone_master)
} else if (!strcasecmp(cfg_obj_asstring(obj), "primary") &&
!strcasecmp(cfg_obj_asstring(obj), "master") &&
ztype == dns_zone_master)
{
ixfrdiff = ISC_TRUE;
else if (!strcasecmp(cfg_obj_asstring(obj), "slave") &&
ztype == dns_zone_slave)
} else if (!strcasecmp(cfg_obj_asstring(obj), "secondary") &&
!strcasecmp(cfg_obj_asstring(obj), "slave") &&
ztype == dns_zone_slave)
{
ixfrdiff = ISC_TRUE;
else
} else {
ixfrdiff = ISC_FALSE;
}
if (raw != NULL) {
dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS,
ISC_TRUE);
......
......@@ -130,6 +130,16 @@ view "third" {
file "file";
auto-dnssec maintain;
};
zone "p" {
type primary;
file "pfile";
};
zone "s" {
type secondary;
masters {
1.2.3.4;
};
};
allow-update {
"any";
};
......
......@@ -6,4 +6,6 @@ clone IN second in-view first
. IN second redirect
clone IN third in-view first
dnssec IN third master
p IN third primary
s IN third secondary
hostname.bind chaos chaos master
......@@ -46,7 +46,7 @@ view primary {
match-clients { any; };
zone "master.example" {
type master;
type primary;
file "master.db";
allow-update { any; };
allow-transfer { any; };
......
......@@ -36,7 +36,7 @@ controls {
};
zone "master.example" {
type slave;
type secondary;
masters { 10.53.0.1; };
file "slave.db";
};
......
......@@ -6835,13 +6835,13 @@ options {
difference set.
</para>
<para><command>ixfr-from-differences</command>
also accepts <command>master</command> and
<command>slave</command> at the view and options
levels which causes
also accepts <command>master</command> (or
<command>primary</command>) and
<command>slave</command> (or <command>secondary</command>)
at the view and options levels, which causes
<command>ixfr-from-differences</command> to be enabled for
all <command>master</command> or
<command>slave</command> zones respectively.
It is off by default.
all primary or secondary zones, respectively.
It is off for all zones by default.
</para>
</listitem>
</varlistentry>
......@@ -11686,7 +11686,7 @@ view "external" {
Statement Grammar</title></info>
<programlisting><command>zone</command> <replaceable>zone_name</replaceable> [ <replaceable>class</replaceable> ] <command>{</command>
<command>type</command> master ;
<command>type</command> ( master | primary );
[ <command>allow-query</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
[ <command>allow-query-on</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
[ <command>allow-transfer</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
......@@ -11745,7 +11745,7 @@ view "external" {
<command>}</command> ;
<command>zone</command> <replaceable>zone_name</replaceable> [ <replaceable>class</replaceable> ] <command>{</command>
<command>type</command> slave ;
<command>type</command> (slave | secondary);
[ <command>allow-notify</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
[ <command>allow-query</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
[ <command>allow-query-on</command> <command>{</command> <replaceable>address_match_list</replaceable> <command>}</command> ; ]
......@@ -11905,10 +11905,14 @@ view "external" {
The <command>type</command> keyword is required
for the <command>zone</command> configuration unless
it is an <command>in-view</command> configuration. Its
acceptable values include: <varname>delegation-only</varname>,
<varname>forward</varname>, <varname>hint</varname>,
<varname>master</varname>, <varname>redirect</varname>,
<varname>slave</varname>, <varname>static-stub</varname>,
acceptable values include:
<varname>master</varname> (or <varname>primary</varname>),
<varname>slave</varname> (or <varname>secondary</varname>),
<varname>delegation-only</varname>,
<varname>forward</varname>,
<varname>hint</varname>,
<varname>redirect</varname>,
<varname>static-stub</varname>,
and <varname>stub</varname>.
</para>
......@@ -11929,8 +11933,8 @@ view "external" {
<para>
The server has a master copy of the data
for the zone and will be able to provide authoritative
answers for
it.
answers for it. Type <varname>primary</varname> is
a synonym for <varname>master</varname>.
</para>
</entry>
</row>
......@@ -11943,7 +11947,9 @@ view "external" {
<entry colname="2">
<para>
A slave zone is a replica of a master
zone. The <command>masters</command> list
zone. Type <varname>secondary</varname> is a
synonym for <varname>slave</varname>.
The <command>masters</command> list
specifies one or more IP addresses
of master servers that the slave contacts to update
its copy of the zone.
......
......@@ -60,7 +60,10 @@
<itemizedlist>
<listitem>
<para>
None.
Zone types <command>primary</command> and
<command>secondary</command> are now available as synonyms for
<command>master</command> and <command>slave</command>,
respectively, in <filename>named.conf</filename>.
</para>
</listitem>
</itemizedlist>
......
......@@ -1979,23 +1979,27 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
}
typestr = cfg_obj_asstring(obj);
if (strcasecmp(typestr, "master") == 0)
if (strcasecmp(typestr, "master") == 0 ||
strcasecmp(typestr, "primary") == 0)
{
ztype = MASTERZONE;
else if (strcasecmp(typestr, "slave") == 0)
} else if (strcasecmp(typestr, "slave") == 0 ||
strcasecmp(typestr, "secondary") == 0)
{
ztype = SLAVEZONE;
else if (strcasecmp(typestr, "stub") == 0)
} else if (strcasecmp(typestr, "stub") == 0) {
ztype = STUBZONE;
else if (strcasecmp(typestr, "static-stub") == 0)
} else if (strcasecmp(typestr, "static-stub") == 0) {
ztype = STATICSTUBZONE;
else if (strcasecmp(typestr, "forward") == 0)
} else if (strcasecmp(typestr, "forward") == 0) {
ztype = FORWARDZONE;
else if (strcasecmp(typestr, "hint") == 0)
} else if (strcasecmp(typestr, "hint") == 0) {
ztype = HINTZONE;
else if (strcasecmp(typestr, "delegation-only") == 0)
} else if (strcasecmp(typestr, "delegation-only") == 0) {
ztype = DELEGATIONZONE;
else if (strcasecmp(typestr, "redirect") == 0)
} else if (strcasecmp(typestr, "redirect") == 0) {
ztype = REDIRECTZONE;
else {
} else {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"zone '%s': invalid type %s",
znamestr, typestr);
......@@ -3053,8 +3057,11 @@ check_rpz_catz(const char *rpz_catz, const cfg_obj_t *rpz_obj,
if (obj != NULL)
zonetype = cfg_obj_asstring(obj);
}
if (strcasecmp(zonetype, "master") != 0 &&
strcasecmp(zonetype, "slave") != 0) {
if (strcasecmp(zonetype, "primary") != 0 &&
strcasecmp(zonetype, "master") != 0 &&
strcasecmp(zonetype, "secondary") != 0 &&
strcasecmp(zonetype, "slave") != 0)
{
cfg_obj_log(nameobj, logctx, ISC_LOG_ERROR,
"%s '%s'%s%s is not a master or slave zone",
rpz_catz, zonename, forview, viewname);
......
......@@ -521,7 +521,9 @@ static cfg_type_t cfg_type_rrsetorderingelement = {
* "check-names" option has a different syntax.
*/
static const char *checktype_enums[] = { "master", "slave", "response", NULL };
static const char *checktype_enums[] = {
"primary", "master", "secondary", "slave", "response", NULL
};
static cfg_type_t cfg_type_checktype = {
"checktype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum,
&cfg_rep_string, &checktype_enums
......@@ -658,8 +660,9 @@ static cfg_type_t cfg_type_forwardtype = {
};
static const char *zonetype_enums[] = {
"delegation-only", "forward", "hint", "master", "redirect",
"slave", "static-stub", "stub", NULL
"primary", "master", "secondary", "slave",
"delegation-only", "forward", "hint", "redirect",
"static-stub", "stub", NULL
};
static cfg_type_t cfg_type_zonetype = {
"zonetype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum,
......@@ -2719,7 +2722,9 @@ static cfg_type_t cfg_type_minimal = {
&cfg_rep_string, minimal_enums,
};
static const char *ixfrdiff_enums[] = { "master", "slave", NULL };
static const char *ixfrdiff_enums[] = {
"primary", "master", "secondary", "slave", NULL
};
static isc_result_t
parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type,
cfg_obj_t **ret)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment