GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ipaddress "is_private" and "is_global" are insufficiently documented and is_global probably has a bug · Issue #65056 · python/cpython

ipaddress "is_private" and "is_global" are insufficiently documented and is_global probably has a bug #65056

New issue
Copy link
New issue
Copy link
Closed
Closed
ipaddress "is_private" and "is_global" are insufficiently documented and is_global probably has a bug#65056
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@bitdancer
bitdancer
opened on Mar 6, 2014
Issue body actions
BPO 20857
Nosy @loewis, @ncoghlan, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2014-03-06.16:20:35.832>
labels = ['type-bug']
title = 'ipaddress "is_private" and "is_global" are insufficiently documented and is_global probably has a bug'
updated_at = <Date 2014-03-06.21:50:40.486>
user = 'https://github.com/bitdancer'

bugs.python.org fields:

activity = <Date 2014-03-06.21:50:40.486>
actor = 'loewis'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2014-03-06.16:20:35.832>
creator = 'r.david.murray'
dependencies = []
files = []
hgrepos = []
issue_num = 20857
keywords = []
message_count = 3.0
messages = ['212812', '212813', '212843']
nosy_count = 4.0
nosy_names = ['loewis', 'ncoghlan', 'pmoody', 'r.david.murray']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue20857'
versions = ['Python 3.4', 'Python 3.5']

Linked PRs

  • GH-65056: Improve the IP address' is_global/is_private documentation #113186

Activity

Next
  1. bitdancer commented on Mar 6, 2014

    @bitdancer
    bitdancer
    on Mar 6, 2014
    MemberAuthor
    More actions

    The 'is_private' and 'is_global' properties refer to the iana registries, but the terms 'private network' and 'public network' do no appear in the registry documentation. There is no way to know what these methods are going to return other than examining the source code.

    In particular, without looking at the source code a best-guess interpretation of the documentation would lead one to expect that is_private would return true only for RFC1918 addresses, since that is the one place the term 'private' appears. Similarly, the naive interpretation of is_global would be that it would return False for all addresses listed in the ipv4 registry *except* 192.88.99.0/24, which is the only one whose global routing flag is True in the table.

    I would submit that the fact that the latter is not true is a bug.

    It is really not at all clear what 'is_private' means (see also bpo-17400, which introduced is_global), so I am completely unclear how to rewrite the documentation to fully specify it, other than to list out the address ranges that it considers private.

  2. bitdancer
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Mar 6, 2014
  3. bitdancer commented on Mar 6, 2014

    @bitdancer
    bitdancer
    on Mar 6, 2014
    MemberAuthor
    More actions

    Oh, and just to make things more complicated, there are footnotes that some protocols allow global routing for protocol-allocated addresses that are otherwise not globally routable. It would be reasonable to for is_global to ignore this, but it should be documented that it does so.

  4. loewis commented on Mar 6, 2014

    @loewis
    loewismannequin
    on Mar 6, 2014
    Mannequin
    More actions

    I'm always in favour of using official terminology (and adjust if that changes over time). So in this case, I agree with David's analysis, and suggest the following specification:

    • is_global returns False for all addresses where "Global" is "False" in the IPv4 or IPv6 Special-Purpose Address Registry
    • a new method is_private_use is introduced, giving True only for the RFC1918 addresses
    • a new method is_unique_local is introduced, giving True only for the RFC 4193 addresses.
    • is_private is deprecated. Alternatively, it could be preserved and documented to being the union of is_privte_use and is_unique_local.

    I don't think it it necessary to discuss footnote 1 in the IPv6 registry ("not global unless a specific allocations says otherwise"). The specific allocations that might override this come right below, so if we implement the table, we would cover all those more specific case.

    I'm puzzled why Teredo is listed as "not global"; my understanding is that the Teredo prefixes even get announced in BGP, and are fully global.

    Reacted by Jakub Stasiak
  5. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  6. iritkatriel
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Nov 28, 2023
  7. jstasiak commented on Dec 15, 2023

    @jstasiak
    jstasiak
    on Dec 15, 2023
    Contributor
    More actions

    I second @loewis' conclusions, the current semantics is pretty confusing. In the meantime we can document it better, I'll take a stab at it.

  8. jstasiak
    added a commit that references this issue on Dec 15, 2023

    pythonGH-65056: Improve the IP address' is_global/is_private document…

    533b97f
  9. jstasiak commented on Dec 15, 2023

    @jstasiak
    jstasiak
    on Dec 15, 2023
    Contributor
    More actions

    See the attached PR. The documentation preview: https://cpython-previews--113186.org.readthedocs.build/en/113186/library/ipaddress.html#ipaddress.IPv4Address.is_private

  10. encukou
    added a commit that references this issue on Mar 18, 2024

    GH-65056: Improve the IP address' is_global/is_private documentation (G…

    2a4cbf1
  11. encukou commented on Mar 18, 2024

    @encukou
    encukou
    on Mar 18, 2024
    Member
    More actions

    Docs are now updated; thank you!
    The bug is tracked in #113171.

  12. encukou
    closed this as completedon Mar 18, 2024
  13. vstinner
    added a commit that references this issue on Mar 20, 2024

    pythonGH-65056: Improve the IP address' is_global/is_private document…

    61c1e8f
  14. adorilson
    added a commit that references this issue on Mar 25, 2024

    pythonGH-65056: Improve the IP address' is_global/is_private document…

    087e7e0
  15. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythonGH-65056: Improve the IP address' is_global/is_private document…

    bd6e3dc
  16. 2 remaining items

  17. encukou
    added 2 commits that reference this issue on Apr 24, 2024

    pythongh-113171: pythongh-65056: Fix "private" (non-global) IP addres…

    b47c766

    pythongh-113171: pythongh-65056: Fix "private" (non-global) IP addres…

    0740166
  18. pablogsal
    added a commit that references this issue on Apr 25, 2024

    [3.11] gh-113171: gh-65056: Fix "private" (non-global) IP address ran…

    ba43157
  19. encukou
    added 2 commits that reference this issue on May 1, 2024

    pythongh-113171: pythongh-65056: Fix "private" (non-global) IP addres…

    5e58376

    pythongh-113171: pythongh-65056: Fix "private" (non-global) IP addres…

    05a1467
  20. ambv
    added 3 commits that reference this issue on May 7, 2024

    [3.10] gh-113171: gh-65056: Fix "private" (non-global) IP address ran…

    c62c9e5

    [3.9] gh-113171: gh-65056: Fix "private" (non-global) IP address rang…

    22adf29

    [3.8] gh-113171: gh-65056: Fix "private" (non-global) IP address rang…

    895f7e2
  21. rickprice
    added 4 commits that reference this issue on Jul 3, 2024

    CVE-2024-4032 Fix "private" (non-global) IP address ranges (pythonGH-…

    677b465

    CVE-2024-4032 Fix "private" (non-global) IP address ranges (pythonGH-…

    6e7c097

    CVE-2024-4032 Fix "private" (non-global) IP address ranges (pythonGH-…

    89f48de

    CVE-2024-4032 Fix "private" (non-global) IP address ranges (pythonGH-…

    0a34c66
  22. frenzymadness
    added 2 commits that reference this issue on Aug 13, 2024

    00431: pythongh-113171: pythongh-65056: Fix "private" (non-global) IP…

    7ef313f

    00431: pythongh-113171: pythongh-65056: Fix "private" (non-global) IP…

    71337f4
  23. stratakis
    added a commit that references this issue on Aug 15, 2024

    00431: pythongh-113171: pythongh-65056: Fix "private" (non-global) IP…

    234aea1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.