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

Conversation

fysch
Copy link
Contributor

@fysch fysch commented Nov 8, 2023

When the router forwards a packet, the packet is duplicated and therefore a link layer is already present.
In this case, the packet-size calculation would count the link layer twice.

@@ -31,6 +31,9 @@ void TcpLink::request(const access::DataRequest& request, std::unique_ptr<ChunkP

// insert packet size before ethernet header
uint16_t packet_size = packet->size() + EthernetHeader::length_bytes;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fix should be replacing packet->size() by packet->size(OsiLayer::Network, OsiLayer::Application).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is a more elegant solution. I didn't know about this function.

@riebl
Copy link
Owner

riebl commented Nov 16, 2023

Thanks, I have squashed your PR and merged it per 711e424.

@riebl riebl closed this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants