ldns
ldns copied to clipboard
Optionally exclude ZONEMD RRs in ldns-compare-zone
As with SOA
, ZONEMD
resource records may not be meaningful when comparing zones (because of the only difference may be the SOA
SERIAL
value, leading to different ZONEMD
RDATA).
This pull request:
- defines a new function
ldns_zone_new_frm_fp_l_e
to parse a zone excluding a specified RR type; - adds a new
-Z
option toldns-compare-zone
to exclude ZONEMD RR type from zone comparison.
When setting -Z
, the last argument to ldns_zone_new_frm_fp_l_e
is set to LDNS_RR_TYPE_ZONEMD
and this record type is ignored while reading the zone from file.
I know this change could have been implemented purely in examples/ldns-compare-zones.c
(e.g. by creating a new empty rr_list
, iterating over all the read RRs and only those with a type different from from LDNS_RR_TYPE_ZONEMD
) but this seemed inefficient, especially for large zones.
The counterpart is this solution creates an additional "core" function in zone.c
, for the sole purpose of this additional option. If this is deemed too obtrusive, I can fallback to the other alternative.
I am also aware that ZONEMD
RRs can be filtered out using ldns-read-zone -e ZONEMD
but this doubles the amount of parsing and pipes/redirections may not always be available (e. g. while using ldns-compare-zone
in systemd Exec*
directives).