python / python/cpython

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

未关闭
#151,049 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stdlib type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

检查 ipaddress 模块的 IPv6 常量,重点关注 _IPv6Constants._private_networks_exceptions 以及现有的 2001:1::1/128 和 ::2/128 条目。验证报告中的复现结果和同组条目的行为;当 2001:1::3 报告 is_global=True 和 is_private=False,且相关测试通过时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
networking
Issue 类型
缺陷
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。