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

Ipv6 source address selection based on RFC 6724 #864

Merged
merged 5 commits into from
Dec 4, 2023

Conversation

thvdveld
Copy link
Contributor

@thvdveld thvdveld commented Dec 1, 2023

Instead of selecting the first address in the interface list of addresses, RFC 6724 is used for selecting the source IPv6 address based on the destination address.

The functions get_source_address, get_source_address_ipv4 and get_source_address_ipv6 had a mutable reference to self. However, this seemed not necessary. I made the reference immutable, but maybe someone knows why this was mutable?

The scope of an address is used when selecting the source IPv6 address
based on the destination address. As the scope is then also used for
unicast address, I made the scope only public in the crate instead of
outside the crate. Not sure if this should be public or not.

This commit also adds the `is_global_unicast` query function for IPv6
addresses.
RFC6724 defines how the source address should be selected when given a
destination address. Instead of selecting the first address in the list
of interface addresses, the source address is selected following the
standard.
@thvdveld thvdveld force-pushed the ipv6-source-address-selection branch from fe3beb0 to dd9eff7 Compare December 1, 2023 10:18
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

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

Comparison is base (9624adf) 79.53% compared to head (36a143d) 79.62%.

❗ Current head 36a143d differs from pull request most recent head 434f7eb. Consider uploading reports for the commit 434f7eb to get more accurate results

Files Patch % Lines
src/iface/interface/mod.rs 88.88% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
+ Coverage   79.53%   79.62%   +0.08%     
==========================================
  Files          78       78              
  Lines       27887    28043     +156     
==========================================
+ Hits        22181    22329     +148     
- Misses       5706     5714       +8     

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

@thvdveld thvdveld force-pushed the ipv6-source-address-selection branch from 6c730bc to 434f7eb Compare December 4, 2023 16:58
@thvdveld thvdveld added this pull request to the merge queue Dec 4, 2023
Merged via the queue into smoltcp-rs:main with commit f0d1c37 Dec 4, 2023
9 checks passed
@thvdveld thvdveld deleted the ipv6-source-address-selection branch December 4, 2023 17:12
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