From c91475d416e2702f8a94f51d90c9d263cb43f64e Mon Sep 17 00:00:00 2001 From: Srivats P Date: Thu, 13 Apr 2023 18:10:43 +0530 Subject: [PATCH] Use qFrom/ToBigEndian instead of ntohs/htons For consistency with rest of the code --- server/pcaptxthread.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/pcaptxthread.cpp b/server/pcaptxthread.cpp index 340fda5..e219385 100644 --- a/server/pcaptxthread.cpp +++ b/server/pcaptxthread.cpp @@ -448,7 +448,7 @@ int PcapTxThread::sendQueueTransmit(pcap_t *p, PacketSequence *seq, if (seq->ttagL4CksumOffset_) { quint16 *cksum = reinterpret_cast( pkt + seq->ttagL4CksumOffset_); - origCksum = ntohs(*cksum); + origCksum = qFromBigEndian(*cksum); // XXX: SignProtocol trailer // ... | | 0x61 | 0x00 | 0x22 | 0x1d10c0da // ... | | 0x61 | | 0x23 | 0x1d10c0da @@ -464,7 +464,7 @@ int PcapTxThread::sendQueueTransmit(pcap_t *p, PacketSequence *seq, // XXX: For IPv4/UDP, if ~newcksum is 0x0000 we are supposed to // set the checksum as 0xffff since 0x0000 indicates no cksum // is present - we choose not to do this to avoid extra cost - *cksum = htons(~newCksum); + *cksum = qToBigEndian(quint16(~newCksum)); } ttagId_++; } @@ -500,7 +500,7 @@ int PcapTxThread::sendQueueTransmit(pcap_t *p, PacketSequence *seq, if (seq->ttagL4CksumOffset_) { quint16 *cksum = reinterpret_cast( pkt + seq->ttagL4CksumOffset_); - *cksum = htons(origCksum); + *cksum = qToBigEndian(origCksum); } }