[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3658 - in trunk/OpenDNSSEC/signer/src: . adapter signer

Matthijs Mekking matthijs at nlnetlabs.nl
Fri Aug 6 12:23:22 CEST 2010


Author: matthijs
Date: 2010-08-06 12:23:22 +0200 (Fri, 06 Aug 2010)
New Revision: 3658

Modified:
   trunk/OpenDNSSEC/signer/src/Makefile.am
   trunk/OpenDNSSEC/signer/src/adapter/adfile.c
   trunk/OpenDNSSEC/signer/src/signer/domain.c
   trunk/OpenDNSSEC/signer/src/signer/domain.h
   trunk/OpenDNSSEC/signer/src/signer/rrset.c
   trunk/OpenDNSSEC/signer/src/signer/rrset.h
   trunk/OpenDNSSEC/signer/src/signer/tools.c
   trunk/OpenDNSSEC/signer/src/signer/zone.c
   trunk/OpenDNSSEC/signer/src/signer/zone.h
   trunk/OpenDNSSEC/signer/src/signer/zonedata.c
   trunk/OpenDNSSEC/signer/src/signer/zonedata.h
Log:
log stats when writing signed zone

Modified: trunk/OpenDNSSEC/signer/src/Makefile.am
===================================================================
--- trunk/OpenDNSSEC/signer/src/Makefile.am	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/Makefile.am	2010-08-06 10:23:22 UTC (rev 3658)
@@ -34,6 +34,7 @@
 				signer/rrset.c signer/rrset.h \
 				signer/se_key.c signer/se_key.h \
 				signer/signconf.c signer/signconf.h \
+				signer/stats.c signer/stats.h \
 				signer/tools.c signer/tools.h \
 				signer/zone.c signer/zone.h \
 				signer/zonedata.c signer/zonedata.h \

Modified: trunk/OpenDNSSEC/signer/src/adapter/adfile.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-06 10:23:22 UTC (rev 3658)
@@ -377,6 +377,7 @@
 
     se_log_assert(fd);
     se_log_assert(zone);
+    se_log_assert(zone->stats);
 
     if (!include) {
         rr = adfile_lookup_soa_rr(fd);
@@ -430,6 +431,7 @@
                line);
             break;
         }
+        zone_in->stats->sort_count += 1;
     }
 
     /* and done */

Modified: trunk/OpenDNSSEC/signer/src/signer/domain.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-08-06 10:23:22 UTC (rev 3658)
@@ -333,7 +333,7 @@
  */
 int
 domain_nsecify(domain_type* domain, domain_type* to, uint32_t ttl,
-    ldns_rr_class klass)
+    ldns_rr_class klass, stats_type* stats)
 {
     ldns_rr_type types[1024];
     ldns_rr* nsec_rr = NULL;
@@ -344,6 +344,7 @@
     se_log_assert(domain->name);
     se_log_assert(to);
     se_log_assert(to->name);
+    se_log_assert(stats);
 
     if (DNS_SERIAL_GT(domain->inbound_serial, domain->outbound_serial)) {
         /* create types bitmap */
@@ -374,13 +375,15 @@
                 se_log_alert("failed to create NSEC RRset");
                 return 1;
             }
+            stats->nsec_count += 1;
             domain->nsec_nxt_changed = 0;
             domain->nsec_bitmap_changed = 0;
-        } else {
+        } else if (domain->nsec_nxt_changed || domain->nsec_bitmap_changed) {
             se_log_assert(domain->nsec_rrset);
             se_log_assert(domain->nsec_rrset->rrs);
             se_log_assert(domain->nsec_rrset->rrs->rr);
             nsec_rr = domain->nsec_rrset->rrs->rr;
+            stats->nsec_count += 1;
 
             if (domain->nsec_nxt_changed) {
                 se_log_debug("nsec nxt changed");
@@ -388,6 +391,7 @@
                     SE_NSEC_RDATA_NXT);
                 if (!old_rdf) {
                     se_log_alert("failed to update NSEC next owner name");
+                    stats->nsec_count -= 1;
                     return 1;
                 }
                 domain->nsec_nxt_changed = 0;
@@ -399,6 +403,7 @@
                     LDNS_RR_TYPE_NSEC), SE_NSEC_RDATA_BITMAP);
                 if (!old_rdf) {
                     se_log_alert("failed to update NSEC bitmap");
+                    stats->nsec_count -= 1;
                     return 1;
                 }
                 domain->nsec_bitmap_changed = 0;
@@ -417,7 +422,7 @@
  */
 int
 domain_nsecify3(domain_type* domain, domain_type* to, uint32_t ttl,
-    ldns_rr_class klass, nsec3params_type* nsec3params)
+    ldns_rr_class klass, nsec3params_type* nsec3params, stats_type* stats)
 {
     domain_type* orig_domain = NULL;
     ldns_rr_type types[1024];
@@ -437,6 +442,7 @@
     se_log_assert(to->nsec3);
     se_log_assert(to->name);
     se_log_assert(nsec3params);
+    se_log_assert(stats);
 
     orig_domain = domain->nsec3; /* use the back reference */
     if (DNS_SERIAL_GT(orig_domain->inbound_serial,
@@ -463,6 +469,7 @@
         }
         /* create new NSEC3 RR */
         if (!domain->nsec_rrset) {
+            se_log_debug("new nsec3");
             nsec_rr = ldns_rr_new();
             if (!nsec_rr) {
                 se_log_alert("failed to create NSEC3 rr");
@@ -509,6 +516,7 @@
                 se_log_alert("failed to create NSEC3 RRset");
                 return 1;
             }
+            stats->nsec_count += 1;
             domain->nsec_nxt_changed = 0;
             orig_domain->nsec_nxt_changed = 0;
             orig_domain->nsec_bitmap_changed = 0;
@@ -517,11 +525,16 @@
             se_log_assert(domain->nsec_rrset->rrs);
             se_log_assert(domain->nsec_rrset->rrs->rr);
             nsec_rr = domain->nsec_rrset->rrs->rr;
+            if (domain->nsec_nxt_changed || orig_domain->nsec_bitmap_changed) {
+                stats->nsec_count += 1;
+            }
+
             if (domain->nsec_nxt_changed) {
                 old_rdf = ldns_rr_set_rdf(nsec_rr, next_owner_rdf,
                     SE_NSEC3_RDATA_NXT);
                 if (!old_rdf) {
                     se_log_alert("failed to update NSEC3 next owner name");
+                    stats->nsec_count -= 1;
                     return 1;
                 }
                 domain->nsec_nxt_changed = 0;
@@ -532,6 +545,7 @@
                     LDNS_RR_TYPE_NSEC3), SE_NSEC3_RDATA_BITMAP);
                 if (!old_rdf) {
                     se_log_alert("failed to update NSEC3 bitmap");
+                    stats->nsec_count -= 1;
                     return 1;
                 }
                 orig_domain->nsec_bitmap_changed = 0;
@@ -551,7 +565,7 @@
  */
 int
 domain_sign(hsm_ctx_t* ctx, domain_type* domain, ldns_rdf* owner,
-    signconf_type* sc, time_t signtime, uint32_t serial)
+    signconf_type* sc, time_t signtime, uint32_t serial, stats_type* stats)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     ldns_rdf* soa_serial = NULL;
@@ -563,6 +577,7 @@
     se_log_assert(owner);
     se_log_assert(sc);
     se_log_assert(signtime);
+    se_log_assert(stats);
 
     if (domain->domain_status == DOMAIN_STATUS_OCCLUDED ||
         domain->domain_status == DOMAIN_STATUS_NONE) {
@@ -572,7 +587,7 @@
     if (sc->nsec_type == LDNS_RR_TYPE_NSEC3) {
         if (domain->nsec3 && domain->nsec3->nsec_rrset) {
             error = rrset_sign(ctx, domain->nsec3->nsec_rrset, owner, sc,
-                signtime, serial);
+                signtime, serial, stats);
             if (error) {
                 se_log_error("failed to sign NSEC3 RRset");
                 return error;
@@ -580,7 +595,7 @@
         }
     } else if (domain->nsec_rrset) {
         error = rrset_sign(ctx, domain->nsec_rrset, owner, sc, signtime,
-            serial);
+            serial, stats);
         if (error) {
             se_log_error("failed to sign NSEC RRset");
             return error;
@@ -616,7 +631,7 @@
             rrset->drop_signatures = 1;
         }
 
-        error = rrset_sign(ctx, rrset, owner, sc, signtime, serial);
+        error = rrset_sign(ctx, rrset, owner, sc, signtime, serial, stats);
         if (error) {
             se_log_error("failed to sign RRset[%i]", (int) rrset->rr_type);
             return error;

Modified: trunk/OpenDNSSEC/signer/src/signer/domain.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/domain.h	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/domain.h	2010-08-06 10:23:22 UTC (rev 3658)
@@ -39,6 +39,7 @@
 #include "signer/nsec3params.h"
 #include "signer/rrset.h"
 #include "signer/signconf.h"
+#include "signer/stats.h"
 
 #include <ldns/ldns.h>
 #include <time.h>
@@ -151,11 +152,12 @@
  * \param[in] to next domain
  * \param[in] ttl denial of existence ttl
  * \param[in] klass corresponding klass
+ * \param[out] stats update statistics
  * \return int 0 on success, 1 on error
  *
  */
 int domain_nsecify(domain_type* domain, domain_type* to, uint32_t ttl,
-    ldns_rr_class klass);
+    ldns_rr_class klass, stats_type* stats);
 
 /**
  * Add NSEC3 record to domain.
@@ -163,11 +165,12 @@
  * \param[in] to next domain
  * \param[in] ttl denial of existence ttl
  * \param[in] klass corresponding klass
+ * \param[out] stats update statistics
  * \return int 0 on success, 1 on error
  *
  */
 int domain_nsecify3(domain_type* domain, domain_type* to, uint32_t ttl,
-    ldns_rr_class klass, nsec3params_type* nsec3params);
+    ldns_rr_class klass, nsec3params_type* nsec3params, stats_type* stats);
 
 /**
  * Sign domain.
@@ -177,11 +180,12 @@
  * \param[in] sc sign configuration
  * \param[in] signtime time zone is being signed
  * \param[in] serial outbound serial
+ * \param[out] stats update statistics
  * \return int 0 on success, 1 on error
  *
  */
 int domain_sign(hsm_ctx_t* ctx, domain_type* domain, ldns_rdf* owner,
-    signconf_type* sc, time_t signtime, uint32_t serial);
+    signconf_type* sc, time_t signtime, uint32_t serial, stats_type* stats);
 
 /**
  * Add RR to domain.

Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-08-06 10:23:22 UTC (rev 3658)
@@ -53,6 +53,7 @@
     se_log_assert(rrtype);
     rrset->rr_type = rrtype;
     rrset->rr_count = 0;
+    rrset->rrsig_count = 0;
     rrset->inbound_serial = 0;
     rrset->outbound_serial = 0;
     rrset->rrs = ldns_dnssec_rrs_new();
@@ -75,6 +76,7 @@
     se_log_assert(rr);
     rrset->rr_type = ldns_rr_get_type(rr);
     rrset->rr_count = 1;
+    rrset->rrsig_count = 0;
     rrset->inbound_serial = 0;
     rrset->outbound_serial = 0;
     rrset->rrs = ldns_dnssec_rrs_new();
@@ -367,7 +369,8 @@
  *
  */
 static int
-rrset_drop_rrsigs(rrset_type* rrset, signconf_type* sc, time_t signtime)
+rrset_drop_rrsigs(rrset_type* rrset, signconf_type* sc, time_t signtime,
+    uint32_t* reusedsigs)
 {
     ldns_dnssec_rrs* rrs = NULL;
     ldns_dnssec_rrs* prev_rrs = NULL;
@@ -380,12 +383,13 @@
             ldns_dnssec_rrs_deep_free(rrset->rrsigs);
             rrset->rrsigs = NULL;
         }
+        rrset->rrsig_count = 0;
         rrset->drop_signatures = 0;
         return 0;
     }
 
     if (sc && sc->sig_refresh_interval) {
-        refresh = (uint32_t) (signtime + 
+        refresh = (uint32_t) (signtime +
             duration2time(sc->sig_refresh_interval));
     }
 
@@ -404,12 +408,14 @@
                 rrset->rrsigs = rrs->next;
             }
             rrset_log_rr(rrs->rr, "-RRSIG", 5);
+            rrset->rrsig_count -= 1;
             ldns_rr_free(rrs->rr);
             se_free((void*)rrs);
         } else {
             se_log_debug("keep signature for RRset[%i] (refresh=%u, "
                 "expiration=%u)", rrset->rr_type, refresh, expiration);
             rrset_log_rr(rrs->rr, "*RRSIG", 5);
+            *reusedsigs += 1;
         }
         prev_rrs = rrs;
         rrs = rrs->next;
@@ -482,9 +488,11 @@
  */
 int
 rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, ldns_rdf* owner,
-    signconf_type* sc, time_t signtime, uint32_t serial)
+    signconf_type* sc, time_t signtime, uint32_t serial, stats_type* stats)
 {
     int error = 0;
+    uint32_t newsigs = 0;
+    uint32_t reusedsigs = 0;
     ldns_status status = LDNS_STATUS_OK;
     ldns_rr* rrsig = NULL;
     ldns_rr_list* rr_list = NULL;
@@ -494,9 +502,10 @@
 
     se_log_assert(rrset);
     se_log_assert(sc);
+    se_log_assert(stats);
 
     if (DNS_SERIAL_GT(serial, rrset->outbound_serial)) {
-        error = rrset_drop_rrsigs(rrset, sc, signtime);
+        error = rrset_drop_rrsigs(rrset, sc, signtime, &reusedsigs);
         if (!rrset->rrsigs) {
             rrset->rrsigs = ldns_dnssec_rrs_new();
         }
@@ -528,6 +537,8 @@
                 if (!rrset->rrsigs->rr) {
                     rrset->rrsigs->rr = rrsig;
                     rrset_log_rr(rrsig, "+RRSIG", 5);
+                    rrset->rrsig_count += 1;
+                    newsigs++;
                 } else {
                     status = util_dnssec_rrs_add_rr(rrset->rrsigs, rrsig);
                     if (status != LDNS_STATUS_OK) {
@@ -545,6 +556,8 @@
                         }
                     } else {
                         rrset_log_rr(rrsig, "+RRSIG", 5);
+                        rrset->rrsig_count += 1;
+                        newsigs++;
                     }
                 }
                 key = key->next;
@@ -556,6 +569,9 @@
     } else {
         se_log_warning("not signing RRset[%i]: up to date", rrset->rr_type);
     }
+
+    stats->sig_count += newsigs;
+    stats->sig_reuse += reusedsigs;
     return 0;
 }
 

Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.h	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.h	2010-08-06 10:23:22 UTC (rev 3658)
@@ -37,13 +37,15 @@
 #include "config.h"
 #include "signer/hsm.h"
 #include "signer/signconf.h"
+#include "signer/stats.h"
 
 #include <ldns/ldns.h>
 
 typedef struct rrset_struct rrset_type;
 struct rrset_struct {
     ldns_rr_type rr_type;
-    int rr_count;
+    uint32_t rr_count;
+    uint32_t rrsig_count;
     uint32_t inbound_serial;
     uint32_t outbound_serial;
     ldns_dnssec_rrs* rrs;
@@ -104,11 +106,12 @@
  * \param[in] sc sign configuration
  * \param[in] signtime time when the zone is signd
  * \param[in] serial outbound serial
+ * \param[out] stats update statistics
  * \return 0 on success, 1 on error
  *
  */
 int rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, ldns_rdf* owner,
-    signconf_type* sc, time_t signtime, uint32_t serial);
+    signconf_type* sc, time_t signtime, uint32_t serial, stats_type* stats);
 
 /**
  * Delete all RRs from RRset.

Modified: trunk/OpenDNSSEC/signer/src/signer/tools.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/tools.c	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/tools.c	2010-08-06 10:23:22 UTC (rev 3658)
@@ -35,6 +35,7 @@
 #include "adapter/adapter.h"
 #include "daemon/engine.h"
 #include "scheduler/locks.h"
+#include "signer/stats.h"
 #include "signer/tools.h"
 #include "signer/zone.h"
 #include "util/file.h"
@@ -55,10 +56,18 @@
 {
     char* tmpname = NULL;
     int error = 0;
+    time_t start = 0;
+    time_t end = 0;
 
     se_log_assert(zone);
     se_log_assert(zone->inbound_adapter);
     se_log_assert(zone->signconf);
+    se_log_assert(zone->stats);
+
+    zone->stats->sort_count = 0;
+    zone->stats->sort_time = 0;
+    start = time(NULL);
+
     se_log_verbose("read zone %s", zone->name);
 
     /* make a copy (slooooooow, use system(cp) ?) */
@@ -77,6 +86,9 @@
             error = 1;
             break;
     }
+    end = time(NULL);
+    zone->stats->sort_time = (end-start);
+
     return error;
 }
 
@@ -116,11 +128,17 @@
 tools_nsecify(zone_type* zone)
 {
     int error = 0;
+    time_t start = 0;
+    time_t end = 0;
 
     se_log_assert(zone);
     se_log_assert(zone->signconf);
+    se_log_assert(zone->stats);
     se_log_verbose("nsecify zone %s", zone->name);
+    start = time(NULL);
     error = zone_nsecify(zone);
+    end = time(NULL);
+    zone->stats->nsec_time = (end-start);
     return error;
 }
 
@@ -132,10 +150,19 @@
 int
 tools_sign(zone_type* zone)
 {
+    int error = 0;
+    time_t start = 0;
+    time_t end = 0;
+
     se_log_assert(zone);
     se_log_assert(zone->signconf);
+    se_log_assert(zone->stats);
     se_log_verbose("sign zone %s", zone->name);
-    return zone_sign(zone);
+    start = time(NULL);
+    error = zone_sign(zone);
+    end = time(NULL);
+    zone->stats->sig_time = (end-start);
+    return error;
 }
 
 
@@ -194,7 +221,9 @@
     int error = 0;
 
     se_log_assert(zone);
+    se_log_assert(zone->signconf);
     se_log_assert(zone->outbound_adapter);
+    se_log_assert(zone->stats);
     se_log_verbose("write zone %s", zone->name);
 
     switch (zone->outbound_adapter->type) {
@@ -208,5 +237,11 @@
             error = 1;
             break;
     }
+
+    /* log stats */
+    se_log_debug("log stats for zone %s", zone->name);
+    stats_log(zone->stats, zone->name, zone->signconf->nsec_type);
+    stats_clear(zone->stats);
+
     return error;
 }

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-08-06 10:23:22 UTC (rev 3658)
@@ -77,6 +77,7 @@
     zone->tobe_removed = 0;
     zone->in_progress = 0;
     zone->zonedata = zonedata_create();
+    zone->stats = stats_create();
     lock_basic_init(&zone->zone_lock);
     return zone;
 }
@@ -348,7 +349,6 @@
     se_log_assert(zone);
     se_log_assert(zone->signconf);
     se_log_assert(zone->zonedata);
-
     return zonedata_update(zone->zonedata, zone->signconf);
 }
 
@@ -467,11 +467,18 @@
     int error = 0;
     FILE* fd = NULL;
     char* filename = NULL;
+    time_t start = 0;
+    time_t end = 0;
 
     se_log_assert(zone);
     se_log_assert(zone->signconf);
     se_log_assert(zone->zonedata);
+    se_log_assert(zone->stats);
 
+    zone->stats->nsec_count = 0;
+    zone->stats->nsec_time = 0;
+    start = time(NULL);
+
     /* add empty non-terminals */
     error = zonedata_entize(zone->zonedata, zone->dname);
     if (error) {
@@ -481,19 +488,22 @@
     }
 
     if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC) {
-        error = zonedata_nsecify(zone->zonedata, zone->klass);
+        error = zonedata_nsecify(zone->zonedata, zone->klass, zone->stats);
     } else if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3) {
         if (zone->signconf->nsec3_optout) {
             se_log_debug("OptOut is being used for zone %s", zone->name);
         }
         error = zonedata_nsecify3(zone->zonedata, zone->klass,
-            zone->nsec3params);
+            zone->nsec3params, zone->stats);
     } else {
         se_log_error("unknown RR type for denial of existence, %i",
             zone->signconf->nsec_type);
         error = 1;
     }
     if (!error) {
+        end = time(NULL);
+        zone->stats->nsec_time = (end-start);
+
         filename = se_build_path(zone->name, ".denial", 0);
         fd = se_fopen(filename, NULL, "w");
         if (fd) {
@@ -519,13 +529,25 @@
     int error = 0;
     FILE* fd = NULL;
     char* filename = NULL;
+    time_t start = 0;
+    time_t end = 0;
 
     se_log_assert(zone);
     se_log_assert(zone->signconf);
     se_log_assert(zone->zonedata);
+    se_log_assert(zone->stats);
 
-    error = zonedata_sign(zone->zonedata, zone->dname, zone->signconf);
+    zone->stats->sig_count = 0;
+    zone->stats->sig_reuse = 0;
+    zone->stats->sig_time = 0;
+    start = time(NULL);
+
+    error = zonedata_sign(zone->zonedata, zone->dname, zone->signconf,
+        zone->stats);
     if (!error) {
+        end = time(NULL);
+        zone->stats->sig_time = (end-start);
+
         filename = se_build_path(zone->name, ".rrsigs", 0);
         fd = se_fopen(filename, NULL, "w");
         if (fd) {
@@ -565,6 +587,10 @@
             signconf_cleanup(zone->signconf);
             zone->signconf = NULL;
         }
+        if (zone->stats) {
+            stats_cleanup(zone->stats);
+            zone->stats = NULL;
+        }
         if (zone->zonedata) {
             zonedata_cleanup(zone->zonedata);
             zone->zonedata = NULL;
@@ -573,8 +599,8 @@
             se_free((void*) zone->policy_name);
             zone->policy_name = NULL;
         }
-            se_free((void*) zone->signconf_filename);
-            se_free((void*) zone->name);
+        se_free((void*) zone->signconf_filename);
+        se_free((void*) zone->name);
 
         lock_basic_destroy(&zone->zone_lock);
         se_free((void*) zone);

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.h	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.h	2010-08-06 10:23:22 UTC (rev 3658)
@@ -39,6 +39,7 @@
 #include "scheduler/locks.h"
 #include "signer/nsec3params.h"
 #include "signer/signconf.h"
+#include "signer/stats.h"
 #include "signer/zonedata.h"
 
 #include <ldns/ldns.h>
@@ -67,6 +68,7 @@
     time_t backoff; /* backoff value if there is something failing */
     zonedata_type* zonedata; /* zone data */
     int in_progress; /* in progress (check with active worker?) */
+    stats_type* stats; /* statistics */
     /* for zonelist */
     int just_added;
     int just_updated;

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-08-06 10:23:22 UTC (rev 3658)
@@ -473,7 +473,7 @@
  *
  */
 int
-zonedata_nsecify(zonedata_type* zd, ldns_rr_class klass)
+zonedata_nsecify(zonedata_type* zd, ldns_rr_class klass, stats_type* stats)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     domain_type* domain = NULL, *to = NULL, *apex = NULL;
@@ -516,7 +516,7 @@
             }
         }
         /* ready to add the NSEC record */
-        if (domain_nsecify(domain, to, zd->default_ttl, klass) != 0) {
+        if (domain_nsecify(domain, to, zd->default_ttl, klass, stats) != 0) {
             se_log_error("adding NSECs to domain failed");
             return 1;
         }
@@ -531,7 +531,7 @@
  */
 int
 zonedata_nsecify3(zonedata_type* zd, ldns_rr_class klass,
-    nsec3params_type* nsec3params)
+    nsec3params_type* nsec3params, stats_type* stats)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     ldns_rbnode_t* nsec3_node = LDNS_RBTREE_NULL;
@@ -643,7 +643,7 @@
 
         /* ready to add the NSEC3 record */
         if (domain_nsecify3(domain, to, zd->default_ttl, klass,
-            nsec3params) != 0) {
+            nsec3params, stats) != 0) {
             se_log_error("adding NSEC3s to domain failed");
             return 1;
         }
@@ -726,7 +726,8 @@
  *
  */
 int
-zonedata_sign(zonedata_type* zd, ldns_rdf* owner, signconf_type* sc)
+zonedata_sign(zonedata_type* zd, ldns_rdf* owner, signconf_type* sc,
+    stats_type* stats)
 {
     ldns_rbnode_t* node = LDNS_RBTREE_NULL;
     domain_type* domain = NULL;
@@ -754,7 +755,7 @@
     node = ldns_rbtree_first(zd->domains);
     while (node && node != LDNS_RBTREE_NULL) {
         domain = (domain_type*) node->data;
-        if (domain_sign(ctx, domain, owner, sc, now, zd->outbound_serial)
+        if (domain_sign(ctx, domain, owner, sc, now, zd->outbound_serial, stats)
             != 0) {
             se_log_error("unable to sign zone data: failed to sign domain");
             hsm_destroy_context(ctx);

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.h	2010-08-06 10:04:25 UTC (rev 3657)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.h	2010-08-06 10:23:22 UTC (rev 3658)
@@ -37,6 +37,7 @@
 #include "config.h"
 #include "signer/domain.h"
 #include "signer/signconf.h"
+#include "signer/stats.h"
 
 #include <ldns/ldns.h>
 
@@ -103,31 +104,35 @@
  * Add NSEC records to zone data.
  * \param[in] zd zone data
  * \param[in] klass class of zone
+ * \param[out] stats update statistics
  * \return int 0 on success, 1 on false
  *
  */
-int zonedata_nsecify(zonedata_type* zd, ldns_rr_class klass);
+int zonedata_nsecify(zonedata_type* zd, ldns_rr_class klass, stats_type* stats);
 
 /**
  * Add NSEC3 records to zone data.
  * \param[in] zd zone data
  * \param[in] klass class of zone
  * \param[in] nsec3params NSEC3 paramaters
+ * \param[out] stats update statistics
  * \return int 0 on success, 1 on false
  *
  */
 int zonedata_nsecify3(zonedata_type* zd, ldns_rr_class klass,
-    nsec3params_type* nsec3params);
+    nsec3params_type* nsec3params, stats_type* stats);
 
 /**
  * Add RRSIG records to zone data.
  * \param[in] zd zone data
  * \param[in] owner zone owner
  * \param[in] sc signer configuration
+ * \param[out] stats update statistics
  * \return int 0 on success, 1 on false
  *
  */
-int zonedata_sign(zonedata_type* zd, ldns_rdf* owner, signconf_type* sc);
+int zonedata_sign(zonedata_type* zd, ldns_rdf* owner, signconf_type* sc,
+    stats_type* stats);
 
 /**
  * Update zone data with pending changes.




More information about the Opendnssec-commits mailing list