diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-03-25 18:09:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-25 18:09:03 +0100 |
| commit | 5f6c1a9f573b2aab044c856589c9d9de3c821af3 (patch) | |
| tree | 40a744fe77f794a6cf2a2b2fdf5480515ca53225 | |
| parent | 48994b1674b3212d27b5e83841c0966bc2b4be43 (diff) | |
| parent | ea99e81485ff5d82cabba9af5d1c21293737cc16 (diff) | |
| download | rust-5f6c1a9f573b2aab044c856589c9d9de3c821af3.tar.gz rust-5f6c1a9f573b2aab044c856589c9d9de3c821af3.zip | |
Rollup merge of #135745 - bardiharborow:std/net/rfc9602, r=cuviper
Recognise new IPv6 non-global range from IETF RFC 9602 This PR adds the `5f00::/16` range defined by [IETF RFC 9602](https://datatracker.ietf.org/doc/rfc9602/) to those ranges which `Ipv6Addr::is_global` recognises as a non-global IP. This range is used for Segment Routing (SRv6) SIDs. See also: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml Unstable tracking issue: #27709
| -rw-r--r-- | library/core/src/net/ip_addr.rs | 2 | ||||
| -rw-r--r-- | library/coretests/tests/net/ip_addr.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/net/ip_addr.rs b/library/core/src/net/ip_addr.rs index 7aa5ed60d04..2f027be6928 100644 --- a/library/core/src/net/ip_addr.rs +++ b/library/core/src/net/ip_addr.rs @@ -1623,6 +1623,8 @@ impl Ipv6Addr { // IANA says N/A. || matches!(self.segments(), [0x2002, _, _, _, _, _, _, _]) || self.is_documentation() + // Segment Routing (SRv6) SIDs (`5f00::/16`) + || matches!(self.segments(), [0x5f00, ..]) || self.is_unique_local() || self.is_unicast_link_local()) } diff --git a/library/coretests/tests/net/ip_addr.rs b/library/coretests/tests/net/ip_addr.rs index f01b43282ec..3fec59d67b7 100644 --- a/library/coretests/tests/net/ip_addr.rs +++ b/library/coretests/tests/net/ip_addr.rs @@ -689,6 +689,8 @@ fn ipv6_properties() { check!("2002::", &[0x20, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unicast_global); + check!("5f00::", &[0x5f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unicast_global); + check!("fc00::", &[0xfc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unique_local); check!( |
