Key tags are not unique across algorithms.
*/
void
-dns_dnssecsignstats_increment(dns_stats_t *stats, dns_keytag_t id,
+dns_dnssecsignstats_increment(dns_stats_t *stats, dns_keytag_t id, uint8_t alg,
bool refresh);
/*%<
* Increment the statistics counter for the DNSKEY 'id'. If 'refresh' is set
/* Maximum number of keys to keep track of for DNSSEC signing statistics. */
static int dnssec_max_keys = 4;
-/* Attribute to signal whether a counter is actually a key id. */
-#define DNSSECSIGNSTATS_IS_KEY 0x10000
+/* Key id mask */
+#define DNSSECSIGNSTATS_KEY_ID_MASK 0x0000FFFF
/* DNSSEC sign operation (sign or refresh) */
#define DNSSECSIGNSTATS_SIGN 1
#define DNSSECSIGNSTATS_REFRESH 2
}
void
-dns_dnssecsignstats_increment(dns_stats_t *stats, dns_keytag_t id,
+dns_dnssecsignstats_increment(dns_stats_t *stats, dns_keytag_t id, uint8_t alg,
bool refresh) {
isc_statscounter_t operation = DNSSECSIGNSTATS_SIGN;
uint32_t kval;
REQUIRE(DNS_STATS_VALID(stats) && stats->type == dns_statstype_dnssec);
- kval = (uint32_t)id;
- kval |= DNSSECSIGNSTATS_IS_KEY;
+ /* Shift algorithm in front of key tag, which is 16 bits */
+ kval = (uint32_t)(alg << 16 | id);
/* What operation are we counting? */
if (refresh) {
continue;
}
- id = (dns_keytag_t)kval;
- id &= ~DNSSECSIGNSTATS_IS_KEY;
+ id = (dns_keytag_t)kval & DNSSECSIGNSTATS_KEY_ID_MASK;
dump_fn((isc_statscounter_t)id, val, arg);
}
#define REVOKE(x) ((dst_key_flags(x) & DNS_KEYFLAG_REVOKE) != 0)
#define KSK(x) ((dst_key_flags(x) & DNS_KEYFLAG_KSK) != 0)
+#define ID(x) dst_key_id(x)
#define ALG(x) dst_key_alg(x)
/*
/* Update DNSSEC sign statistics. */
if (dnssecsignstats != NULL) {
dns_dnssecsignstats_increment(
- dnssecsignstats, dst_key_id(keys[i]), false);
+ dnssecsignstats, ID(keys[i]),
+ (uint8_t)ALG(keys[i]), false);
}
}
if (!added_sig) {
*/
#define REVOKE(x) ((dst_key_flags(x) & DNS_KEYFLAG_REVOKE) != 0)
#define KSK(x) ((dst_key_flags(x) & DNS_KEYFLAG_KSK) != 0)
+#define ID(x) dst_key_id(x)
#define ALG(x) dst_key_alg(x)
/*
if (dnssecsignstats != NULL) {
/* Generated a new signature. */
dns_dnssecsignstats_increment(
- dnssecsignstats, dst_key_id(keys[i]), false);
+ dnssecsignstats, ID(keys[i]),
+ (uint8_t)ALG(keys[i]), false);
/* This is a refresh. */
dns_dnssecsignstats_increment(
- dnssecsignstats, dst_key_id(keys[i]), true);
+ dnssecsignstats, ID(keys[i]),
+ (uint8_t)ALG(keys[i]), true);
}
}
dnssecsignstats = dns_zone_getdnssecsignstats(zone);
if (dnssecsignstats != NULL) {
/* Generated a new signature. */
- dns_dnssecsignstats_increment(dnssecsignstats,
- dst_key_id(key), false);
+ dns_dnssecsignstats_increment(dnssecsignstats, ID(key),
+ ALG(key), false);
/* This is a refresh. */
- dns_dnssecsignstats_increment(dnssecsignstats,
- dst_key_id(key), true);
+ dns_dnssecsignstats_increment(dnssecsignstats, ID(key),
+ ALG(key), true);
}
(*signatures)--;