Skip to content

Commit

Permalink
Merge pull request #49 from Yannik/patch-1
Browse files Browse the repository at this point in the history
return cname if requested RR was not found and cname exists (fixes #48)
  • Loading branch information
joohoi committed Mar 13, 2018
2 parents 9a908d7 + 4d214d7 commit 978ac5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ func answer(q dns.Question) ([]dns.RR, int, error) {
var rtype = q.Qtype
r, ok := RR.Records[rtype][domain]
if !ok {
rcode = dns.RcodeNameError
r, ok = RR.Records[dns.TypeCNAME][domain]
if !ok {
rcode = dns.RcodeNameError
}

}
log.WithFields(log.Fields{"qtype": dns.TypeToString[rtype], "domain": domain, "rcode": dns.RcodeToString[rcode]}).Debug("Answering question for domain")
return r, rcode, nil
Expand Down

0 comments on commit 978ac5d

Please sign in to comment.