ipn: delete domainsForProxying, require explicit DNS search domains (mapver 9) (#1078)
Previously the client had heuristics to calculate which DNS search domains to set, based on the peers' names. Unfortunately that prevented us from doing some things we wanted to do server-side related to node sharing. So, bump MapRequest.Version to 9 to signal that the client only uses the explicitly configured DNS search domains and doesn't augment it with its own list. Updates tailscale/corp#1026 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
+11
-2
@@ -194,8 +194,8 @@ func (r *Resolver) Resolve(domain string, tp dns.Type) (netaddr.IP, dns.RCode, e
|
||||
}
|
||||
|
||||
anyHasSuffix := false
|
||||
for _, rootDomain := range dnsMap.rootDomains {
|
||||
if strings.HasSuffix(domain, rootDomain) {
|
||||
for _, suffix := range dnsMap.rootDomains {
|
||||
if NameHasSuffix(domain, suffix) {
|
||||
anyHasSuffix = true
|
||||
break
|
||||
}
|
||||
@@ -611,3 +611,12 @@ func (r *Resolver) respond(query []byte) ([]byte, error) {
|
||||
|
||||
return marshalResponse(resp)
|
||||
}
|
||||
|
||||
// NameHasSuffix reports whether the provided DNS name ends with the
|
||||
// component(s) in suffix, ignoring any trailing dots.
|
||||
func NameHasSuffix(name, suffix string) bool {
|
||||
name = strings.TrimSuffix(name, ".")
|
||||
suffix = strings.TrimSuffix(suffix, ".")
|
||||
nameBase := strings.TrimSuffix(name, suffix)
|
||||
return len(nameBase) < len(name) && strings.HasSuffix(nameBase, ".")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user