diff --git a/CHANGES b/CHANGES index 703b411e3b..5301833ce7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +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] diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 36b88efb9c..0b1c33f242 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -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? diff --git a/bin/named/config.c b/bin/named/config.c index a9be410a9f..8d7af71fb5 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -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); } diff --git a/bin/named/server.c b/bin/named/server.c index a4e904bc5b..c2f2f484da 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -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)) diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 610588ed9e..bf938232ef 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -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); diff --git a/bin/tests/system/checkconf/good.conf b/bin/tests/system/checkconf/good.conf index f68ffb9b2c..9e07b096f3 100644 --- a/bin/tests/system/checkconf/good.conf +++ b/bin/tests/system/checkconf/good.conf @@ -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"; }; diff --git a/bin/tests/system/checkconf/good.zonelist b/bin/tests/system/checkconf/good.zonelist index 7cb9adf2cf..e4504fc672 100644 --- a/bin/tests/system/checkconf/good.zonelist +++ b/bin/tests/system/checkconf/good.zonelist @@ -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 diff --git a/bin/tests/system/zonechecks/ns1/named.conf b/bin/tests/system/zonechecks/ns1/named.conf index 5d3b1ec3ab..f43ad17191 100644 --- a/bin/tests/system/zonechecks/ns1/named.conf +++ b/bin/tests/system/zonechecks/ns1/named.conf @@ -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; }; diff --git a/bin/tests/system/zonechecks/ns2/named.conf b/bin/tests/system/zonechecks/ns2/named.conf index 63ca71b8e4..6c2cdcf6ca 100644 --- a/bin/tests/system/zonechecks/ns2/named.conf +++ b/bin/tests/system/zonechecks/ns2/named.conf @@ -36,7 +36,7 @@ controls { }; zone "master.example" { - type slave; + type secondary; masters { 10.53.0.1; }; file "slave.db"; }; diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index eca9320332..2dd7fc19d9 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -6835,13 +6835,13 @@ options { difference set. ixfr-from-differences - also accepts master and - slave at the view and options - levels which causes + also accepts master (or + primary) and + slave (or secondary) + at the view and options levels, which causes ixfr-from-differences to be enabled for - all master or - slave zones respectively. - It is off by default. + all primary or secondary zones, respectively. + It is off for all zones by default. @@ -11686,7 +11686,7 @@ view "external" { Statement Grammar zone zone_name [ class ] { - type master ; + type ( master | primary ); [ allow-query { address_match_list } ; ] [ allow-query-on { address_match_list } ; ] [ allow-transfer { address_match_list } ; ] @@ -11745,7 +11745,7 @@ view "external" { } ; zone zone_name [ class ] { - type slave ; + type (slave | secondary); [ allow-notify { address_match_list } ; ] [ allow-query { address_match_list } ; ] [ allow-query-on { address_match_list } ; ] @@ -11905,10 +11905,14 @@ view "external" { The type keyword is required for the zone configuration unless it is an in-view configuration. Its - acceptable values include: delegation-only, - forward, hint, - master, redirect, - slave, static-stub, + acceptable values include: + master (or primary), + slave (or secondary), + delegation-only, + forward, + hint, + redirect, + static-stub, and stub. @@ -11929,8 +11933,8 @@ view "external" { 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 primary is + a synonym for master. @@ -11943,7 +11947,9 @@ view "external" { A slave zone is a replica of a master - zone. The masters list + zone. Type secondary is a + synonym for slave. + The masters list specifies one or more IP addresses of master servers that the slave contacts to update its copy of the zone. diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml index f8ae123b42..7f2a702ee8 100644 --- a/doc/arm/notes.xml +++ b/doc/arm/notes.xml @@ -60,7 +60,10 @@ - None. + Zone types primary and + secondary are now available as synonyms for + master and slave, + respectively, in named.conf. diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 0645cc44cc..44e416ce88 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -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); diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index e84ea17bb9..f531fba5ba 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -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)