pvl.hosts-dns: support X.Y.Z-C style reverse prefxies for rfc2317 style delegations
--- 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('.')