ipaddress.reverse_pointer returns nonsense if prefixed input is given
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
ipaddress.reverse_pointer does not seem to validate its input at all. For example:
$ python3
Python 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipaddress
>>> ipaddress.ip_network('2001:db8:1:2:3:4:5::/64',False).reverse_pointer
'4.6./.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
>>>
This is very obviously wrong.
In this case of prefixed input, the output should be cut to the appropriate prefix length, yielding
2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa as output. It is ok to assume /128 as the default, converting 2001:db8:1:2:3:4:5:: to 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa, but input longer than that is an error.
Prefixed address strings are for example important when generating zone names for the server side of IPv6 reverse DNS. Run-of-the-mill network client software is unlikely to use this for addresses shorter than /128, but for the server side it is an important use case.
Greetings
Marc
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行报告中的 Python 重现程序,并跟踪 ipaddress.reverse_pointer 入口点,以了解带前缀的输入是如何处理的。完成标准是:带前缀的 IPv6 输入生成按其前缀长度截短的反向指针名称,默认的不带前缀输入按 /128 处理,并拒绝长于 /128 的输入。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100