Skip to content

Commit

Permalink
updated packet size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
fysch committed Nov 15, 2023
1 parent b2ebf8c commit 7c588a0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tools/socktap/tcp_link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ void TcpLink::request(const access::DataRequest& request, std::unique_ptr<ChunkP
vanetza::ByteBuffer buffer = create_ethernet_header(request.destination_addr, request.source_addr, request.ether_type);

// insert packet size before ethernet header
uint16_t packet_size = packet->size() + 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);

Expand Down

0 comments on commit 7c588a0

Please sign in to comment.