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

fix(tcpdump): partial checksum #1015

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thvdveld
Copy link
Contributor

In some cases, the checksum calculation is offloaded to hardware and only the partial checksum is calculated (only the pseudo-header). The tcpdump example was not taking this into account and was flagging some packets with incorrect checksums.

src/wire/ip.rs Outdated
let partially_valid = udp_packet
.verify_partial_checksum(&repr.src_addr(), &repr.dst_addr());

format_checksum(f, valid || partially_valid)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer different formatting for valid vs partially valid checksum, since this is a diagnostic interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified the message when the partial checksum is correct.

In some cases, the checksum calculation is offloaded to hardware and
only the partial checksum is calculated (only the pseudo-header). The
tcpdump example was not taking this into account and was flagging some
packets with incorrect checksums.
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 45.71429% with 19 lines in your changes missing coverage. Please review.

Project coverage is 80.77%. Comparing base (33bf798) to head (dff1c20).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/wire/tcp.rs 0.00% 10 Missing ⚠️
src/wire/ip.rs 56.25% 7 Missing ⚠️
src/wire/ipv4.rs 0.00% 1 Missing ⚠️
src/wire/udp.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1015      +/-   ##
==========================================
+ Coverage   80.75%   80.77%   +0.01%     
==========================================
  Files          81       81              
  Lines       28340    28415      +75     
==========================================
+ Hits        22887    22953      +66     
- Misses       5453     5462       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants