From f5540a23082e5dcd506f41ff0e2ac4e7d7f6ef79 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 12 Apr 2019 22:26:16 +0700 Subject: dns: cache response with empty answer resource record As long as the response is OK (response code 0), we should accept response with no answer RR. One of the case is when query is AAAA and the domain does not have IPv6 address, it would response with empty answer with response code OK. --- lib/dns/answer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/answer.go b/lib/dns/answer.go index 80d1dbb8..64955d12 100644 --- a/lib/dns/answer.go +++ b/lib/dns/answer.go @@ -41,7 +41,7 @@ type answer struct { // to current timestamp. // func newAnswer(msg *Message, isLocal bool) (an *answer) { - if msg == nil || msg.Question == nil || len(msg.Answer) == 0 { + if msg == nil || msg.Question == nil { return nil } -- cgit v1.3