Skip to content

Commit

Permalink
Separate DNSSEC queries from normal queries in the cache (#322)
Browse files Browse the repository at this point in the history
* Separate DNSSEC queries from normal queries in the cache

* Update key generation for redis too
  • Loading branch information
folbricht authored Aug 23, 2023
1 parent 2be3fad commit 430b532
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cache-redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"

Expand Down Expand Up @@ -125,6 +126,8 @@ func (b *redisBackend) keyFromQuery(q *dns.Msg) string {

edns0 := q.IsEdns0()
if edns0 != nil {
key.WriteString(fmt.Sprintf("%t", edns0.Do()))
key.WriteByte(':')
// See if we have a subnet option
for _, opt := range edns0.Option {
if subnet, ok := opt.(*dns.EDNS0_SUBNET); ok {
Expand Down
2 changes: 2 additions & 0 deletions lru-cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type cacheItem struct {
type lruKey struct {
Question dns.Question
Net string
Do bool
}

type cacheAnswer struct {
Expand Down Expand Up @@ -210,6 +211,7 @@ func lruKeyFromQuery(q *dns.Msg) lruKey {

edns0 := q.IsEdns0()
if edns0 != nil {
key.Do = edns0.Do()
// See if we have a subnet option
for _, opt := range edns0.Option {
if subnet, ok := opt.(*dns.EDNS0_SUBNET); ok {
Expand Down

0 comments on commit 430b532

Please sign in to comment.