Commit 52926292 authored by Evan Hunt's avatar Evan Hunt
Browse files

Merge branch '1948-primaries-synonym' into 'main'

Resolve "add synonym for 'masters'"

Closes #1948

See merge request isc-projects/bind9!3703
parents 4ea6bb72 565f99f9
5456. [func] Added "primaries" as a synonym for "masters" in
named.conf, and "primary-only" as a synonym for
"master-only" in the parameters to "notify",
in order to bring terminology up to date with
RFC 8499. [GL #1948]
5455. [bug] `named` could crash when cleaning dead nodes
in lib/dns/rbtdb.c that have been reused meanwhile.
[GL #1968]
......
......@@ -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\
......@@ -566,33 +566,46 @@ 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) {
static isc_result_t
getprimariesdef(const cfg_obj_t *cctx, const char *list, const char *name,
const cfg_obj_t **ret) {
isc_result_t result;
const cfg_obj_t *masters = NULL;
const cfg_obj_t *obj = NULL;
const cfg_listelt_t *elt;
result = cfg_map_get(cctx, "masters", &masters);
REQUIRE(cctx != NULL);
REQUIRE(name != NULL);
REQUIRE(ret != NULL && *ret == NULL);
result = cfg_map_get(cctx, list, &obj);
if (result != ISC_R_SUCCESS) {
return (result);
}
for (elt = cfg_list_first(masters); elt != NULL;
elt = cfg_list_next(elt)) {
const cfg_obj_t *list;
const char *listname;
list = cfg_listelt_value(elt);
listname = cfg_obj_asstring(cfg_tuple_get(list, "name"));
if (strcasecmp(listname, name) == 0) {
*ret = list;
elt = cfg_list_first(obj);
while (elt != NULL) {
obj = cfg_listelt_value(elt);
if (strcasecmp(cfg_obj_asstring(cfg_tuple_get(obj, "name")),
name) == 0) {
*ret = obj;
return (ISC_R_SUCCESS);
}
elt = cfg_list_next(elt);
}
return (ISC_R_NOTFOUND);
}
isc_result_t
named_config_getprimariesdef(const cfg_obj_t *cctx, const char *name,
const cfg_obj_t **ret) {
isc_result_t result;
result = getprimariesdef(cctx, "primaries", name, ret);
if (result != ISC_R_SUCCESS) {
result = getprimariesdef(cctx, "masters", name, ret);
}
return (result);
}
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
......@@ -678,7 +691,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 +723,12 @@ resume:
if (j < l) {
continue;
}
tresult = named_config_getmastersdef(config, listname,
&list);
list = NULL;
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 ]; ... };
......@@ -312,7 +312,7 @@ OPTIONS
new-zones-directory quoted_string;
no-case-compress { address_match_element; ... };
nocookie-udp-size integer;
notify ( explicit | master-only | boolean );
notify ( explicit | master-only | primary-only | boolean );
notify-delay integer;
notify-rate integer;
notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [
......@@ -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 ]; ... };
......@@ -665,7 +675,7 @@ VIEW
new-zones-directory quoted_string;
no-case-compress { address_match_element; ... };
nocookie-udp-size integer;
notify ( explicit | master-only | boolean );
notify ( explicit | master-only | primary-only | boolean );
notify-delay integer;
notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [
dscp integer ];
......@@ -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;
......@@ -861,13 +872,17 @@ VIEW
min-refresh-time integer;
min-retry-time integer;
multi-master boolean;
notify ( explicit | master-only | boolean );
notify ( explicit | master-only | primary-only | boolean );
notify-delay integer;
notify-source ( ipv4_address | * ) [ port ( integer | *
) ] [ dscp integer ];
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 );
......@@ -964,13 +979,16 @@ ZONE
min-refresh-time integer;
min-retry-time integer;
multi-master boolean;
notify ( explicit | master-only | boolean );
notify ( explicit | master-only | primary-only | boolean );
notify-delay integer;
notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [
dscp integer ];
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 );
......
......@@ -7269,10 +7269,10 @@ removed(dns_zone_t *zone, void *uap) {
switch (dns_zone_gettype(zone)) {
case dns_zone_master:
type = "master";
type = "primary";
break;
case dns_zone_slave:
type = "slave";
type = "secondary";
break;
case dns_zone_mirror:
type = "mirror";
......@@ -14630,10 +14630,10 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
switch (zonetype) {
case dns_zone_master:
type = "master";
type = "primary";
break;
case dns_zone_slave:
type = "slave";
type = "secondary";
break;
case dns_zone_mirror:
type = "mirror";
......
......@@ -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)
......@@ -1271,10 +1271,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
notifytype = dns_notifytype_no;
}
} else {
const char *notifystr = cfg_obj_asstring(obj);
if (strcasecmp(notifystr, "explicit") == 0) {
const char *str = cfg_obj_asstring(obj);
if (strcasecmp(str, "explicit") == 0) {
notifytype = dns_notifytype_explicit;
} else if (strcasecmp(notifystr, "master-only") == 0) {
} else if (strcasecmp(str, "master-only") == 0 ||
strcasecmp(str, "primary-only") == 0)
{
notifytype = dns_notifytype_masteronly;
} else {
INSIST(0);
......@@ -1531,7 +1533,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 +1868,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 +1891,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);
......
......@@ -48,12 +48,12 @@ zone "." {
};
zone "example" {
type master;
type primary;
file "example.db";
};
zone "tsigzone" {
type master;
type primary;
file "tsigzone.db";
allow-transfer { !key one; any; };
};
......@@ -48,12 +48,12 @@ zone "." {
};
zone "example" {
type master;
type primary;
file "example.db";
};
zone "tsigzone" {
type master;
type primary;
file "tsigzone.db";
/*
* 0a00::/8 and 10/8 are the same bits, but different address
......
......@@ -61,12 +61,12 @@ zone "." {
};
zone "example" {
type master;
type primary;
file "example.db";
};
zone "tsigzone" {
type master;
type primary;
file "tsigzone.db";
allow-transfer { !reject; accept; };
};
......@@ -60,12 +60,12 @@ zone "." {
};
zone "example" {
type master;
type primary;
file "example.db";
};
zone "tsigzone" {
type master;
type primary;
file "tsigzone.db";
allow-transfer { !rejectkeys; !rejectaddrs; !check1; !check2; any; };
};
......@@ -50,12 +50,12 @@ zone "." {
};
zone "example" {
type master;
type primary;
file "example.db";
};
zone "tsigzone" {
type master;
type primary;
file "tsigzone.db";
allow-transfer { !key one; any; };
};
......@@ -33,6 +33,6 @@ key rndc_key {
};
zone "existing" {
type master;
type primary;
file "existing.db";
};
......@@ -168,7 +168,7 @@ status=`expr $status + $ret`
echo_i "testing allow-transfer ACLs against ns3 (no existing zones)"
echo_i "calling addzone example.com on ns3"
$RNDCCMD 10.53.0.3 addzone 'example.com {type master; file "example.db"; }; '
$RNDCCMD 10.53.0.3 addzone 'example.com {type primary; file "example.db"; }; '
sleep 1
t=`expr $t + 1`
......@@ -197,7 +197,7 @@ status=`expr $status + $ret`
echo_i "testing allow-transfer ACLs against ns4 (1 pre-existing zone)"
echo_i "calling addzone example.com on ns4"
$RNDCCMD 10.53.0.4 addzone 'example.com {type master; file "example.db"; }; '
$RNDCCMD 10.53.0.4 addzone 'example.com {type primary; file "example.db"; }; '
sleep 1
t=`expr $t + 1`
......
......@@ -30,31 +30,31 @@ controls {
};
zone "." {
type master;
type primary;
file "root.db";
};
zone "rt.example" {
type master;
type primary;
file "rt.db";
};
zone "naptr.example" {
type master;
type primary;
file "naptr.db";
};
zone "rt2.example" {
type master;
type primary;
file "rt2.db";
};
zone "naptr2.example" {
type master;
type primary;
file "naptr2.db";
};
zone "nid.example" {
type master;
type primary;
file "nid.db";
};
......@@ -30,31 +30,31 @@ controls {
};
zone "." {
type master;
type primary;
file "root.db";
};
zone "rt.example" {
type master;
type primary;
file "rt.db";
};
zone "naptr.example" {
type master;
type primary;
file "naptr.db";
};
zone "rt2.example" {
type master;
type primary;
file "rt2.db";
};
zone "naptr2.example" {
type master;
type primary;
file "naptr2.db";
};
zone "nid.example" {
type master;
type primary;
file "nid.db";
};
......@@ -31,31 +31,31 @@ controls {
};
zone "." {
type master;
type primary;
file "root.db";
};
zone "rt.example" {
type master;
type primary;
file "rt.db";
};
zone "naptr.example" {
type master;
type primary;
file "naptr.db";