Open gjherbiet opened 1 year ago
Thanks @gjherbiet good feature, but I don't really like the introduction of the new function (as it is very specific). Could you perhaps make it so that ZONEMD will be removed from the zone files (when requested with -Z) in ldns-compare-zone.c?
As with
SOA
,ZONEMD
resource records may not be meaningful when comparing zones (because of the only difference may be theSOA
SERIAL
value, leading to differentZONEMD
RDATA).This pull request:
ldns_zone_new_frm_fp_l_e
to parse a zone excluding a specified RR type;-Z
option toldns-compare-zone
to exclude ZONEMD RR type from zone comparison.When setting
-Z
, the last argument toldns_zone_new_frm_fp_l_e
is set toLDNS_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 emptyrr_list
, iterating over all the read RRs and only those with a type different from fromLDNS_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 usingldns-read-zone -e ZONEMD
but this doubles the amount of parsing and pipes/redirections may not always be available (e. g. while usingldns-compare-zone
in systemdExec*
directives).