NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
295 stars 99 forks source link

ldns-compare-zones skip rrsets with 2 resource record in comparison #108

Closed edeleon-nic closed 2 years ago

edeleon-nic commented 4 years ago

Hi everyone,

We're currently using ldns-compare-zones to test the correlation between changes in zone files provided by two different process. The base cases are working as intended (new rrset deleting rrset, change in SOA and so on). But when a rrset is modified (Add/Rem of resource record) and the size of the resulting rrset is 2 resource records, the differences are not taken into account. Once the rrset is different than this size (1rr, or greater than 2) the changes are printed. This behavior was identified on NS rrset.

We´re testing different scenarios and working on a fix and we would be glad to propose it to you, this issue is for follow up purpose.

Any feedback on this issue or in the reported data and structure would be appreciated.

Images of the test cases: 00 Base-zone-info

  1. Base zone info at the left, modified zone at the right. dom917.com.mx and dom955.com.mx NS rrset with 2 rr's

01 Modified-zone-info

  1. Base zone info at the left, modified zone at the right. dom917.com.mx with 3 rr's and dom955.com.mx NS rrset still with 2 rr´s

02 ldns-compare-usage

  1. Usage of ldns-compare-zones, running version 1.7.1.. First comparison corresponds to image 01, and second to image 02.
ghost commented 4 years ago

Think this is also tripping me up when comparing an A record rrset - it's not picking up the difference when one side has 2 records, and the 1st record matches okay the subsequent differences aren't picked up.

server 1: ❯ dig axfr ldns.test @192.168.1.241 |grep "host.ldns.test" host.ldns.test. 3600 IN A 1.1.1.1 host.ldns.test. 3600 IN A 2.2.2.2

server2: ❯ dig axfr ldns.test @192.168.1.212 |grep "host.ldns.test" host.ldns.test. 28800 IN A 1.1.1.1 host.ldns.test. 28800 IN A 3.3.3.3

result: $ ldns-compare-zones -a src/db.ldns.test tgt/db.ldns.test ~-ldns.test. 3600 IN NS dc01.example.com. ~+ldns.test. 28800 IN NS ns01.example.net. +0 -0 ~1 -> no difference in A records picked up

Change it so that the "1st" A record is different, and then the differences are picked up: server 1: ❯ dig axfr ldns.test @192.168.1.241 |grep "host.ldns.test" host.ldns.test. 3600 IN A 1.1.1.1 host.ldns.test. 3600 IN A 2.2.2.2

server2: ❯ dig axfr ldns.test @192.168.1.212 |grep "host.ldns.test" host.ldns.test. 28800 IN A 3.3.3.3 host.ldns.test. 28800 IN A 4.4.4.4

result: $ ldns-compare-zones -a src/db.ldns.test tgt/db.ldns.test ~-ldns.test. 3600 IN NS dc01.example.com. ~+ldns.test. 28800 IN NS ns01.example.net. ~-host.ldns.test. 3600 IN A 1.1.1.1 ~-host.ldns.test. 3600 IN A 2.2.2.2 ~+host.ldns.test. 28800 IN A 3.3.3.3 ~+host.ldns.test. 28800 IN A 4.4.4.4 +0 -0 ~2

ecaballerob commented 3 years ago

109

wtoorop commented 2 years ago

Resolved in ldns-1.8.0