More heuristics to detect valid plain DNS responses

This commit is contained in:
Frank Denis 2025-01-11 15:29:49 +01:00
parent f332394c4b
commit 6dd22becac

View file

@ -620,7 +620,10 @@ func fetchDNSCryptServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp
&name, &name,
false, false,
) )
if err == nil { if err == nil && len(msg.Question) > 0 {
question := msg.Question[0]
if question.Qtype == query.Question[0].Qtype && strings.EqualFold(question.Name, query.Question[0].Name) {
dlog.Debugf("[%s] also serves plaintext DNS", name)
if msg.Id != 0xcafe { if msg.Id != 0xcafe {
dlog.Infof("[%s] handling of DNS message identifiers is broken", name) dlog.Infof("[%s] handling of DNS message identifiers is broken", name)
} }
@ -643,6 +646,7 @@ func fetchDNSCryptServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp
} }
} }
} }
}
return ServerInfo{ return ServerInfo{
Proto: stamps.StampProtoTypeDNSCrypt, Proto: stamps.StampProtoTypeDNSCrypt,