python / python/cpython

ipaddress: 2001:1::3/128 (RFC 9665) missing from IPv6 _private_networks_exceptions, is_global returns False

Open
#151,049 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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
  • gh-151050

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the ipaddress module's IPv6 constants, focusing on _IPv6Constants._private_networks_exceptions and the existing 2001:1::1/128 and ::2/128 entries. Verify the reported reproduction and sibling behavior; done means 2001:1::3 reports is_global=True and is_private=False, with the relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.