ipaddress: IPv6Address.reverse_pointer produces an invalid name for an address with a scope id
未关闭
还没有人认领这个 Issue。
stdlib
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Since gh-88178 (a2104b7ce), :attr:~ipaddress.IPv6Address.exploded includes
the %scope_id suffix. IPv6Address._reverse_pointer derives the pointer
from self.exploded and only strips :, so the scope id is reversed into
the name:
>>> import ipaddress
>>> ipaddress.IPv6Address('fe80::1%eth0').reverse_pointer
'0.h.t.e.%.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa'
A scope id is link-local and is not part of the address, so it must not appear
in the reverse DNS name. The correct value is the one for fe80::1:
>>> ipaddress.IPv6Address('fe80::1').reverse_pointer
'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa'
Before a2104b7ce this raised :exc:~ipaddress.AddressValueError; it now returns
a malformed name silently.
Linked PRs
- gh-155837
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 ipaddress.IPv6Address._reverse_pointer 和本报告中的 reverse_pointer 示例开始。检查 scope_id 后缀如何进入 IPv6Address.exploded,并验证 fe80::1%eth0 的反向 DNS 名称是否与不带后缀的地址匹配。完成的标准是生成的指针中不包含作用域标识符,并且之前格式错误的输出由回归测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100