python / python/cpython

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

オープン
#151,049 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。