From aed02ef0fb118c4d6abdfaa48d6aee80a9c82a4d Mon Sep 17 00:00:00 2001 From: Jan Kadlec <jan.kadlec@nic.cz> Date: Fri, 14 Feb 2014 15:45:37 +0100 Subject: [PATCH] Even simpler zone dump. --- src/knot/zone/zone-dump.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/knot/zone/zone-dump.c b/src/knot/zone/zone-dump.c index 430200e887..40ff7aa03c 100644 --- a/src/knot/zone/zone-dump.c +++ b/src/knot/zone/zone-dump.c @@ -33,7 +33,6 @@ typedef struct { char *buf; size_t buflen; uint64_t rr_count; - bool dump_rdata; bool dump_rrsig; bool dump_nsec; const knot_dname_t *origin; @@ -48,9 +47,7 @@ static int apex_node_dump_text(knot_node_t *node, dump_params_t *params) // Dump SOA record as a first. if (!params->dump_nsec) { - if (params->dump_rdata) { - soa_style.show_class = true; - } + soa_style.show_class = true; if (knot_rrset_txt_dump(soa, params->buf, params->buflen, &soa_style) < 0) { return KNOT_ENOMEM; @@ -66,22 +63,12 @@ static int apex_node_dump_text(knot_node_t *node, dump_params_t *params) for (uint16_t i = 0; i < node->rrset_count; i++) { switch (rrsets[i]->type) { case KNOT_RRTYPE_NSEC: - if (params->dump_nsec) { - break; - } continue; case KNOT_RRTYPE_RRSIG: - if (params->dump_rrsig) { - break; - } continue; case KNOT_RRTYPE_SOA: continue; default: - if (params->dump_nsec || - (params->dump_rrsig && !params->dump_rdata)) { - continue; - } break; } @@ -102,7 +89,8 @@ static int node_dump_text(knot_node_t *node, void *data) dump_params_t *params = (dump_params_t *)data; // Zone apex rrsets. - if (node->owner == params->origin) { + if (node->owner == params->origin && !params->dump_rrsig && + !params->dump_nsec) { apex_node_dump_text(node, params); return KNOT_EOK; } @@ -123,8 +111,7 @@ static int node_dump_text(knot_node_t *node, void *data) } continue; default: - if (params->dump_nsec || - (params->dump_rrsig && !params->dump_rdata)) { + if (params->dump_nsec || params->dump_rrsig) { continue; } break; @@ -170,7 +157,6 @@ int zone_dump_text(knot_zone_contents_t *zone, const sockaddr_t *from, FILE *fil int ret; // Dump standard zone records without rrsigs. - params.dump_rdata = true; params.dump_rrsig = false; params.dump_nsec = false; ret = knot_zone_contents_tree_apply_inorder(zone, node_dump_text, ¶ms); @@ -183,7 +169,6 @@ int zone_dump_text(knot_zone_contents_t *zone, const sockaddr_t *from, FILE *fil fprintf(file, ";; DNSSEC signatures\n"); // Dump rrsig records. - params.dump_rdata = false; params.dump_rrsig = true; params.dump_nsec = false; ret = knot_zone_contents_tree_apply_inorder(zone, node_dump_text, @@ -197,7 +182,6 @@ int zone_dump_text(knot_zone_contents_t *zone, const sockaddr_t *from, FILE *fil if (knot_is_nsec3_enabled(zone)) { fprintf(file, ";; DNSSEC NSEC3 chain\n"); - params.dump_rdata = true; params.dump_rrsig = true; params.dump_nsec = false; ret = knot_zone_contents_nsec3_apply_inorder(zone, node_dump_text, @@ -208,9 +192,8 @@ int zone_dump_text(knot_zone_contents_t *zone, const sockaddr_t *from, FILE *fil } else if (knot_zone_contents_is_signed(zone)) { fprintf(file, ";; DNSSEC NSEC chain\n"); - // Dump nsec and rrsig records. - params.dump_rdata = true; - params.dump_rrsig = true; + // Dump nsec records. + params.dump_rrsig = false; params.dump_nsec = true; ret = knot_zone_contents_tree_apply_inorder(zone, node_dump_text, ¶ms); -- GitLab