From 49201f10cbbdda590b41e777fd48231efbc07878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 28 Jun 2018 13:38:39 +0200 Subject: [PATCH] Add new "mirror" slave zone option Add a new slave-only boolean configuration option, "mirror", along with its corresponding dns_zoneopt_t enum and a helper function for checking whether that option was set for a given zone. This commit does not introduce any behavior changes yet. --- bin/named/zoneconf.c | 7 +++++++ lib/dns/include/dns/zone.h | 10 +++++++++- lib/dns/zone.c | 7 +++++++ lib/isccfg/namedconf.c | 3 +++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 81040e5e24..8c94472367 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -1724,6 +1724,13 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, } dns_zone_setoption(mayberaw, DNS_ZONEOPT_MULTIMASTER, multi); + obj = NULL; + (void)cfg_map_get(zoptions, "mirror", &obj); + if (obj != NULL) { + dns_zone_setoption(mayberaw, DNS_ZONEOPT_MIRROR, + cfg_obj_asboolean(obj)); + } + obj = NULL; result = named_config_get(maps, "max-transfer-time-in", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index 4a7a9f9430..553776f570 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -79,8 +79,10 @@ typedef enum { DNS_ZONEOPT_CHECKDUPRRFAIL = 1<<26, /*%< fatal check-dup-records failures */ DNS_ZONEOPT_CHECKSPF = 1<<27, /*%< check SPF records */ DNS_ZONEOPT_CHECKTTL = 1<<28, /*%< check max-zone-ttl */ - DNS_ZONEOPT_AUTOEMPTY = 1<<29 /*%< automatic empty zone */ + DNS_ZONEOPT_AUTOEMPTY = 1<<29, /*%< automatic empty zone */ + DNS_ZONEOPT_MIRROR = 1<<30, /*%< mirror zone */ } dns_zoneopt_t; + /* * Zone key maintenance options */ @@ -2478,4 +2480,10 @@ dns_zone_getgluecachestats(dns_zone_t *zone); * otherwise NULL. */ +isc_boolean_t +dns_zone_ismirror(const dns_zone_t *zone); +/*%< + * Return ISC_TRUE if 'zone' is a mirror zone, return ISC_FALSE otherwise. + */ + #endif /* DNS_ZONE_H */ diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 769664d07b..d0460a9b56 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -19323,3 +19323,10 @@ dns_zone_getgluecachestats(dns_zone_t *zone) { return (zone->gluecachestats); } + +isc_boolean_t +dns_zone_ismirror(const dns_zone_t *zone) { + REQUIRE(DNS_ZONE_VALID(zone)); + + return (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_MIRROR)); +} diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 4526c660a7..397ceafc11 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -2147,6 +2147,9 @@ zone_clauses[] = { { "min-retry-time", &cfg_type_uint32, CFG_ZONE_SLAVE | CFG_ZONE_STUB }, + { "mirror", &cfg_type_boolean, + CFG_ZONE_SLAVE + }, { "multi-master", &cfg_type_boolean, CFG_ZONE_SLAVE | CFG_ZONE_STUB },