From 7c588a03d014cb648ef49a9bd7b4b3e71c4ede10 Mon Sep 17 00:00:00 2001 From: Fynn Schulze Date: Wed, 15 Nov 2023 16:10:29 +0100 Subject: [PATCH] updated packet size calculation --- tools/socktap/tcp_link.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/socktap/tcp_link.cpp b/tools/socktap/tcp_link.cpp index 81ecc9ace..2323795a8 100644 --- a/tools/socktap/tcp_link.cpp +++ b/tools/socktap/tcp_link.cpp @@ -30,10 +30,7 @@ void TcpLink::request(const access::DataRequest& request, std::unique_ptrsize() + EthernetHeader::length_bytes; - if (packet->layer(OsiLayer::Link).size() != 0) { - packet_size -= packet->layer(OsiLayer::Link).size(); - } + uint16_t packet_size = packet->size(OsiLayer::Network, OsiLayer::Application) + EthernetHeader::length_bytes; buffer.insert(buffer.begin(), packet_size & 0x00FF); buffer.insert(buffer.begin(), (packet_size & 0xFF00) >> 8);