aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Zheng Xie <xiez1989@gmail.com> 2020-01-03 21:26:53 +0800
committerGravatar Miek Gieben <miek@miek.nl> 2020-01-03 14:26:53 +0100
commitf81f28d97b3987b07f53847ee63097ac05d518b9 (patch)
tree692e2bcdc5e5b1bebdb7694d5f92be8412388931
parente3266d24f7a3a120739875ff421d2d47d044ad69 (diff)
downloadcoredns-f81f28d97b3987b07f53847ee63097ac05d518b9.tar.gz
coredns-f81f28d97b3987b07f53847ee63097ac05d518b9.tar.zst
coredns-f81f28d97b3987b07f53847ee63097ac05d518b9.zip
plugin/cache: update comment to conform to the implementation (#3573)
Signed-off-by: zheng xie <xiez1989@gmail.com>
-rw-r--r--plugin/cache/item.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin/cache/item.go b/plugin/cache/item.go
index 3071f1512..e3da5bb14 100644
--- a/plugin/cache/item.go
+++ b/plugin/cache/item.go
@@ -49,7 +49,12 @@ func newItem(m *dns.Msg, now time.Time, d time.Duration) *item {
}
// toMsg turns i into a message, it tailors the reply to m.
-// The Authoritative bit is always set to 0, because the answer is from the cache.
+// The Authoritative bit should be set to 0, but some client stub resolver implementations, most notably,
+// on some legacy systems(e.g. ubuntu 14.04 with glib version 2.20), low-level glibc function `getaddrinfo`
+// useb by Python/Ruby/etc.. will discard answers that do not have this bit set.
+// So we're forced to always set this to 1; regardless if the answer came from the cache or not.
+// On newer systems(e.g. ubuntu 16.04 with glib version 2.23), this issue is resolved.
+// So we may set this bit back to 0 in the future ?
func (i *item) toMsg(m *dns.Msg, now time.Time) *dns.Msg {
m1 := new(dns.Msg)
m1.SetReply(m)