Bug report
ipaddress.ip_address('2001:1::3').is_global returns False, but 2001:1::3/128
is registered by IANA as globally reachable.
IANA registration
The IANA IPv6 Special-Purpose Address Registry lists, as of the 2024-04 update:
| Address Block |
Name |
RFC |
Globally Reachable |
| 2001:1::1/128 |
Port Control Protocol Anycast |
RFC 7723 |
True |
| 2001:1::2/128 |
Traversal Using Relays around NAT Anycast |
RFC 8155 |
True |
| 2001:1::3/128 |
DNS-SD Service Registration Protocol Anycast |
RFC 9665 |
True |
Registry: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
2001:1::3/128 was added by RFC 9665 (DNS-SD Service Registration Protocol) and
appears in the registry with Globally Reachable = True, exactly like its
neighbours 2001:1::1/128 and 2001:1::2/128.
The bug
_IPv6Constants._private_networks contains 2001::/23, which makes the whole
block non-global by default; the per-address carve-outs live in
_IPv6Constants._private_networks_exceptions. That list currently has
2001:1::1/128 and 2001:1::2/128 but not 2001:1::3/128, so 2001:1::3
is incorrectly treated as not globally reachable.
The ::1/::2 exceptions were added in GH-113179 (fixing #113171); the table
was simply never updated for the 2024-04 ::3 registration.
Reproduce
On current main:
>>> import ipaddress
>>> ipaddress.ip_address('2001:1::3').is_global
False # expected: True
>>> ipaddress.ip_address('2001:1::3').is_private
True # expected: False
>>> ipaddress.ip_address('2001:1::1').is_global # sibling, correct
True
>>> ipaddress.ip_address('2001:1::2').is_global # sibling, correct
True
Fix
Add IPv6Network('2001:1::3/128') to _IPv6Constants._private_networks_exceptions,
mirroring the existing ::1/::2 entries. PR to follow.
Linked PRs
Bug report
ipaddress.ip_address('2001:1::3').is_globalreturnsFalse, but2001:1::3/128is registered by IANA as globally reachable.
IANA registration
The IANA IPv6 Special-Purpose Address Registry lists, as of the 2024-04 update:
Registry: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
2001:1::3/128was added by RFC 9665 (DNS-SD Service Registration Protocol) andappears in the registry with Globally Reachable = True, exactly like its
neighbours
2001:1::1/128and2001:1::2/128.The bug
_IPv6Constants._private_networkscontains2001::/23, which makes the wholeblock non-global by default; the per-address carve-outs live in
_IPv6Constants._private_networks_exceptions. That list currently has2001:1::1/128and2001:1::2/128but not2001:1::3/128, so2001:1::3is incorrectly treated as not globally reachable.
The
::1/::2exceptions were added in GH-113179 (fixing #113171); the tablewas simply never updated for the 2024-04
::3registration.Reproduce
On current main:
Fix
Add
IPv6Network('2001:1::3/128')to_IPv6Constants._private_networks_exceptions,mirroring the existing
::1/::2entries. PR to follow.Linked PRs