Skip to content

Commit 02d815f

Browse files
committed
std::net: site-local ipv6 prefixes are global
1 parent 7754865 commit 02d815f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/libstd/net/ip.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,12 +1104,20 @@ impl Ipv6Addr {
11041104
///
11051105
/// - the loopback address
11061106
/// - the link-local addresses
1107-
/// - the (deprecated) site-local addresses
11081107
/// - unique local addresses
11091108
/// - the unspecified address
11101109
/// - the address range reserved for documentation
11111110
///
1111+
/// This method returns [`true`] for site-local addresses as per [RFC 4291 section 2.5.7]
1112+
///
1113+
/// ```no_rust
1114+
/// The special behavior of [the site-local unicast] prefix defined in [RFC3513] must no longer
1115+
/// be supported in new implementations (i.e., new implementations must treat this prefix as
1116+
/// Global Unicast).
1117+
/// ```
1118+
///
11121119
/// [`true`]: ../../std/primitive.bool.html
1120+
/// [RFC 4291 section 2.5.7]: https://tools.ietf.org/html/rfc4291#section-2.5.7
11131121
///
11141122
/// # Examples
11151123
///
@@ -1126,9 +1134,11 @@ impl Ipv6Addr {
11261134
/// ```
11271135
pub fn is_unicast_global(&self) -> bool {
11281136
!self.is_multicast()
1129-
&& !self.is_loopback() && !self.is_unicast_link_local()
1130-
&& !self.is_unicast_site_local() && !self.is_unique_local()
1131-
&& !self.is_unspecified() && !self.is_documentation()
1137+
&& !self.is_loopback()
1138+
&& !self.is_unicast_link_local()
1139+
&& !self.is_unique_local()
1140+
&& !self.is_unspecified()
1141+
&& !self.is_documentation()
11321142
}
11331143

11341144
/// Returns the address's multicast scope if the address is multicast.

0 commit comments

Comments
 (0)