aboutsummaryrefslogtreecommitdiff
path: root/plugin/dnssec
diff options
context:
space:
mode:
authorGravatar Francois Tur <ftur@infoblox.com> 2018-08-31 17:26:43 -0400
committerGravatar Yong Tang <yong.tang.github@outlook.com> 2018-08-31 14:26:43 -0700
commit4c6c9d4b2700c3e4606d4b98bde64e7c1ed0c231 (patch)
tree628c776c0d6e7211b7e648a99303115e0f1f1a72 /plugin/dnssec
parentd00e8c39183b0385324bc7ea56a3f2aeb6918748 (diff)
downloadcoredns-4c6c9d4b2700c3e4606d4b98bde64e7c1ed0c231.tar.gz
coredns-4c6c9d4b2700c3e4606d4b98bde64e7c1ed0c231.tar.zst
coredns-4c6c9d4b2700c3e4606d4b98bde64e7c1ed0c231.zip
Move cache Keys to 64bit for a better dispersion and lower collision frequency (#2077)
* - change Key for cache to 64bits. * - change Key for cache to 64bits.
Diffstat (limited to 'plugin/dnssec')
-rw-r--r--plugin/dnssec/cache.go6
-rw-r--r--plugin/dnssec/dnssec.go4
2 files changed, 5 insertions, 5 deletions
diff --git a/plugin/dnssec/cache.go b/plugin/dnssec/cache.go
index ea95b73b4..e1f503703 100644
--- a/plugin/dnssec/cache.go
+++ b/plugin/dnssec/cache.go
@@ -7,8 +7,8 @@ import (
)
// hash serializes the RRset and return a signature cache key.
-func hash(rrs []dns.RR) uint32 {
- h := fnv.New32()
+func hash(rrs []dns.RR) uint64 {
+ h := fnv.New64()
buf := make([]byte, 256)
for _, r := range rrs {
off, err := dns.PackRR(r, buf, 0, nil, false)
@@ -17,6 +17,6 @@ func hash(rrs []dns.RR) uint32 {
}
}
- i := h.Sum32()
+ i := h.Sum64()
return i
}
diff --git a/plugin/dnssec/dnssec.go b/plugin/dnssec/dnssec.go
index 1ebcb13af..68b9eb52d 100644
--- a/plugin/dnssec/dnssec.go
+++ b/plugin/dnssec/dnssec.go
@@ -110,9 +110,9 @@ func (d Dnssec) sign(rrs []dns.RR, signerName string, ttl, incep, expir uint32,
return sigs.([]dns.RR), err
}
-func (d Dnssec) set(key uint32, sigs []dns.RR) { d.cache.Add(key, sigs) }
+func (d Dnssec) set(key uint64, sigs []dns.RR) { d.cache.Add(key, sigs) }
-func (d Dnssec) get(key uint32, server string) ([]dns.RR, bool) {
+func (d Dnssec) get(key uint64, server string) ([]dns.RR, bool) {
if s, ok := d.cache.Get(key); ok {
// we sign for 8 days, check if a signature in the cache reached 3/4 of that
is75 := time.Now().UTC().Add(sixDays)