Skip to content

Commit 8fb6266

Browse files
authored
avoid returning stale ServFail response
Close AdguardTeam#436. Signed-off-by: Jay <[email protected]>
1 parent 1177916 commit 8fb6266

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

proxy/cache.go

+6
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ func (c *cache) unpackItem(data []byte, req *dns.Msg) (ci *cacheItem, expired bo
141141
return nil, expired
142142
}
143143

144+
// Don't return expired ServFail response from cache, otherwise it may stop
145+
// future refresh.
146+
if m.Rcode == dns.RcodeServerFailure && expired {
147+
return nil, expired
148+
}
149+
144150
res := (&dns.Msg{}).SetRcode(req, m.Rcode)
145151
res.AuthenticatedData = m.AuthenticatedData
146152
res.RecursionAvailable = m.RecursionAvailable

0 commit comments

Comments
 (0)