Blob Blame History Raw
From 03668eda9ccb4be25fd7b3962975397eff44bfe5 Mon Sep 17 00:00:00 2001
From: David Moss <drkjam@gmail.com>
Date: Thu, 27 Aug 2015 08:01:02 +0100
Subject: [PATCH] - Fixed #71. Updated IPv4 reserved networks.

---
 netaddr/ip/__init__.py | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
index 0f7a93e22c3f8d63842fd6cecedabd6564d711b3..5537f5fec94016a17f9ef653f940fb8ea95a2365 100644
--- a/netaddr/ip/__init__.py
+++ b/netaddr/ip/__init__.py
@@ -1901,14 +1901,15 @@ def all_matching_cidrs(ip, cidrs):
 #-----------------------------------------------------------------------------
 #   Cached IPv4 address range lookups.
 #-----------------------------------------------------------------------------
-IPV4_LOOPBACK  = IPNetwork('127.0.0.0/8')
+IPV4_LOOPBACK  = IPNetwork('127.0.0.0/8')    #   Loopback addresses (RFC 990)
 
 IPV4_PRIVATE = (
-    IPNetwork('10.0.0.0/8'),                    #   Private-Use Networks
-    IPNetwork('100.64.0.0/10'),                 #   Shared address space
-    IPNetwork('172.16.0.0/12'),                 #   Private-Use Networks
-    IPNetwork('192.0.2.0/24'),                  #   Test-Net
-    IPNetwork('192.168.0.0/16'),                #   Private-Use Networks
+    IPNetwork('10.0.0.0/8'),        #   Class A private network local communication (RFC 1918)
+    IPNetwork('100.64.0.0/10'),     #   Carrier grade NAT (RFC 6598)
+    IPNetwork('172.16.0.0/12'),     #   Private network - local communication (RFC 1918)
+    IPNetwork('192.0.0.0/24'),      #   IANA IPv4 Special Purpose Address Registry (RFC 5736)
+    IPNetwork('192.168.0.0/16'),    #   Class B private network local communication (RFC 1918)
+    IPNetwork('198.18.0.0/15'),     #  Testing of inter-network communications between subnets (RFC 2544)
     IPRange('239.0.0.0', '239.255.255.255'),    #   Administrative Multicast
 )
 
@@ -1916,19 +1917,20 @@ IPV4_LINK_LOCAL = IPNetwork('169.254.0.0/16')
 
 IPV4_MULTICAST = IPNetwork('224.0.0.0/4')
 
-IPV4_6TO4 = IPNetwork('192.88.99.0/24')    #   6to4 Relay Anycast
+IPV4_6TO4 = IPNetwork('192.88.99.0/24')    #   6to4 anycast relays (RFC 3068)
 
 IPV4_RESERVED = (
-    IPNetwork('192.0.0.0/24'),      #   Reserved but subject to allocation
-    IPNetwork('240.0.0.0/4'),       #   Reserved for Future Use
-    IPNetwork('198.18.0.0/15'),     #   Benchmarking
-    IPNetwork('198.51.100.0/24'),   #   Examples for documentation
-    IPNetwork('203.0.113.0/24'),    #   Examples for documentation
+    IPNetwork('0.0.0.0/8'),         #   Broadcast message (RFC 1700)
+    IPNetwork('192.0.2.0/24'),      #   TEST-NET examples and documentation (RFC 5737)
+    IPNetwork('240.0.0.0/4'),       #   Reserved for  multicast assignments (RFC 5771)
+    IPNetwork('198.51.100.0/24'),   #   TEST-NET-2 examples and documentation (RFC 5737)
+    IPNetwork('203.0.113.0/24'),    #   TEST-NET-3 examples and documentation (RFC 5737)
 
     #   Reserved multicast
+    IPNetwork('233.252.0.0/24'),    #   Multicast test network
     IPRange('234.0.0.0', '238.255.255.255'),
     IPRange('225.0.0.0', '231.255.255.255'),
-)
+) + (IPV4_LOOPBACK, IPV4_6TO4)
 
 #-----------------------------------------------------------------------------
 #   Cached IPv6 address range lookups.
-- 
2.9.5