request.Match check Response bit as well (#1775)

* request.Match check Response bit as well

We should check this bit and reject them as invalid.

* Fix test
This commit is contained in:
Miek Gieben
2018-05-09 12:35:42 +01:00
committed by GitHub
parent 68b45f5377
commit 0e5e59c327
4 changed files with 24 additions and 4 deletions

View File

@@ -380,6 +380,10 @@ func (r *Request) Match(reply *dns.Msg) bool {
return false
}
if reply.Response == false {
return false
}
if strings.ToLower(reply.Question[0].Name) != r.Name() {
return false
}

View File

@@ -162,6 +162,7 @@ func TestRequestScrubAnswerExact(t *testing.T) {
func TestRequestMatch(t *testing.T) {
st := testRequest()
reply := new(dns.Msg)
reply.Response = true
reply.SetQuestion("example.com.", dns.TypeMX)
if b := st.Match(reply); b {