Let’s discuss about RFC 6598: IANA-Reserved IPv4 Prefix
Introduction
Defined in 2012, the shared address space is distinct from the private address space RFC 1918 , but has many similarities in terms of its use on service provider networks.
Currently, there is no test associated with this network, which can lead to confusions.
Here’s an exemple in python 3.11:
>>> import ipaddress
>>> a = ipaddress.ip_address("100.64.0.0")
>>> a.is_
a.is_global a.is_link_local a.is_loopback a.is_multicast a.is_private a.is_reserved a.is_unspecified
>>> a.is_global
False
>>> a.is_private
False
>>> a.is_unspecified
False
>>> a.is_reserved
False
>>> a.is_loopback
False
>>> b = ipaddress.ip_network("100.64.0.0")
>>> b.is_global
False
>>> b.is_private
False
>>> b.is_unspecified
False
>>> b.is_reserved
False
>>> b.is_loopback
False
Sources
In the current ipaddress.py file : the network 100.64.0.0/10 is defined as “_public_network”.
class _IPv4Constants:
_linklocal_network = IPv4Network('169.254.0.0/16')
_loopback_network = IPv4Network('127.0.0.0/8')
_multicast_network = IPv4Network('224.0.0.0/4')
_public_network = IPv4Network('100.64.0.0/10')
_private_networks = [
IPv4Network('0.0.0.0/8'),
IPv4Network('10.0.0.0/8'),
IPv4Network('127.0.0.0/8'),
IPv4Network('169.254.0.0/16'),
IPv4Network('172.16.0.0/12'),
IPv4Network('192.0.0.0/29'),
IPv4Network('192.0.0.170/31'),
IPv4Network('192.0.2.0/24'),
IPv4Network('192.168.0.0/16'),
IPv4Network('198.18.0.0/15'),
IPv4Network('198.51.100.0/24'),
IPv4Network('203.0.113.0/24'),
IPv4Network('240.0.0.0/4'),
IPv4Network('255.255.255.255/32'),
]
_reserved_network = IPv4Network('240.0.0.0/4')
_unspecified_address = IPv4Address('0.0.0.0')
IPv4Address._constants = _IPv4Constants
IPv4Network._constants = _IPv4Constants
This network is defined as an exception when checking whether a network is in the public space.
@property
@functools.lru_cache()
def is_global(self):
return self not in self._constants._public_network and not self.is_private
The idea
The idea is to redefine the “_public_network” variable as “_iana_reserved_network” in order to correctly define the Shared Address Space.
The creation of an associated test will be appreciated.
I can open an issue following the community approval.
Regards,