[client] Normalize DNS record names to lowercase in local handler update (#3323)

* [client] Normalize DNS record names to lowercase in lookup
This commit is contained in:
hakansa 2025-02-14 13:13:40 +03:00 committed by GitHub
parent c4a6dafd27
commit 039a985f41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package dns
import (
"fmt"
"strings"
"sync"
"github.com/miekg/dns"
@ -60,6 +61,7 @@ func (d *localResolver) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
func (d *localResolver) lookupRecord(r *dns.Msg) dns.RR {
question := r.Question[0]
question.Name = strings.ToLower(question.Name)
record, found := d.records.Load(buildRecordKey(question.Name, question.Qclass, question.Qtype))
if !found {
return nil

View File

@ -454,6 +454,7 @@ func (s *DefaultServer) buildLocalHandlerUpdate(customZones []nbdns.CustomZone)
if record.Class != nbdns.DefaultClass {
return nil, nil, fmt.Errorf("received an invalid class type: %s", record.Class)
}
key := buildRecordKey(record.Name, class, uint16(record.Type))
localRecords[key] = record
}