This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author macfreek
Recipients christian.heimes, jcea, leim, macfreek, ncoghlan, pmoody, santoso.wijaya, terry.reedy, vstinner
Date 2013-08-19.08:04:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376899475.23.0.552905503884.issue17400@psf.upfronthosting.co.za>
In-reply-to
Content
A bit odd questions: What is the is_private() function intended to accomplish?

I have been wondering what is_private() means, and how users of the library are going to use this function. I've actually failed to come up with any sensible use-case with the current implementation. So in the current state, without the modifications, my vote would be to remove the method, as it is more likely to add confusion than the be of a particular use.

The most useful method (which I originally thought it was meant to do) is a function that indicates if a certain IP range is NATted (only an indication, since it requires a network to reliable test). However, that's not what the current function entails: it misses the 100.64.0.0/10 range, which is NATted, but includes the fc00::/7 unique local block, which is not NATted.

I would be all in favour of such a is_natted() function, but that's not what this is.

The is_private() function also does not simply list "private" IP addresses, when looking at the formal IETF definitions, since it includes fc00::/7, which are unique local addresses, which in practice used in a rather different way: IPv4 private IP addresses are often NATted (and routed after translation), while IPv6 unique local addresses are typically used for local non-routed networks.

Also, the is_private() function does not list all non-globally assigned addresses. That should includes a lot more ranges, as listed on http://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml and http://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml.

So far, the is_private() function seems to return True for addresses which are:
* non-globally assigned (as opposed to regular unicast and multicast addresses)
* available for manual assignment (as opposed to link-local addresses)
* may be assigned by end-sites, but not by ISPs (as opposed to shared IP addresses and the small DS-Lite block)
* is not intended for benchmarking purposes (as opposed to benchmarking IP addresses)

Frankly, I wonder if this very particular information of enough interest to warrant a function on its own.

In that case, I much rather see more generic (and hopefully more useful) functions such as is_natted() and for is_global(), is_forwardable() and is_reserved(), as defined by IANA.
History
Date User Action Args
2013-08-19 08:04:35macfreeksetrecipients: + macfreek, terry.reedy, jcea, ncoghlan, vstinner, christian.heimes, pmoody, santoso.wijaya, leim
2013-08-19 08:04:35macfreeksetmessageid: <1376899475.23.0.552905503884.issue17400@psf.upfronthosting.co.za>
2013-08-19 08:04:35macfreeklinkissue17400 messages
2013-08-19 08:04:34macfreekcreate