python / python/cpython

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

Abierto
#151,049 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

stdlib type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Revisa las constantes IPv6 del módulo ipaddress, centrándote en _IPv6Constants._private_networks_exceptions y en las entradas existentes 2001:1::1/128 y ::2/128. Verifica la reproducción indicada y el comportamiento de las entradas hermanas; se considera terminado cuando 2001:1::3 indica is_global=True y is_private=False, y las pruebas pertinentes pasan.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
networking
Tipo de issue
Error
Dificultad
1/5
Tiempo estimado
Menos de una hora
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.