Commit 16e14353 authored by Evan Hunt's avatar Evan Hunt
Browse files

add "primaries" as a synonym for "masters" in named.conf

as "type primary" is preferred over "type master" now, it makes
sense to make "primaries" available as a synonym too.

added a correctness check to ensure "primaries" and "masters"
cannot both be used in the same zone.
parent 4ea6bb72
......@@ -185,7 +185,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
const char *zname;
const char *zfile = NULL;
const cfg_obj_t *maps[4];
const cfg_obj_t *mastersobj = NULL;
const cfg_obj_t *primariesobj = NULL;
const cfg_obj_t *inviewobj = NULL;
const cfg_obj_t *zoptions = NULL;
const cfg_obj_t *classobj = NULL;
......@@ -279,8 +279,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
* Is the redirect zone configured as a slave?
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "redirect") == 0) {
cfg_map_get(zoptions, "masters", &mastersobj);
if (mastersobj != NULL) {
cfg_map_get(zoptions, "primaries", &primariesobj);
if (primariesobj == NULL) {
cfg_map_get(zoptions, "masters", &primariesobj);
}
if (primariesobj != NULL) {
return (ISC_R_SUCCESS);
}
}
......
......@@ -302,7 +302,7 @@ view \"_bind\" chaos {\n\
"# END MANAGED KEYS\n\
\n\
masters " DEFAULT_IANA_ROOT_ZONE_MASTERS " {\n\
primaries " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
2001:500:84::b; # b.root-servers.net\n\
2001:500:2f::f; # f.root-servers.net\n\
2001:7fd::1; # k.root-servers.net\n\
......@@ -567,17 +567,21 @@ named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
}
isc_result_t
named_config_getmastersdef(const cfg_obj_t *cctx, const char *name,
const cfg_obj_t **ret) {
named_config_getprimariesdef(const cfg_obj_t *cctx, const char *name,
const cfg_obj_t **ret) {
isc_result_t result;
const cfg_obj_t *masters = NULL;
const cfg_obj_t *primaries = NULL;
const cfg_listelt_t *elt;
result = cfg_map_get(cctx, "masters", &masters);
result = cfg_map_get(cctx, "primaries", &primaries);
if (result != ISC_R_SUCCESS) {
result = cfg_map_get(cctx, "masters", &primaries);
}
if (result != ISC_R_SUCCESS) {
return (result);
}
for (elt = cfg_list_first(masters); elt != NULL;
for (elt = cfg_list_first(primaries); elt != NULL;
elt = cfg_list_next(elt)) {
const cfg_obj_t *list;
const char *listname;
......@@ -678,7 +682,7 @@ resume:
isc_buffer_t b;
addr = cfg_tuple_get(cfg_listelt_value(element),
"masterselement");
"primarieselement");
key = cfg_tuple_get(cfg_listelt_value(element), "key");
if (!cfg_obj_issockaddr(addr)) {
......@@ -710,11 +714,11 @@ resume:
if (j < l) {
continue;
}
tresult = named_config_getmastersdef(config, listname,
&list);
tresult = named_config_getprimariesdef(config, listname,
&list);
if (tresult == ISC_R_NOTFOUND) {
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
"masters \"%s\" not found",
"primaries \"%s\" not found",
listname);
result = tresult;
......
......@@ -21,7 +21,7 @@
#include <isccfg/cfg.h>
#define DEFAULT_IANA_ROOT_ZONE_MASTERS "_default_iana_root_zone_masters"
#define DEFAULT_IANA_ROOT_ZONE_PRIMARIES "_default_iana_root_zone_primaries"
isc_result_t
named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf);
......@@ -59,8 +59,8 @@ named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
isc_dscp_t **dscpsp, uint32_t count);
isc_result_t
named_config_getmastersdef(const cfg_obj_t *cctx, const char *name,
const cfg_obj_t **ret);
named_config_getprimariesdef(const cfg_obj_t *cctx, const char *name,
const cfg_obj_t **ret);
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
......
......@@ -134,8 +134,8 @@ MASTERS
::
masters string [ port integer ] [ dscp
integer ] { ( masters | ipv4_address [
port integer ] | ipv6_address [ port
integer ] { ( primaries | ipv4_address
[ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
OPTIONS
......@@ -155,7 +155,7 @@ OPTIONS
allow-transfer { address_match_element; ... };
allow-update { address_match_element; ... };
allow-update-forwarding { address_match_element; ... };
also-notify [ port integer ] [ dscp integer ] { ( masters |
also-notify [ port integer ] [ dscp integer ] { ( primaries |
ipv4_address [ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
alt-transfer-source ( ipv4_address | * ) [ port ( integer | * )
......@@ -173,7 +173,7 @@ OPTIONS
blackhole { address_match_element; ... };
cache-file quoted_string;
catalog-zones { zone string [ default-masters [ port integer ]
[ dscp integer ] { ( masters | ipv4_address [ port
[ dscp integer ] { ( primaries | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key
string ]; ... } ] [ zone-directory quoted_string ] [
in-memory boolean ] [ min-update-interval duration ]; ... };
......@@ -445,6 +445,16 @@ PLUGIN
plugin ( query ) string [ { unspecified-text
} ];
PRIMARIES
^^^^^^^^^
::
primaries string [ port integer ] [ dscp
integer ] { ( primaries | ipv4_address
[ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
SERVER
^^^^^^
......@@ -533,7 +543,7 @@ VIEW
allow-transfer { address_match_element; ... };
allow-update { address_match_element; ... };
allow-update-forwarding { address_match_element; ... };
also-notify [ port integer ] [ dscp integer ] { ( masters |
also-notify [ port integer ] [ dscp integer ] { ( primaries |
ipv4_address [ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
alt-transfer-source ( ipv4_address | * ) [ port ( integer | * )
......@@ -545,7 +555,7 @@ VIEW
auto-dnssec ( allow | maintain | off );
cache-file quoted_string;
catalog-zones { zone string [ default-masters [ port integer ]
[ dscp integer ] { ( masters | ipv4_address [ port
[ dscp integer ] { ( primaries | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key
string ]; ... } ] [ zone-directory quoted_string ] [
in-memory boolean ] [ min-update-interval duration ]; ... };
......@@ -805,7 +815,7 @@ VIEW
allow-update { address_match_element; ... };
allow-update-forwarding { address_match_element; ... };
also-notify [ port integer ] [ dscp integer ] { (
masters | ipv4_address [ port integer ] |
primaries | ipv4_address [ port integer ] |
ipv6_address [ port integer ] ) [ key string ];
... };
alt-transfer-source ( ipv4_address | * ) [ port (
......@@ -845,9 +855,10 @@ VIEW
key-directory quoted_string;
masterfile-format ( map | raw | text );
masterfile-style ( full | relative );
masters [ port integer ] [ dscp integer ] { ( masters
| ipv4_address [ port integer ] | ipv6_address [
port integer ] ) [ key string ]; ... };
masters [ port integer ] [ dscp integer ] { (
primaries | ipv4_address [ port integer ] |
ipv6_address [ port integer ] ) [ key string ];
... };
max-ixfr-ratio ( unlimited | percentage );
max-journal-size ( default | unlimited | sizeval );
max-records integer;
......@@ -868,6 +879,10 @@ VIEW
notify-source-v6 ( ipv6_address | * ) [ port ( integer
| * ) ] [ dscp integer ];
notify-to-soa boolean;
primaries [ port integer ] [ dscp integer ] { (
primaries | ipv4_address [ port integer ] |
ipv6_address [ port integer ] ) [ key string ];
... };
request-expire boolean;
request-ixfr boolean;
serial-update-method ( date | increment | unixtime );
......@@ -910,7 +925,7 @@ ZONE
allow-transfer { address_match_element; ... };
allow-update { address_match_element; ... };
allow-update-forwarding { address_match_element; ... };
also-notify [ port integer ] [ dscp integer ] { ( masters |
also-notify [ port integer ] [ dscp integer ] { ( primaries |
ipv4_address [ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
alt-transfer-source ( ipv4_address | * ) [ port ( integer | * )
......@@ -948,7 +963,7 @@ ZONE
key-directory quoted_string;
masterfile-format ( map | raw | text );
masterfile-style ( full | relative );
masters [ port integer ] [ dscp integer ] { ( masters |
masters [ port integer ] [ dscp integer ] { ( primaries |
ipv4_address [ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
max-ixfr-ratio ( unlimited | percentage );
......@@ -971,6 +986,9 @@ ZONE
notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ]
[ dscp integer ];
notify-to-soa boolean;
primaries [ port integer ] [ dscp integer ] { ( primaries |
ipv4_address [ port integer ] | ipv6_address [ port
integer ] ) [ key string ]; ... };
request-expire boolean;
request-ixfr boolean;
serial-update-method ( date | increment | unixtime );
......
......@@ -1236,8 +1236,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
/*
* Configure master functionality. This applies
* to primary masters (type "master") and slaves
* acting as masters (type "slave"), but not to stubs.
* to primary servers (type "primary") and secondaries
* acting as primaries (type "secondary"), but not to stubs.
*/
if (ztype != dns_zone_stub && ztype != dns_zone_staticstub &&
ztype != dns_zone_redirect)
......@@ -1531,7 +1531,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
/*
* Configure update-related options. These apply to
* primary masters only.
* primary servers only.
*/
if (ztype == dns_zone_master) {
dns_acl_t *updateacl;
......@@ -1866,17 +1866,21 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
case dns_zone_redirect:
count = 0;
obj = NULL;
(void)cfg_map_get(zoptions, "masters", &obj);
(void)cfg_map_get(zoptions, "primaries", &obj);
if (obj == NULL) {
(void)cfg_map_get(zoptions, "masters", &obj);
}
/*
* Use the built-in master server list if one was not
* Use the built-in primary server list if one was not
* explicitly specified and this is a root zone mirror.
*/
if (obj == NULL && ztype == dns_zone_mirror &&
dns_name_equal(dns_zone_getorigin(zone), dns_rootname))
{
result = named_config_getmastersdef(
named_g_config, DEFAULT_IANA_ROOT_ZONE_MASTERS,
&obj);
result = named_config_getprimariesdef(
named_g_config,
DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj);
RETERR(result);
}
if (obj != NULL) {
......@@ -1885,13 +1889,13 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
RETERR(named_config_getipandkeylist(config, obj, mctx,
&ipkl));
result = dns_zone_setmasterswithkeys(
result = dns_zone_setprimarieswithkeys(
mayberaw, ipkl.addrs, ipkl.keys, ipkl.count);
count = ipkl.count;
dns_ipkeylist_clear(mctx, &ipkl);
RETERR(result);
} else {
result = dns_zone_setmasters(mayberaw, NULL, 0);
result = dns_zone_setprimaries(mayberaw, NULL, 0);
}
RETERR(result);
......
......@@ -30,6 +30,6 @@ zone "." {
file "redirect.db";
};
masters "testmaster" {
primaries "testmaster" {
192.5.5.241;
};
......@@ -686,7 +686,7 @@ status=`expr $status + $ret`
echo_i "check delzone after reconfig failure ($n)"
ret=0
$RNDCCMD 10.53.0.3 addzone 'inlineslave.example. IN { type slave; file "inlineslave.db"; masterfile-format text; masters { testmaster; }; };' > /dev/null 2>&1 || ret=1
$RNDCCMD 10.53.0.3 addzone 'inlineslave.example. IN { type slave; file "inlineslave.db"; masterfile-format text; primaries { testmaster; }; };' > /dev/null 2>&1 || ret=1
copy_setports ns3/named2.conf.in ns3/named.conf
rndc_reconfig ns3 10.53.0.3
$RNDCCMD 10.53.0.3 delzone inlineslave.example > /dev/null 2>&1 || ret=1
......
......@@ -23,12 +23,12 @@ options {
zone example.net {
type slave;
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
file "example.net.bk";
};
zone example.com {
type slave;
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
file "example.com.bk";
};
......@@ -45,13 +45,13 @@ zone "." {
zone "example" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
file "example.bk";
};
zone "bar" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
file "bar.bk";
};
......
......@@ -45,5 +45,5 @@ zone "flushtest.example" {
zone "expire-test" {
type slave;
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
......@@ -28,11 +28,11 @@ options {
zone "example" {
type slave;
file "example.bk";
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
zone "dynamic" {
type slave;
file "dynamic.bk";
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
......@@ -47,25 +47,25 @@ options {
zone "catalog1.example" {
type slave;
file "catalog1.example.db";
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
zone "catalog2.example" {
type slave;
file "catalog2.example.db";
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
};
zone "catalog3.example" {
type slave;
file "catalog3.example.db";
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
zone "catalog4.example" {
type slave;
file "catalog4.example.db";
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
key tsig_key. {
......
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* 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 http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "example.net" {
type secondary;
primaries { 192.168.1.1; };
masters { 192.168.1.2; };
};
......@@ -42,7 +42,7 @@ zone "." {
zone "example" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
file "example.bk";
};
......@@ -174,7 +174,7 @@ zone "multiple.example" {
zone "rfc2335.example" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
file "rfc2335.example.bk";
};
......@@ -247,7 +247,7 @@ zone "split-smart.example" {
zone "nsec3chain-test" {
type slave;
file "nsec3chain-test.bk";
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
};
zone "expiring.example" {
......
......@@ -65,11 +65,11 @@ view auth {
zone secure.example {
type slave;
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
};
zone insecure.secure.example {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
};
};
......@@ -32,31 +32,31 @@ zone "." {
zone "nsec3.example" {
type slave;
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
file "nsec3.example.bk";
};
zone "optout.example" {
type slave;
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
file "optout.example.bk";
};
zone "nsec3-unknown.example" {
type slave;
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
file "nsec3-unknown.example.bk";
};
zone "optout-unknown.example" {
type slave;
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
file "optout-unknown.example.bk";
};
zone "multiple.example" {
type slave;
masters { 10.53.0.3; };
primaries { 10.53.0.3; };
file "multiple.example.bk";
};
......
......@@ -26,5 +26,5 @@ options {
zone "." {
type slave;
file "root.bk";
masters { 10.53.0.1; };
primaries { 10.53.0.1; };
};
......@@ -27,5 +27,5 @@ options {
zone "." {
type slave;
file "root.bk";
masters { 10.53.0.4; };
primaries { 10.53.0.4; };
};
......@@ -30,5 +30,5 @@ zone "." {
transfer-source 10.53.0.7 dscp 46;
notify-source 10.53.0.7 dscp 46;
alt-transfer-source 10.53.0.7 dscp 46;
masters { 10.53.0.4; };
primaries { 10.53.0.4; };
};
......@@ -34,7 +34,7 @@ options {
zone "bits" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
allow-update-forwarding { any; };
......@@ -46,7 +46,7 @@ server 10.53.0.4 { request-ixfr no; };
zone "noixfr" {
type slave;
masters { 10.53.0.4; };
primaries { 10.53.0.4; };
inline-signing yes;
auto-dnssec maintain;
allow-update-forwarding { any; };
......@@ -90,7 +90,7 @@ zone "expired" {
zone "retransfer" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
file "retransfer.bk";
......@@ -114,7 +114,7 @@ zone "externalkey" {
zone "retransfer3" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
file "retransfer3.bk";
......@@ -122,7 +122,7 @@ zone "retransfer3" {
zone "inactiveksk" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
dnssec-dnskey-kskonly yes;
......@@ -131,7 +131,7 @@ zone "inactiveksk" {
zone "inactivezsk" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
file "inactivezsk.bk";
......@@ -139,7 +139,7 @@ zone "inactivezsk" {
zone "nokeys" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
file "nokeys.bk";
......@@ -163,7 +163,7 @@ zone "removedkeys-primary" {
zone "removedkeys-secondary" {
type slave;
masters { 10.53.0.2; };
primaries { 10.53.0.2; };
inline-signing yes;
auto-dnssec maintain;
file "removedkeys-secondary.bk";
......
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