Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-151049: Add 2001:1::3/128 (RFC 9665) to ipaddress IPv6 global exce…
…ptions

IANA's IPv6 Special-Purpose Address Registry (2024-04) lists 2001:1::3/128
("DNS-SD Service Registration Protocol Anycast", RFC 9665) as globally
reachable, like 2001:1::1/128 and 2001:1::2/128. It was missing from
_IPv6Constants._private_networks_exceptions, so is_global returned False
for it. Add the exception and extend testReservedIpv6.
  • Loading branch information
tonghuaroot committed Jun 7, 2026
commit ec0c214335b3ea76015a90da2110594e87eb20da
2 changes: 2 additions & 0 deletions Lib/ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2394,6 +2394,8 @@ class _IPv6Constants:
_private_networks_exceptions = [
IPv6Network('2001:1::1/128'),
IPv6Network('2001:1::2/128'),
# RFC 9665: https://www.rfc-editor.org/rfc/rfc9665.html
IPv6Network('2001:1::3/128'),
IPv6Network('2001:3::/32'),
IPv6Network('2001:4:112::/48'),
IPv6Network('2001:20::/28'),
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2488,6 +2488,10 @@ def testReservedIpv6(self):
self.assertFalse(ipaddress.ip_address('2001::').is_global)
self.assertTrue(ipaddress.ip_address('2001:1::1').is_global)
self.assertTrue(ipaddress.ip_address('2001:1::2').is_global)
# gh-151049: RFC 9665 anycast address (IANA 2024-04 registration)
self.assertTrue(ipaddress.ip_address('2001:1::3').is_global)
self.assertFalse(ipaddress.ip_address('2001:1::3').is_private)
self.assertFalse(ipaddress.ip_address('2001:1::4').is_global)
self.assertFalse(ipaddress.ip_address('2001:2::').is_global)
self.assertTrue(ipaddress.ip_address('2001:3::').is_global)
self.assertFalse(ipaddress.ip_address('2001:4::').is_global)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:mod:`ipaddress`: fix ``is_global`` and ``is_private`` for the
``2001:1::3/128`` (DNS-SD Service Registration Protocol Anycast) address,
which IANA registered as globally reachable per :rfc:`9665`. It is now
correctly reported with ``is_global`` ``True`` and ``is_private`` ``False``.
Loading