tst_qdnslookup: fix the location of the opcode in the header
We were reading the wrong byte with the wrong shift count. 4.1.1. Header section format The header contains the following fields: 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RCODE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | QDCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ANCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | NSCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ARCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ This diagram is big-endian, so bit 0 is the MSB. Change-Id: I964c2b1e6b834feb9710fffd177bb72110bb77e7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 19673b6cf949dce5d0cd8efa4ad6f91c9f26f06f) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a93a41fcd1
commit
3c5841ace3
@ -542,7 +542,7 @@ void tst_QDnsLookup::setNameserverLoopback()
|
||||
QByteArray data = dgram.data();
|
||||
QCOMPARE_GT(data.size(), HeaderSize);
|
||||
|
||||
quint8 opcode = (quint8(data.at(3)) >> 4) & 0xF;
|
||||
quint8 opcode = (quint8(data.at(2)) >> 3) & 0xF;
|
||||
QCOMPARE(opcode, 0); // standard query
|
||||
|
||||
// send an NXDOMAIN reply to release the lookup thread
|
||||
|
Loading…
x
Reference in New Issue
Block a user