Skip to content

Commit 4487585

Browse files
committed
Recognise new IPv6 non-global range from RFC9602
This commit adds the 5f00::/16 range defined by RFC9602 to those ranges which Ipv6Addr::is_global recognises as a non-global IP. This range is used for Segment Routing (SRv6) SIDs.
1 parent 1f27619 commit 4487585

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: core/src/net/ip_addr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,8 @@ impl Ipv6Addr {
16231623
// IANA says N/A.
16241624
|| matches!(self.segments(), [0x2002, _, _, _, _, _, _, _])
16251625
|| self.is_documentation()
1626+
// Segment Routing (SRv6) SIDs (`5f00::/16`)
1627+
|| matches!(self.segments(), [0x5f00, ..])
16261628
|| self.is_unique_local()
16271629
|| self.is_unicast_link_local())
16281630
}

Diff for: coretests/tests/net/ip_addr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,8 @@ fn ipv6_properties() {
689689

690690
check!("2002::", &[0x20, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unicast_global);
691691

692+
check!("5f00::", &[0x5f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unicast_global);
693+
692694
check!("fc00::", &[0xfc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], unique_local);
693695

694696
check!(

0 commit comments

Comments
 (0)