summaryrefslogtreecommitdiffstats
path: root/tests/auto/network
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-08-15 17:57:17 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-08-28 20:09:41 -0700
commit19673b6cf949dce5d0cd8efa4ad6f91c9f26f06f (patch)
tree60607a629a143d9e7d60412ce1be28f4adc2a9bd /tests/auto/network
parentfd96e11bb1200902ff7ec2bbe6f3903b2d96bdd8 (diff)
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>
Diffstat (limited to 'tests/auto/network')
-rw-r--r--tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
index 60fd52936a..66d005b933 100644
--- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
+++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
@@ -545,7 +545,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