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 the error of specific length IP packets not being fragmented #1008

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

Jc0x7D3
Copy link
Contributor

@Jc0x7D3 Jc0x7D3 commented Nov 2, 2024

There is an obvious mistake at src/iface/interface/mod.rs:1204: total_ip_len represents the length of the IP packet, while self.caps.max_transmission_unit is the max length of link-layer packets. The correct comparison should be with self.caps.ip_mtu().

When using Medium Ethernet, since self.caps.max_transmission_unit is 14 octets larger than self.caps.ip_mtu(), IP packets with length of 1501~1514 octets should be fragmented, but mistakenly entered the non-fragment branch.

Additionally, I added a test case sending IPv4 packets of different lengths, which can trigger this error.

Copy link

codecov bot commented Nov 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.69%. Comparing base (336e7e5) to head (aba9add).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1008      +/-   ##
==========================================
- Coverage   80.73%   80.69%   -0.05%     
==========================================
  Files          81       81              
  Lines       28335    28256      -79     
==========================================
- Hits        22877    22801      -76     
+ Misses       5458     5455       -3     

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

Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

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

thanks!

@Dirbaio Dirbaio added this pull request to the merge queue Nov 2, 2024
Merged via the queue into smoltcp-rs:main with commit 3e61c90 Nov 2, 2024
15 checks passed
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