summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2024-12-19 10:06:37 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2024-12-19 10:06:37 +0100
commit54189871e3cf524556b607710c45a850c531d5cb (patch)
treea3a71efe216f99c246905ce234830f65795546e7 /src
parentmod-dnstap: distinguish between AUTH and UPDATE query/response (diff)
parentmax_ttl: in case of RRSIG consider orig_ttl and NOT rrsig->ttl (diff)
downloadknot-54189871e3cf524556b607710c45a850c531d5cb.tar.xz
knot-54189871e3cf524556b607710c45a850c531d5cb.zip
Merge branch 'max_ttl_rrsig' into 'master'
Max TTL of RRSIG See merge request knot/knot-dns!1733
Diffstat (limited to 'src')
-rw-r--r--src/knot/zone/measure.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/knot/zone/measure.c b/src/knot/zone/measure.c
index 4c3ab5e76..9a09e27ca 100644
--- a/src/knot/zone/measure.c
+++ b/src/knot/zone/measure.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,6 +31,21 @@ measure_t knot_measure_init(bool measure_whole, bool measure_diff)
return m;
}
+static uint32_t rrset_max_ttl(const struct rr_data *r)
+{
+ if (r->type != KNOT_RRTYPE_RRSIG) {
+ return r->ttl;
+ }
+
+ uint32_t res = 0;
+ knot_rdata_t *rd = r->rrs.rdata;
+ for (int i = 0; i < r->rrs.count; i++) {
+ res = MAX(res, knot_rrsig_original_ttl(rd));
+ rd = knot_rdataset_next(rd);
+ }
+ return res;
+}
+
bool knot_measure_node(zone_node_t *node, measure_t *m)
{
if (m->how_size == MEASURE_SIZE_NONE && (m->how_ttl == MEASURE_TTL_NONE ||
@@ -45,7 +60,7 @@ bool knot_measure_node(zone_node_t *node, measure_t *m)
m->zone_size += knot_rrset_size(&rrset);
}
if (m->how_ttl != MEASURE_TTL_NONE) {
- m->max_ttl = MAX(m->max_ttl, node->rrs[i].ttl);
+ m->max_ttl = MAX(m->max_ttl, rrset_max_ttl(&node->rrs[i]));
}
}
@@ -61,7 +76,7 @@ bool knot_measure_node(zone_node_t *node, measure_t *m)
m->zone_size -= knot_rrset_size(&rrset);
}
if (m->how_ttl == MEASURE_TTL_DIFF) {
- m->rem_max_ttl = MAX(m->rem_max_ttl, node->rrs[i].ttl);
+ m->rem_max_ttl = MAX(m->rem_max_ttl, rrset_max_ttl(&node->rrs[i]));
}
}