QDnsLookup/Unix: do skip DNS records that aren't of class IN

There's nothing saying the server can't supply those to us, so let's
explicitly skip them. The Windows version already does this because the
windns.h API only supports records of class IN.

Test for this after setNameserverPort() is added.

Pick-to: 6.5
Change-Id: I3e3bfef633af4130a03afffd175e6ddc756c91c5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Thiago Macieira 2023-05-12 08:08:24 -07:00
parent c113a7a796
commit 25869c0aad
1 changed files with 3 additions and 0 deletions

View File

@ -218,6 +218,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
}
const quint16 type = (p[0] << 8) | p[1];
p += 2; // RR type
const qint16 rrclass = (p[0] << 8) | p[1];
p += 2; // RR class
const quint32 ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
p += 4;
@ -225,6 +226,8 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
p += 2;
if ((p - response) + size > responseLength)
return; // truncated
if (rrclass != C_IN)
continue;
if (type == QDnsLookup::A) {
if (size != 4) {