Title: ipaddress is_private misleading for IPv4 mapped IPv6 addresses
Type: Stage:
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Thomas Kriechbaumer, Wicken
Priority: normal Keywords:

Created on 2018-05-05 13:34 by Thomas Kriechbaumer, last changed 2020-03-03 20:18 by Wicken.

Messages (1)
msg316213 - (view) Author: Thomas Kriechbaumer (Thomas Kriechbaumer) Date: 2018-05-05 13:34
ipaddress.IPv4Address and ipaddress.IPv6Address provide a is_private function that indicates if the address (or network) is part of a "private" IP range, as designated by the IANA special-use registry.

The current documentation is as follows:
> is_private
>    True if the address is allocated for private networks. See iana-ipv4-special-registry (for IPv4) or iana-ipv6-special-registry (for IPv6).

However, IPv4-mapped IPv6 addresses are currently being reported as "private" by this function (see

I consider this a bug or at least counter-intuitive, because e.g. ::ffff: is most definitely NOT a private IP address, and yet the ipaddress.is_private function reports True.
The IANA special-use registry does not contain any references to "being private" for the ::ffff region. It just designates it to be used for IPv4-mapped address.
Date User Action Args
2020-03-03 20:18:14Wickensetnosy: + Wicken
2018-05-05 13:34:54Thomas Kriechbaumercreate