mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-26 19:22:08 +00:00
tsdns: lowercase the name in parseQuery.
Domains in DNS should be case-insensitive. Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
This commit is contained in:
@@ -293,6 +293,14 @@ func (r *Resolver) parseQuery(query []byte, resp *response) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Lowercase the name: DOMAIN.COM. should resolve the same as domain.com.
|
||||
name := resp.Question.Name.Data[:resp.Question.Name.Length]
|
||||
for i, b := range name {
|
||||
if 'A' <= b && b <= 'Z' {
|
||||
name[i] = b - 'A' + 'a'
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user