Skip to content

Conversation

@taksyon
Copy link

@taksyon taksyon commented Sep 7, 2025

Addresses starting with "192.0.2.", "198.51.100.", or "203.0.113." are reserved for use in documentation and sample configurations. The original was some random french IP, just changed it to an address reserved for documentation by the Internet Assigned Numbers Authority

Addresses starting with "192.0.2.", "198.51.100.", or "203.0.113." are reserved for use in documentation and sample configurations. 
The original was some random french IP
@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Sep 7, 2025
@hkBst
Copy link
Member

hkBst commented Sep 7, 2025

https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_global documents such addresses as not being global, so I expect the doc test to fail.

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
   4: rust_out::main::_doctest_main_library_core_src_net_ip_addr_rs_291_0
   5: rust_out::main
   6: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- library/core/src/net/ip_addr.rs - net::ip_addr::IpAddr::is_global (line 291) stdout end ----

@hkBst
Copy link
Member

hkBst commented Sep 7, 2025

According to https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml, these special addresses are global:

192.175.48.0/24 	Direct Delegation AS112 Service 	[[RFC7534](https://www.iana.org/go/rfc7534)] 	1996-01 	N/A 	True 	True 	True 	True 	False
192.52.193.0/24 	AMT 	[[RFC7450](https://www.iana.org/go/rfc7450)] 	2014-12 	N/A 	True 	True 	True 	True 	False
192.31.196.0/24 	AS112-v4 	[[RFC7535](https://www.iana.org/go/rfc7535)] 	2014-12 	N/A 	True 	True 	True 	True 	False
192.0.0.10/32 	Traversal Using Relays around NAT Anycast 	[[RFC8155](https://www.iana.org/go/rfc8155)] 	2017-02 	N/A 	True 	True 	True 	True 	False
192.0.0.9/32 	Port Control Protocol Anycast 	[[RFC7723](https://www.iana.org/go/rfc7723)] 	2015-10 	N/A 	True 	True 	True 	True 	False

@taksyon
Copy link
Author

taksyon commented Sep 7, 2025

seems like this is an awkward method to write good docs for in that case...

@tgross35
Copy link
Contributor

tgross35 commented Sep 7, 2025

IPs have a one-hot classification, being a documentation IP means it isn't global https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=4d02d0c8fe5827b36b87a3b9dbbc0605. Based on the comment from @hkBst this also seems like a correct classification for the two IPs in question here.

seems like this is an awkward method to write good docs for in that case...

What makes the docs incorrect or bad?

@rustbot author

@rustbot rustbot 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 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@taksyon
Copy link
Author

taksyon commented Sep 8, 2025

What makes the docs incorrect or bad?

Not incorrect, that is definitely a global IP in the original. My intention with this pull request was to use a global IP reserved for documentation so that some random IP address wasn't being used. I should have done more research before opening this, please forgive me for wasting time.

I am still learning Rust, so while I was reading the docs, I was under the impression that the global IP currently in the docs was a special global IP address that had a certain use case, but when I looked it up, it seems to be an arbitrarily chosen IP for demonstration. I was thinking that using a global IP address that is more general or perhaps reserved for examples would make the documentation for the is_global() method more clear.

@tgross35
Copy link
Contributor

tgross35 commented Sep 8, 2025

Well, it is probably randomly chosen :) They don't really say but I assume IETF5737 is probably meant for documentation where you might actually interact with the IP addresses (like pinging/connecting), and not so much for documenting effectively "this is what x kind of IP could look like". That would make it a bit tough to write IETF docs about anything other than documentation IPs.

I should have done more research before opening this, please forgive me for wasting time.

There is no waste and it's not a problem! New ideas are always welcome, and everybody learns in situations like this.

I am going to close this though, since I don't think it is actionable.

@tgross35 tgross35 closed this Sep 8, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 8, 2025
@tgross35
Copy link
Contributor

tgross35 commented Sep 8, 2025

I am still learning Rust, so while I was reading the docs, I was under the impression that the global IP currently in the docs was a special global IP address that had a certain use case, but when I looked it up, it seems to be an arbitrarily chosen IP for demonstration

To address this a bit more directly; most of the IPs in this section of the docs are arbitrary and for demonstration. There are a range of values that match the is_* queries, most of the examples try to choose a couple that look kind of different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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