+4380. [experimental] Added a "zone-directory" option to "catalog-zones"
+ syntax, allowing local masterfiles for slaves
+ that are provisioned by catalog zones to be stored
+ in a directory other than the server's working
+ directory. [RT #42527]
+
4379. [bug] An INSIST could be triggered if a zone contains
RRSIG records with expiry fields that loop
using serial number arithmetic. [RT #40571]
result = ns_config_getipandkeylist(config, obj,
view->mctx, &opts->masters);
+ obj = cfg_tuple_get(catz_obj, "zone-directory");
+ if (obj != NULL)
+ opts->zonedir = isc_mem_strdup(view->mctx,
+ cfg_obj_asstring(obj));
+
obj = cfg_tuple_get(catz_obj, "in-memory");
if (obj != NULL && cfg_obj_isboolean(obj))
opts->in_memory = cfg_obj_asboolean(obj);
rm -f ns*/named.memstats
rm -f ns*/named.run
rm -f ns*/named.lock
-rm -f ns{1,2}/*dom*example.db
+rm -f ns1/*dom*example.db
rm -f ns{1,2}/catalog.example.db
+rm -rf ns2/zonedir
rm -f ns*/*.jnl
rm -f ns*/*.nzf
recursion no;
serial-query-rate 100;
catalog-zones {
- zone "catalog.example" default-masters { 10.53.0.1; };
+ zone "catalog.example"
+ default-masters { 10.53.0.1; }
+ in-memory no
+ zone-directory "zonedir";
};
};
$SHELL clean.sh
cat ns1/catalog.example.db.in > ns1/catalog.example.db
+mkdir ns2/zonedir
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
+n=`expr $n + 1`
+echo "I:checking that zone-directory is populated ($n)"
+ret=0
+[ -f "ns2/zonedir/__catz___default_catalog.example_dom3.example.db" ] || ret=1
+[ -f "ns2/zonedir/__catz___default_catalog.example_dom4.example.db" ] || ret=1
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
echo "I:exit status: $status"
exit $status
</para>
<screen>
catalog-zones {
- zone "catalog.example" default-masters { 10.53.0.1; } in-memory true min-update-interval 10;
+ zone "catalog.example"
+ default-masters { 10.53.0.1; }
+ in-memory no
+ zone-directory "catzones"
+ min-update-interval 10;
};
</screen>
<para>
properly configured in the same view. In most configurations, it would
be a slave zone.
</para>
+ <para>
+ The options following the zone name are not required, and may be
+ specified in any order:
+ </para>
<para>
The <option>default-masters</option> option defines the default masters
for member zones listed in a catalog zone. This can be overridden by
will be stored locally in a file whose name is automatically generated
from the view name, catalog zone name, and member zone name.
</para>
+ <para>
+ The <option>zone-directory</option> option causes local copies of
+ member zones' master files (if <option>in-memory</option> is not set
+ to <literal>yes</literal>) to be stored in the specified directory.
+ The default is to store zone files in the server's working directory.
+ A non-absolute pathname in <option>zone-directory</option> is
+ assumed to be relative to the working directory.
+ </para>
<para>
The <option>min-update-interval</option> option sets the minimum
interval between processing of updates to catalog zones, in seconds.
options->in_memory = ISC_FALSE;
options->min_update_interval = 5;
+ options->zonedir = NULL;
}
void
dns_catz_options_free(dns_catz_options_t *options, isc_mem_t *mctx) {
if (options->masters.count > 0)
dns_ipkeylist_clear(mctx, &options->masters);
+ if (options->zonedir != NULL) {
+ isc_mem_free(mctx, options->zonedir);
+ options->zonedir = NULL;
+ }
}
isc_result_t
REQUIRE(dst != NULL);
REQUIRE(dst->masters.count == 0);
- if (src->masters.count != 0) {
+ if (src->masters.count != 0)
dns_ipkeylist_copy(mctx, &src->masters, &dst->masters);
+
+ if (dst->zonedir != NULL) {
+ isc_mem_free(mctx, dst->zonedir);
+ dst->zonedir = NULL;
}
+ if (src->zonedir != NULL)
+ dst->zonedir = isc_mem_strdup(mctx, src->zonedir);
+
return (ISC_R_SUCCESS);
}
{
if (opts->masters.count == 0)
dns_catz_options_copy(mctx, defaults, opts);
+ else if (defaults->zonedir != NULL)
+ opts->zonedir = isc_mem_strdup(mctx, defaults->zonedir);
/* This option is always taken from config, so it's always 'default' */
opts->in_memory = defaults->in_memory;
return (ISC_TRUE);
}
-
dns_name_t *
dns_catz_zone_getname(dns_catz_zone_t *zone) {
REQUIRE(zone != NULL);
isc_sha256_t sha256;
isc_region_t r;
isc_result_t result;
+ size_t rlen;
REQUIRE(zone != NULL);
REQUIRE(entry != NULL);
result = isc_buffer_allocate(zone->catzs->mctx, &tbuf,
strlen(zone->catzs->view->name) +
- 2*DNS_NAME_FORMATSIZE + 2);
+ 2 * DNS_NAME_FORMATSIZE + 2);
if (result != ISC_R_SUCCESS)
return (result);
INSIST(tbuf != NULL);
+
isc_buffer_putstr(tbuf, zone->catzs->view->name);
isc_buffer_putstr(tbuf, "_");
result = dns_name_totext(&zone->name, ISC_TRUE, tbuf);
if (result != ISC_R_SUCCESS)
goto cleanup;
+
isc_buffer_putstr(tbuf, "_");
result = dns_name_totext(&entry->name, ISC_TRUE, tbuf);
if (result != ISC_R_SUCCESS)
goto cleanup;
- result = isc_buffer_reserve(buffer, strlen("__catz__") +
- ISC_SHA256_DIGESTSTRINGLENGTH +
- strlen(".db"));
+ /* __catz__<digest>.db */
+ rlen = ISC_SHA256_DIGESTSTRINGLENGTH + 12;
+
+ /* optionally prepend with <zonedir>/ */
+ if (entry->opts.zonedir != NULL)
+ rlen += strlen(entry->opts.zonedir) + 1;
+
+ result = isc_buffer_reserve(buffer, rlen);
if (result != ISC_R_SUCCESS)
goto cleanup;
+ if (entry->opts.zonedir != NULL) {
+ isc_buffer_putstr(*buffer, entry->opts.zonedir);
+ isc_buffer_putstr(*buffer, "/");
+ }
+
isc_buffer_usedregion(tbuf, &r);
isc_buffer_putstr(*buffer, "__catz__");
if (tbuf->used > ISC_SHA256_DIGESTSTRINGLENGTH) {
} else {
isc_buffer_copyregion(*buffer, &r);
}
+
isc_buffer_putstr(*buffer, ".db");
result = ISC_R_SUCCESS;
cleanup:
- isc_buffer_free(&tbuf);
+ if (tbuf != NULL)
+ isc_buffer_free(&tbuf);
return (result);
}
/*
* Options that can be overriden in catalog zone
*/
- /* masters definition */
+ /* default-masters definition */
dns_ipkeylist_t masters;
/*
* Options that are only set in named.conf
*/
+ /* zone-directory definition */
+ char *zonedir;
+
/* zone should not be stored on disk (no 'file' statement in def */
isc_boolean_t in_memory;
/*
static cfg_tuplefielddef_t catz_zone_fields[] = {
{ "zone name", &cfg_type_catz_zone, 0 },
{ "default-masters", &cfg_type_namesockaddrkeylist, 0 },
+ { "zone-directory", &cfg_type_qstring, 0 },
{ "in-memory", &cfg_type_boolean, 0 },
{ "min-update-interval", &cfg_type_uint32, 0 },
{ NULL, NULL, 0 }