From baeacd947723cb8a68ce4112bf40099907e4cdbc Mon Sep 17 00:00:00 2001 From: Takumi Akiyama Date: Wed, 4 Dec 2024 03:31:29 +0900 Subject: [PATCH] workaround for dns-0x20 again --- singularity.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/singularity.go b/singularity.go index 94c4fb5..952d739 100644 --- a/singularity.go +++ b/singularity.go @@ -117,8 +117,6 @@ type DNSQuery struct { func NewDNSQuery(qname string) (*DNSQuery, error) { name := new(DNSQuery) - qname = strings.ToLower(qname) // DNS-0x20 work-around - qname = strings.Replace(qname, "--", "_", -1) split := strings.Split(qname, "-e.") @@ -292,7 +290,9 @@ func MakeRebindDNSHandler(appConfig *AppConfig, dcss *DNSClientStateStore) dns.H case dns.TypeA: log.Printf("DNS: Received A query: %v from: %v\n", q.Name, w.RemoteAddr().String()) - if !strings.HasPrefix(q.Name, "s-") { + qnameLower := strings.ToLower(q.Name) + + if !strings.HasPrefix(qnameLower, "s-") { // Handling query with potential QNAME minimization @@ -320,7 +320,7 @@ func MakeRebindDNSHandler(appConfig *AppConfig, dcss *DNSClientStateStore) dns.H clientState.ResponseReboundIPAddrtimeOut = appConfig.ResponseReboundIPAddrtimeOut var err error - name, err = NewDNSQuery(q.Name) + name, err = NewDNSQuery(qnameLower) if err != nil { log.Printf("DNS: Parsing of query failed: %v, with error: %v\n", name, err)