coredns plugin -- do not filter out non-FQDN's -- otherwise it breaks serving /etc/hosts

This commit is contained in:
Eugene Bujak 2018-09-11 17:57:20 +03:00
parent e2cf9ffd84
commit aa2e5500e7
1 changed files with 0 additions and 8 deletions

View File

@ -370,14 +370,6 @@ func (d *Plugin) serveDNSInternal(ctx context.Context, w dns.ResponseWriter, r *
} }
for _, question := range r.Question { for _, question := range r.Question {
host := strings.ToLower(strings.TrimSuffix(question.Name, ".")) host := strings.ToLower(strings.TrimSuffix(question.Name, "."))
// if input is empty host, filter it out right away
if index := strings.IndexByte(host, byte('.')); index == -1 {
rcode, err := writeNXdomain(ctx, w, r)
if err != nil {
return rcode, err, dnsfilter.Result{}
}
return rcode, err, dnsfilter.Result{Reason: dnsfilter.FilteredInvalid}
}
// is it a safesearch domain? // is it a safesearch domain?
if val, ok := d.d.SafeSearchDomain(host); ok { if val, ok := d.d.SafeSearchDomain(host); ok {
rcode, err := d.replaceHostWithValAndReply(ctx, w, r, host, val, question) rcode, err := d.replaceHostWithValAndReply(ctx, w, r, host, val, question)