Commit e1740442 authored by Mark Andrews's avatar Mark Andrews

1817. [func] Add support for additional zone file formats for

                        improving loading performance.  The masterfile-format
                        option in named.conf can be used to specify a
                        non-default format.  A separate command
                        named-compilezone was provided to generate zone files
                        in the new format.  Additionally, the -I and -O options
                        for dnssec-signzone specify the input and output
                        formats.
parent eb38f707
......@@ -189,12 +189,14 @@
1818. [bug] 'named-checkconf -z' triggered an INSIST. [RT #13599]
1817. [func] add support for additional zone file formats for
1817. [func] Add support for additional zone file formats for
improving loading performance. The masterfile-format
option in named.conf can be used to specify a
non-default format. A new separate command
non-default format. A separate command
named-compilezone was provided to generate zone files
in a new format.
in the new format. Additionally, the -I and -O options
for dnssec-signzone specify the input and output
formats.
1816. [port] UnixWare: failed to compile lib/isc/unix/net.c.
[RT #13597]
......
......@@ -16,7 +16,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.188 2005/04/27 04:55:47 sra Exp $ */
/* $Id: dnssec-signzone.c,v 1.189 2005/06/28 02:55:09 marka Exp $ */
/*! \file */
......@@ -108,6 +108,8 @@ static dns_ttl_t zonettl;
static FILE *fp;
static char *tempfile = NULL;
static const dns_master_style_t *masterstyle;
static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_masterformat_t outputformat = dns_masterformat_text;
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
static const char *directory;
......@@ -158,42 +160,13 @@ static void
dumpnode(dns_name_t *name, dns_dbnode_t *node) {
isc_result_t result;
if (outputformat != dns_masterformat_text)
return;
result = dns_master_dumpnodetostream(mctx, gdb, gversion, node, name,
masterstyle, fp);
check_result(result, "dns_master_dumpnodetostream");
}
static void
dumpdb(dns_db_t *db) {
dns_dbiterator_t *dbiter = NULL;
dns_dbnode_t *node;
dns_fixedname_t fname;
dns_name_t *name;
isc_result_t result;
dbiter = NULL;
result = dns_db_createiterator(db, ISC_FALSE, &dbiter);
check_result(result, "dns_db_createiterator()");
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
node = NULL;
for (result = dns_dbiterator_first(dbiter);
result == ISC_R_SUCCESS;
result = dns_dbiterator_next(dbiter))
{
result = dns_dbiterator_current(dbiter, &node, name);
check_result(result, "dns_dbiterator_current()");
dumpnode(name, node);
dns_db_detachnode(db, &node);
}
if (result != ISC_R_NOMORE)
fatal("iterating database: %s", isc_result_totext(result));
dns_dbiterator_destroy(&dbiter);
}
static signer_key_t *
newkeystruct(dst_key_t *dstkey, isc_boolean_t signwithkey) {
signer_key_t *key;
......@@ -1357,7 +1330,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
rdclass, 0, NULL, db);
check_result(result, "dns_db_create()");
result = dns_db_load(*db, file);
result = dns_db_load2(*db, file, inputformat);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
fatal("failed loading zone from '%s': %s",
file, isc_result_totext(result));
......@@ -1627,12 +1600,18 @@ static void
print_time(FILE *fp) {
time_t currenttime;
if (outputformat != dns_masterformat_text)
return;
currenttime = time(NULL);
fprintf(fp, "; File written on %s", ctime(&currenttime));
}
static void
print_version(FILE *fp) {
if (outputformat != dns_masterformat_text)
return;
fprintf(fp, "; dnssec_signzone version " VERSION "\n");
}
......@@ -1667,6 +1646,10 @@ usage(void) {
fprintf(stderr, "\t-f outfile:\n");
fprintf(stderr, "\t\tfile the signed zone is written in "
"(zonefile + .signed)\n");
fprintf(stderr, "\t-I format:\n");
fprintf(stderr, "\t\tfile format of input zonefile (text)\n");
fprintf(stderr, "\t-O format:\n");
fprintf(stderr, "\t\tfile format of signed zone file (text)\n");
fprintf(stderr, "\t-r randomdev:\n");
fprintf(stderr, "\t\ta file containing random data\n");
fprintf(stderr, "\t-a:\t");
......@@ -1725,6 +1708,7 @@ main(int argc, char *argv[]) {
int i, ch;
char *startstr = NULL, *endstr = NULL, *classname = NULL;
char *origin = NULL, *file = NULL, *output = NULL;
char *inputformatstr = NULL, *outputformatstr = NULL;
char *dskeyfile[MAXDSKEYS];
int ndskeys = 0;
char *endp;
......@@ -1737,7 +1721,6 @@ main(int argc, char *argv[]) {
isc_boolean_t free_output = ISC_FALSE;
int tempfilelen;
dns_rdataclass_t rdclass;
dns_db_t *udb = NULL;
isc_task_t **tasks = NULL;
isc_buffer_t b;
int len;
......@@ -1753,7 +1736,7 @@ main(int argc, char *argv[]) {
dns_result_register();
while ((ch = isc_commandline_parse(argc, argv,
"ac:d:e:f:ghi:j:k:l:n:o:pr:s:Stv:z"))
"ac:d:e:f:ghi:I:j:k:l:n:o:O:pr:s:Stv:z"))
!= -1) {
switch (ch) {
case 'a':
......@@ -1793,6 +1776,10 @@ main(int argc, char *argv[]) {
"positive");
break;
case 'I':
inputformatstr = isc_commandline_argument;
break;
case 'j':
endp = NULL;
jitter = strtol(isc_commandline_argument, &endp, 0);
......@@ -1830,6 +1817,10 @@ main(int argc, char *argv[]) {
origin = isc_commandline_argument;
break;
case 'O':
outputformatstr = isc_commandline_argument;
break;
case 'p':
pseudorandom = ISC_TRUE;
break;
......@@ -1925,6 +1916,24 @@ main(int argc, char *argv[]) {
sprintf(output, "%s.signed", file);
}
if (inputformatstr != NULL) {
if (strcasecmp(inputformatstr, "text") == 0)
inputformat = dns_masterformat_text;
else if (strcasecmp(inputformatstr, "raw") == 0)
inputformat = dns_masterformat_raw;
else
fatal("unknown file format: %s\n", inputformatstr);
}
if (outputformatstr != NULL) {
if (strcasecmp(outputformatstr, "text") == 0)
outputformat = dns_masterformat_text;
else if (strcasecmp(outputformatstr, "raw") == 0)
outputformat = dns_masterformat_raw;
else
fatal("unknown file format: %s\n", outputformatstr);
}
result = dns_master_stylecreate(&dsstyle, DNS_STYLEFLAG_NO_TTL,
0, 24, 0, 0, 0, 8, mctx);
check_result(result, "dns_master_stylecreate");
......@@ -2098,9 +2107,11 @@ main(int argc, char *argv[]) {
isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
postsign();
if (udb != NULL) {
dumpdb(udb);
dns_db_detach(&udb);
if (outputformat != dns_masterformat_text) {
result = dns_master_dumptostream2(mctx, gdb, gversion,
masterstyle, outputformat,
fp);
check_result(result, "dns_master_dumptostream2");
}
result = isc_stdio_close(fp);
......
......@@ -18,7 +18,7 @@
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: dnssec-signzone.docbook,v 1.18 2005/06/24 00:17:08 marka Exp $ -->
<!-- $Id: dnssec-signzone.docbook,v 1.19 2005/06/28 02:55:09 marka Exp $ -->
<refentry>
<refentryinfo>
<date>June 30, 2000</date>
......@@ -63,9 +63,11 @@
<arg><option>-k <replaceable class="parameter">key</replaceable></option></arg>
<arg><option>-l <replaceable class="parameter">domain</replaceable></option></arg>
<arg><option>-i <replaceable class="parameter">interval</replaceable></option></arg>
<arg><option>-I <replaceable class="parameter">input-format</replaceable></option></arg>
<arg><option>-j <replaceable class="parameter">jitter</replaceable></option></arg>
<arg><option>-n <replaceable class="parameter">nthreads</replaceable></option></arg>
<arg><option>-o <replaceable class="parameter">origin</replaceable></option></arg>
<arg><option>-O <replaceable class="parameter">output-format</replaceable></option></arg>
<arg><option>-p</option></arg>
<arg><option>-r <replaceable class="parameter">randomdev</replaceable></option></arg>
<arg><option>-s <replaceable class="parameter">start-time</replaceable></option></arg>
......@@ -229,6 +231,22 @@
</listitem>
</varlistentry>
<varlistentry>
<term>-I <replaceable class="parameter">input-format</replaceable></term>
<listitem>
<para>
The format of the input zone file.
Possible formats are <command>"text"</command> (default)
and <command>"raw"</command>.
This option is primarily intended to be used for dynamic
signed zones so that the dumped zone file in a non-text
format containing updates can be signed directly.
The use of this option does not make much sense for
non-dynamic zones.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-j <replaceable class="parameter">jitter</replaceable></term>
<listitem>
......@@ -273,6 +291,17 @@
</listitem>
</varlistentry>
<varlistentry>
<term>-O <replaceable class="parameter">output-format</replaceable></term>
<listitem>
<para>
The format of the output file containing the signed zone.
Possible formats are <command>"text"</command> (default)
and <command>"raw"</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p</term>
<listitem>
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db.c,v 1.78 2005/06/20 01:03:52 marka Exp $ */
/* $Id: db.c,v 1.79 2005/06/28 02:55:09 marka Exp $ */
/*! \file */
......@@ -303,6 +303,11 @@ dns_db_endload(dns_db_t *db, dns_dbload_t **dbloadp) {
isc_result_t
dns_db_load(dns_db_t *db, const char *filename) {
return (dns_db_load2(db, filename, dns_masterformat_text));
}
isc_result_t
dns_db_load2(dns_db_t *db, const char *filename, dns_masterformat_t format) {
isc_result_t result, eresult;
dns_rdatacallbacks_t callbacks;
unsigned int options = 0;
......@@ -321,9 +326,9 @@ dns_db_load(dns_db_t *db, const char *filename) {
result = dns_db_beginload(db, &callbacks.add, &callbacks.add_private);
if (result != ISC_R_SUCCESS)
return (result);
result = dns_master_loadfile(filename, &db->origin, &db->origin,
db->rdclass, options,
&callbacks, db->mctx);
result = dns_master_loadfile2(filename, &db->origin, &db->origin,
db->rdclass, options,
&callbacks, db->mctx, format);
eresult = dns_db_endload(db, &callbacks.add_private);
/*
* We always call dns_db_endload(), but we only want to return its
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db.h,v 1.81 2005/06/20 01:03:54 marka Exp $ */
/* $Id: db.h,v 1.82 2005/06/28 02:55:09 marka Exp $ */
#ifndef DNS_DB_H
#define DNS_DB_H 1
......@@ -445,6 +445,9 @@ dns_db_endload(dns_db_t *db, dns_dbload_t **dbloadp);
isc_result_t
dns_db_load(dns_db_t *db, const char *filename);
isc_result_t
dns_db_load2(dns_db_t *db, const char *filename, dns_masterformat_t format);
/*%<
* Load master file 'filename' into 'db'.
*
......
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