Skip to content

Commit

Permalink
Merge branch 'ecaballero-nic-develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wtoorop committed Oct 6, 2021
2 parents 590c1d4 + 8b5cd97 commit 15fa2ee
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
* PR #133: Update m4 files for python modules.
Thanks Petr Menšík
* Bufix CAA value fields may be empty: Thanks Robert Mortimer
* PR #108: Fix for ldns-compare-zones net detecting when first zone
has a RRset that shrinks from two to one RRs, or grows from one
to two RRs. Thanks Emilio Caballero

1.7.1 2019-07-26
* bugfix: Manage verification paths for OpenSSL >= 1.1.0
Expand Down
19 changes: 10 additions & 9 deletions examples/ldns-compare-zones.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ main(int argc, char **argv)
rr_chg = rr_cmp = -1;
}
if (rr_cmp < 0) {
i++;
if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr1),
ldns_rr_owner(rrx)
) != 0)) {
Expand All @@ -254,8 +253,8 @@ main(int argc, char **argv)
printf("%c-", op);
ldns_rr_print(stdout, rr1);
}
i++;
} else if (rr_cmp > 0) {
j++;
if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr2),
ldns_rr_owner(rrx)
) != 0)) {
Expand All @@ -277,9 +276,8 @@ main(int argc, char **argv)
printf("%c+", op);
ldns_rr_print(stdout, rr2);
}
} else {
i++;
j++;
} else {
if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr1),
ldns_rr_owner(rrx)
) != 0)) {
Expand All @@ -294,6 +292,7 @@ main(int argc, char **argv)
ldns_dname_compare(ldns_rr_owner(rr1),
ldns_rr_owner(ldns_rr_list_rr(rrl1, k))) == 0
; k++);


for ( l = j + 1
; l < rrc2 &&
Expand All @@ -308,14 +307,14 @@ main(int argc, char **argv)
nc1 = k - i;
nc2 = l - j;
for ( k = i + 1, l = j + 1
; k < nc1 && l < nc2 &&
ldns_rr_compare(ldns_rr_list_rr(rrl1, k),
ldns_rr_list_rr(rrl2, l)) == 0
; (k - i) < nc1 && (l - j) < nc2 &&
ldns_rr_compare(ldns_rr_list_rr(rrl1, k),
ldns_rr_list_rr(rrl2, l)) == 0
; k++, l++);
if (k < nc1) {
if ((k - i) < nc1) {
op = OP_CHG;
num_chg++;
} else {
} else {
op = OP_EQ;
num_eq++;
}
Expand All @@ -326,6 +325,8 @@ main(int argc, char **argv)
printf("%c=", op);
ldns_rr_print(stdout, rr1);
}
i++;
j++;
}
}

Expand Down
18 changes: 18 additions & 0 deletions test/10-ldns-compare-zones.tpkg/10-ldns-compare-zones.diffs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
++_added.justazone.example. 3600 IN TXT "added"
~+a1.justazone.example. 3600 IN A 192.0.2.1
~-a1.justazone.example. 3600 IN A 192.0.2.2
~-a2.justazone.example. 3600 IN A 192.0.2.1
~+a2.justazone.example. 3600 IN A 192.0.2.2
~-a3.justazone.example. 3600 IN A 192.0.2.1
~+a3.justazone.example. 3600 IN A 192.0.2.2
~-a3.justazone.example. 3600 IN A 203.0.113.1
~+a3.justazone.example. 3600 IN A 203.0.113.2
~+delegation1.justazone.example. 3600 IN NS ns2.delegation1.justazone.example.
++delegation2.justazone.example. 3600 IN NS ns1.delegation2.justazone.example.
--delegation4.justazone.example. 3600 IN NS ns1.delegation3.justazone.example.
~+grow2to3.justazone.example. 3600 IN TXT "three"
~-shrink2to1.justazone.example. 3600 IN TXT "two"
~-shrink3to2.justazone.example. 3600 IN TXT "three"
--zz.justazone.example. 3600 IN TXT "top"
--zz.justazone.example. 3600 IN TXT "zZZZzzz"
+2 -2 ~7
15 changes: 15 additions & 0 deletions test/10-ldns-compare-zones.tpkg/10-ldns-compare-zones.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BaseName: 10-ldns-compare-zones
Version: 1.0
Description: Check ldns-compare-zone behaviour
CreationDate: Wed Oct 6 15:11:39 CEST 2021
Maintainer: Willem Toorop
Category:
Component:
Depends:
Help: 10-ldns-compare-zones.help
Pre:
Post:
Test: 10-ldns-compare-zones.test
AuxFiles: 10-ldns-compare-zones.zone1 10-ldns-compare-zones.zone2 10-ldns-compare-zones.diffs
Passed:
Failure:
4 changes: 4 additions & 0 deletions test/10-ldns-compare-zones.tpkg/10-ldns-compare-zones.help
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
No arguments are used for this test.

The example tool ldns-compare-zone is used to compare two zone files with numerous differences.

19 changes: 19 additions & 0 deletions test/10-ldns-compare-zones.tpkg/10-ldns-compare-zones.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# #-- 05-nm.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
# svnserve resets the path, you may need to adjust it, like this:
PATH=$PATH:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:.

LIB=../../lib/
export LD_LIBRARY_PATH=$LIB:$LD_LIBRARY_PATH

# get the libdns symbols
../../examples/ldns-compare-zones -as 10-ldns-compare-zones.zone1 10-ldns-compare-zones.zone2 > 10-ldns-compare-zones.out

diff 10-ldns-compare-zones.out 10-ldns-compare-zones.diffs
fail=$?
rm -f 10-ldns-compare-zones.out

exit $fail
31 changes: 31 additions & 0 deletions test/10-ldns-compare-zones.tpkg/10-ldns-compare-zones.zone1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$ORIGIN justazone.example.

@ SOA @ hostmaster (
1
1800 ; refresh (30 minutes)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
; This delegation will grow to 2 records
; this change was undetected in ldns < 1.7.2
delegation1 NS ns1.delegation1

delegation3 NS ns1.delegation3

delegation4 NS ns1.delegation3
delegation5 NS ns1.delegation5
a1 A 192.0.2.2
a2 A 192.0.2.1
a3 A 192.0.2.1
A 198.51.100.1
A 203.0.113.1
shrink3to2 TXT one
TXT two
TXT three
shrink2to1 TXT one
TXT two
grow2to3 TXT one
TXT two
zz TXT top
TXT zZZZzzz
30 changes: 30 additions & 0 deletions test/10-ldns-compare-zones.tpkg/10-ldns-compare-zones.zone2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$ORIGIN justazone.example.

@ SOA @ hostmaster (
1
1800 ; refresh (30 minutes)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
; This delegation will grow to 2 records
; this change was undetected in ldns < 1.7.2
delegation1 NS ns1.delegation1
NS ns2.delegation1
; delegation2 is not in zone1
delegation2 NS ns1.delegation2
delegation3 NS ns1.delegation3

delegation5 NS ns1.delegation5
a1 A 192.0.2.1
a2 A 192.0.2.2
a3 A 192.0.2.2
A 198.51.100.1
A 203.0.113.2
shrink3to2 TXT one
TXT two
shrink2to1 TXT one
grow2to3 TXT one
TXT two
TXT three
_added TXT added

0 comments on commit 15fa2ee

Please sign in to comment.