Skip to content

Commit

Permalink
Merge b6c866e into backport/fix_altdomain_dcname_overlap/loudly-defin…
Browse files Browse the repository at this point in the history
…ite-dingo
  • Loading branch information
hc-github-team-consul-core authored Jun 26, 2023
2 parents b7e0eb5 + b6c866e commit 85a7888
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions agent/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,14 +1048,14 @@ func (d *DNSServer) dispatch(remoteAddr net.Addr, req, resp *dns.Msg, maxRecursi
}

func (d *DNSServer) trimDomain(query string) string {
longer := "." + strings.TrimLeft(d.domain, ".")
shorter := "." + strings.TrimLeft(d.altDomain, ".")
longer := d.domain
shorter := d.altDomain

if len(shorter) > len(longer) {
longer, shorter = shorter, longer
}

if strings.HasSuffix(query, longer) {
if strings.HasSuffix(query, "."+strings.TrimLeft(longer, ".")) {
return strings.TrimSuffix(query, longer)
}
return strings.TrimSuffix(query, shorter)
Expand Down

0 comments on commit 85a7888

Please sign in to comment.