Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socktap: fix packet size in TcpLink #206

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated packet size calculation
fysch committed Nov 15, 2023
commit 7c588a03d014cb648ef49a9bd7b4b3e71c4ede10
5 changes: 1 addition & 4 deletions tools/socktap/tcp_link.cpp
Original file line number Diff line number Diff line change
@@ -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);