pvl.hosts-dns: support X.Y.Z-C style reverse prefxies for rfc2317 style delegations
authorTero Marttila <terom@paivola.fi>
Thu, 26 Dec 2013 13:11:33 +0200
changeset 341 82905d6bfb7a
parent 338 9198e2da360e
child 342 c0d2e731445f
pvl.hosts-dns: support X.Y.Z-C style reverse prefxies for rfc2317 style delegations
bin/pvl.hosts-dns
--- a/bin/pvl.hosts-dns	Sun Dec 22 19:24:36 2013 +0200
+++ b/bin/pvl.hosts-dns	Thu Dec 26 13:11:33 2013 +0200
@@ -130,6 +130,10 @@
 
         >>> parse_prefix('127.0.0.0/8')
         IPv4Network('127.0.0.0/8')
+        >>> parse_prefix('192.0.2.128/26')
+        IPv4Network('192.0.2.128/26')
+        >>> parse_prefix('192.0.2.128-26')
+        IPv4Network('192.0.2.128-26')
         >>> parse_prefix('127.')
         IPv4Network('127.0.0.0/8')
         >>> parse_prefix('10')
@@ -146,6 +150,9 @@
 
     if '/' in prefix :
         return ipaddr.IPNetwork(prefix)
+    
+    elif '-' in prefix :
+        return ipaddr.IPNetwork(prefix.replace('-', '/'))
 
     elif '.' in prefix or prefix.isdigit() :
         parts = prefix.rstrip('.').split('.')