request/cache: bind responses and entries to QCLASS (#8272)

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
This commit is contained in:
houyuwushang
2026-07-11 06:18:27 +08:00
committed by GitHub
parent 2d42f0e8f5
commit 6ec70a0603
8 changed files with 89 additions and 12 deletions

View File

@@ -340,8 +340,8 @@ func (r *Request) Clear() {
r.do = false
}
// Match checks if the reply matches the qname and qtype from the request, it returns
// false when they don't match.
// Match checks if the reply matches the qname, qtype and qclass from the request.
// It returns false when they don't match.
func (r *Request) Match(reply *dns.Msg) bool {
if len(reply.Question) != 1 {
return false
@@ -359,5 +359,9 @@ func (r *Request) Match(reply *dns.Msg) bool {
return false
}
if reply.Question[0].Qclass != r.QClass() {
return false
}
return true
}