* Fix parse of \# syntax with space for type LOC.
* Fix ldns_dname_absolute for escape sequences, fixes some parse errs.
* bugfix #297: linking ssl, bug due to patch submitted as #296.
+ * ldns-compare-zones -s to not exclude SOA record from comparison.
1.6.4 2010-01-20
* Imported pyldns contribution by Zdenek Vasicek and Karel Slany.
.IR [-i]
.IR [-d]
.IR [-z]
+.IR [-s]
.IR ZONEFILE1
.IR ZONEFILE2
-
.SH DESCRIPTION
-
\fBldns-compare-zones\fR reads two DNS zone files and prints number of differences.
+.nf
Output is formated to:
+NUM_INS -NUM_DEL ~NUM_CHG
+.fi
The major comparison is based on the owner name. If an owner name is present in zonefile 1, but not in zonefile 2, the resource records with this owner name are considered deleted, and counted as NUM_DEL. If an owner name is present in zonefile 2, but not in zonefile 1, the resource records with this owner name are considered inserted, and counted as NUM_INS. If an owner name is present in both, but there is a difference in the amount or content of the records, these are considered changed, and counted as NUM_CHG.
-
.SH OPTIONS
.TP
\fB-c\fR
Print resource records whose owner names are in both zone files, but with different resource records. (a.k.a. changed)
-
.TP
\fB-i\fR
Print resource records whose owner names are present only in ZONEFILE2 (a.k.a. inserted)
-
.TP
\fB-d\fR
Print resource records whose owner names are present only in ZONEFILE1 (a.k.a. deleted)
-
.TP
\fB-a\fR
Print all changes. Specifying this option is the same as specifying -c -i
amd -d.
-
.TP
\fB-z\fR
Suppress zone sorting; this option is not recommended; it can cause records
to be incorrectly marked as changed, depending of the nature of the changes.
-
+.TP
+\fB-s\fR
+Do not exclude the SOA record from the comparison. The SOA record may
+then show up as changed due to a new serial number. Off by default since
+you may be interested to know if (other zone apex elements) have changed.
.TP
\fB-h\fR
Show usage and exit
-
.TP
\fB-v\fR
Show the version and exit
-
-
.SH AUTHOR
Written by Ondřej Surý <ondrej@sury.org> for CZ.NIC, z.s.p.o. (czech domain registry)
-
.SH REPORTING BUGS
Report bugs to <ondrej@sury.org>.
-
.SH COPYRIGHT
Copyright (C) 2005 CZ.NIC, z.s.p.o.. This is free software. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
static void
usage(int argc, char **argv)
{
- printf("Usage: %s [-v] [-i] [-d] [-c] <zonefile1> <zonefile2>\n",
+ printf("Usage: %s [-v] [-i] [-d] [-c] [-s] <zonefile1> <zonefile2>\n",
argv[0]);
printf(" -i - print inserted\n");
printf(" -d - print deleted\n");
printf(" -c - print changed\n");
printf(" -a - print all differences (-i -d -c)\n");
+ printf(" -s - do not exclude SOA record from comparison\n");
printf(" -z - do not sort zones\n");
}
size_t num_ins = 0, num_del = 0, num_chg = 0;
int c;
bool opt_deleted = false, opt_inserted = false, opt_changed = false;
- bool sort = true;
+ bool sort = true, inc_soa = false;
char op = 0;
- while ((c = getopt(argc, argv, "ahvdicz")) != -1) {
+ while ((c = getopt(argc, argv, "ahvdicsz")) != -1) {
switch (c) {
case 'h':
usage(argc, argv);
ldns_version());
exit(EXIT_SUCCESS);
break;
+ case 's':
+ inc_soa = true;
+ break;
case 'z':
sort = false;
break;
ldns_zone_sort(z2);
}
+ if(inc_soa) {
+ ldns_rr_list* wsoa = ldns_rr_list_new();
+ ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z1));
+ ldns_rr_list_cat(wsoa, rrl1);
+ rrl1 = wsoa;
+ rrc1 = ldns_rr_list_rr_count(rrl1);
+ wsoa = ldns_rr_list_new();
+ ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z2));
+ ldns_rr_list_cat(wsoa, rrl2);
+ rrl2 = wsoa;
+ rrc2 = ldns_rr_list_rr_count(rrl2);
+ if(sort) {
+ ldns_rr_list_sort(rrl1);
+ ldns_rr_list_sort(rrl2);
+ }
+ }
+
/*
* Walk through both zones. The previously seen resource record is
* kept (in the variable rrx) so that we can recognize when we are
(unsigned int) num_chg);
/* Free resources */
+ if(inc_soa) {
+ ldns_rr_list_free(rrl1);
+ ldns_rr_list_free(rrl2);
+ }
ldns_zone_deep_free(z2);
ldns_zone_deep_free(z1);