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

Add Ipv6Addr::is_ipv4_mapped #86490

Closed
wants to merge 1 commit into from
Closed

Conversation

CDirkx
Copy link
Contributor

@CDirkx CDirkx commented Jun 20, 2021

This PR adds the unstable method Ipv6Addr::is_ipv4_mapped, as I proposed a while ago #76098 (comment). It allows for making decisions based on if an address is IPv4-mapped (see also the IPv4-in-IPv6 Address Support issue #85609). I also intend to use this method in a future rework of Ipv6Addr::is_global (edit: #86634) to more accurately follow the IANA Special Address Registry (like is done in Ipv4Addr::is_global).

@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 20, 2021
| multicast_admin_local
| multicast_global
| multicast_link_local
| multicast_realm_local
| multicast_site_local
| multicast_organization_local;
let ipv4_mapped = 1 << 17;
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 assigned ipv4_mapped to 1 << 17, as I already assigned 1 << 16 to benchmarking in the related PR #86434. (the actual values don't really matter, only that they are distinct)

check!(
"::ffff:127.0.0.1",
&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0x7f, 0, 0, 1],
global | unicast_global | ipv4_mapped
Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the IANA IPv6 Special Address Registry IPv4-mapped addresses are not globally reachable. However due to the current simplistic implementation of Ipv6Addr::is_global compared to Ipv4Addr::is_global, Rust currently considers these addresses global. I plan to address this in a future PR reworking is_global.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The rework of Ipv6Addr::is_global has been submitted (#86634).

@CDirkx

This comment has been minimized.

@rustbot rustbot added A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 23, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2021
@bors
Copy link
Contributor

bors commented Aug 3, 2021

☔ The latest upstream changes (presumably #86335) made this pull request unmergeable. Please resolve the merge conflicts.

@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2021
@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2021
@JohnCSimon
Copy link
Member

JohnCSimon commented Sep 6, 2021

ping from triage:
@CDirkx can you please address the merge conflict?

@JohnCSimon
Copy link
Member

ping again from triage:
@CDirkx I'm closing this as inactive, please feel free to reopen when you're ready to continue.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this Sep 27, 2021
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Sep 27, 2021
jstasiak pushed a commit to jstasiak/rust that referenced this pull request Dec 18, 2023
This change consists of cherry-picking the content from the original
PR[1], which got closed due to inactivity, and applying the following
changes:

* Resolving merge conflicts (obviously)
* Linked to to_ipv4_mapped instead of to_ipv4 in the documentation (seems
  more appropriate)
* Added the must_use and rustc_const_unstable attributes the original
  didn't have

I think it's a reasonably useful method.

[1] rust-lang#86490
Nadrieril added a commit to Nadrieril/rust that referenced this pull request Jan 21, 2024
Add Ipv6Addr::is_ipv4_mapped

This change consists of cherry-picking the content from the original PR[1], which got closed due to inactivity, and applying the following changes:

* Resolving merge conflicts (obviously)
* Linked to to_ipv4_mapped instead of to_ipv4 in the documentation (seems more appropriate)
* Added the must_use and rustc_const_unstable attributes the original didn't have

I think it's a reasonably useful method to have.

[1] rust-lang#86490
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
Rollup merge of rust-lang#119081 - jstasiak:is-ipv4-mapped, r=dtolnay

Add Ipv6Addr::is_ipv4_mapped

This change consists of cherry-picking the content from the original PR[1], which got closed due to inactivity, and applying the following changes:

* Resolving merge conflicts (obviously)
* Linked to to_ipv4_mapped instead of to_ipv4 in the documentation (seems more appropriate)
* Added the must_use and rustc_const_unstable attributes the original didn't have

I think it's a reasonably useful method to have.

[1] rust-lang#86490
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
Add Ipv6Addr::is_ipv4_mapped

This change consists of cherry-picking the content from the original PR[1], which got closed due to inactivity, and applying the following changes:

* Resolving merge conflicts (obviously)
* Linked to to_ipv4_mapped instead of to_ipv4 in the documentation (seems more appropriate)
* Added the must_use and rustc_const_unstable attributes the original didn't have

I think it's a reasonably useful method to have.

[1] rust-lang/rust#86490
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Add Ipv6Addr::is_ipv4_mapped

This change consists of cherry-picking the content from the original PR[1], which got closed due to inactivity, and applying the following changes:

* Resolving merge conflicts (obviously)
* Linked to to_ipv4_mapped instead of to_ipv4 in the documentation (seems more appropriate)
* Added the must_use and rustc_const_unstable attributes the original didn't have

I think it's a reasonably useful method to have.

[1] rust-lang/rust#86490
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants