python / python/cpython

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

Aperta
#151,049 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stdlib type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esamina le costanti IPv6 del modulo ipaddress, concentrandoti su _IPv6Constants._private_networks_exceptions e sulle voci esistenti 2001:1::1/128 e ::2/128. Verifica la riproduzione segnalata e il comportamento delle voci correlate; il lavoro è completato quando 2001:1::3 restituisce is_global=True e is_private=False e i test pertinenti passano.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
networking
Tipo di issue
Bug
Difficoltà
1/5
Tempo stimato
Meno di un'ora
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.