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 is_global special address handling #119006

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

jstasiak
Copy link
Contributor

@jstasiak jstasiak commented Dec 16, 2023

IANA explicitly documents 192.0.0.9/32, 192.0.0.9/32 and 2001:30::/28 as globally reachable[1][2] and the is_global implementations declare following IANA so let's make this happen.

In case of 2002::/16 IANA says N/A so I think it's safe to say we shouldn't return true from is_global for addresses in that block.

[1] https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml

@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 2023

r? @thomcc

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 16, 2023
@jstasiak jstasiak changed the title Make is_global/is_unicast_global special address handling complete Fix is_global/is_unicast_global special address handling Dec 16, 2023
@jstasiak
Copy link
Contributor Author

Cross-referencing this comment for some context: #27709 (comment)

@jstasiak
Copy link
Contributor Author

After considering it some more I'm currently thinking this PR should only change is_global as the semantics of is_unicast_global are still a little unclear to me.

@thomcc
Copy link
Member

thomcc commented Dec 26, 2023

I don't have enough context here to review this well.

r? libs

@rustbot rustbot assigned cuviper and unassigned thomcc Dec 26, 2023
@jstasiak jstasiak changed the title Fix is_global/is_unicast_global special address handling Fix is_global special address handling Dec 27, 2023
@cuviper
Copy link
Member

cuviper commented Jan 10, 2024

I think this is correct, but can you squash the revert commit so it doesn't disrupt git-blame?

IANA explicitly documents 192.0.0.9/32, 192.0.0.9/32 and 2001:30::/28 as
globally reachable[1][2] and the is_global implementations declare
following IANA so let's make this happen.

In case of 2002::/16 IANA says N/A so I think it's safe to say we
shouldn't return true there either.

[1] https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
@jstasiak
Copy link
Contributor Author

Sure thing, done. I made a small whitespace change and added tests for two edge cases to make sure we're handling everything right.

@cuviper
Copy link
Member

cuviper commented Jan 11, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 11, 2024

📌 Commit 4621357 has been approved by cuviper

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#115046 (Use version-sorting for all sorting)
 - rust-lang#118915 (Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`)
 - rust-lang#119006 (Fix is_global special address handling)
 - rust-lang#119637 (Pass LLVM error message back to pass wrapper.)
 - rust-lang#119715 (Exhaustiveness: abort on type error)
 - rust-lang#119763 (Cleanup things in and around `Diagnostic`)
 - rust-lang#119788 (change function name in comments)
 - rust-lang#119790 (Fix all_trait* methods to return all traits available in StableMIR)
 - rust-lang#119803 (Silence some follow-up errors [1/x])
 - rust-lang#119804 (Stabilize mutex_unpoison feature)
 - rust-lang#119832 (Meta: Add project const traits to triagebot config)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0f2d12e into rust-lang:master Jan 11, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2024
Rollup merge of rust-lang#119006 - jstasiak:fix-special-ip-ranges, r=cuviper

Fix is_global special address handling

IANA explicitly documents 192.0.0.9/32, 192.0.0.9/32 and 2001:30::/28 as globally reachable[1][2] and the is_global implementations declare following IANA so let's make this happen.

In case of 2002::/16 IANA says N/A so I think it's safe to say we shouldn't return true from is_global for addresses in that block.

[1] https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants