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

@@ -310,6 +310,11 @@ func TestRequestMatch(t *testing.T) {
t.Errorf("Failed to match %s %d, got %t, expected %t", "example.com.", dns.TypeA, b, true)
}
reply.Question[0].Qclass = dns.ClassCHAOS
if b := st.Match(reply); b {
t.Errorf("Matched response class %d with request class %d", reply.Question[0].Qclass, st.QClass())
}
reply.SetQuestion("example.org.", dns.TypeA)
if b := st.Match(reply); b {
t.Errorf("Failed to match %s %d, got %t, expected %t", "example.org.", dns.TypeA, b, false)