]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179...
authorPetr Viktorin <encukou@gmail.com>
Wed, 24 Apr 2024 12:29:30 +0000 (14:29 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Apr 2024 12:29:30 +0000 (14:29 +0200)
commitf86b17ac511e68192ba71f27e752321a3252cee3
tree4fc35974e348f8311b7d5015d3b5ec045e113ecd
parent2eaf9ba9ceb4a9d1595b1413bf872db0a4978b13
[3.12] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177)

* GH-113171: Fix "private" (non-global) IP address ranges (GH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] https://github.com/python/cpython/issues/61602

* GH-65056: Improve the IP address' is_global/is_private documentation (GH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf17af19a01d942f9579342f77c39fbd23c4)
(cherry picked from commit 40d75c2b7f5c67e254d0a025e0f2e2c7ada7f69f)

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
Doc/library/ipaddress.rst
Doc/whatsnew/3.12.rst
Lib/ipaddress.py
Lib/test/test_ipaddress.py
Misc/NEWS.d/next/Library/2024-03-14-01-38-44.gh-issue-113171.VFnObz.rst [new file with mode: 0644]