fix(netxlite): ensure we only accept DNS responses (#735)

Previously, the DNS decoder did not check whether it was parsing
a DNS query or a DNS response, which was wrong.

As a side note, it seems I am using "reply" in the codebase instead
of "response". The latter seems correct DNS terminology.

This diff has been extracted from https://github.com/bassosimone/websteps-illustrated/commit/9249d14f80b4c685234da8e344b36c8904ee69e9

See https://github.com/ooni/probe/issues/2096.
This commit is contained in:
Simone Basso
2022-05-16 11:17:30 +02:00
committed by GitHub
parent ce052b665e
commit 7c45f7b88c
3 changed files with 66 additions and 7 deletions
+3
View File
@@ -60,6 +60,9 @@ type DNSDecoder interface {
//
// - data is the raw reply
//
// This function fails if we cannot parse data as a DNS
// message or the message is not a reply.
//
// If you use this function, remember that:
//
// 1. the Rcode MAY be nonzero;