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

ICMP socket: split ICMPv4/v6 accept and process #887

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

thvdveld
Copy link
Contributor

@thvdveld thvdveld commented Jan 4, 2024

Splitting the accept and process functions of the ICMP socket into separate functions for IPv4 and IPv6 allows us to avoid the IpRepr enum and instead use the Ipv4Repr and Ipv6Repr structs directly.

This leads to a reduction in binary size:
example/server: 197.3KiB -> 195.9KiB
example/client: 198.0KiB -> 196.7KiB
example/sixlowpan: 194.7KiB -> 193.3KiB

Since the functions are only pub(crate), the impact is only internal.

Copy link

codecov bot commented Jan 4, 2024

Codecov Report

Attention: 26 lines in your changes are missing coverage. Please review.

Comparison is base (5ee728a) 79.75% compared to head (951b59b) 79.78%.

Files Patch % Lines
src/iface/packet.rs 0.00% 13 Missing ⚠️
src/socket/icmp.rs 92.59% 4 Missing ⚠️
src/iface/interface/ipv4.rs 62.50% 3 Missing ⚠️
src/iface/interface/ipv6.rs 84.21% 3 Missing ⚠️
src/wire/sixlowpan/nhc.rs 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
+ Coverage   79.75%   79.78%   +0.02%     
==========================================
  Files          80       80              
  Lines       28033    28053      +20     
==========================================
+ Hits        22358    22382      +24     
+ Misses       5675     5671       -4     

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

Splitting the accept and process functions into separate functions for
IPv4 and IPv6 allows us to avoid the `IpRepr` enum and instead use the
`Ipv4Repr` and `Ipv6Repr` structs directly. This reduces the binary size
by 1.5 KiB.
@thvdveld thvdveld added this pull request to the merge queue Jan 5, 2024
Merged via the queue into smoltcp-rs:main with commit dc895d4 Jan 5, 2024
11 checks passed
@thvdveld thvdveld deleted the icmp-split-v4-and-v6 branch January 5, 2024 13:33
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.

1 participant