aboutsummaryrefslogtreecommitdiff
path: root/scripts/expand-roa-prefixes.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2011-05-07 13:16:12 +0000
committerRob Austein <sra@hactrn.net>2011-05-07 13:16:12 +0000
commit7ee51d5d290618c556d294702e32f0fe65d764e5 (patch)
tree9a8c442bd563ae9acb5d5cde7dd91a47baea5af7 /scripts/expand-roa-prefixes.py
parente1116581e37866426cb947931435a673238b09cf (diff)
xrange() doesn't really work with Python longs
svn path=/scripts/expand-roa-prefixes.py; revision=3804
Diffstat (limited to 'scripts/expand-roa-prefixes.py')
-rw-r--r--scripts/expand-roa-prefixes.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/expand-roa-prefixes.py b/scripts/expand-roa-prefixes.py
index b785665d..e5c54f27 100644
--- a/scripts/expand-roa-prefixes.py
+++ b/scripts/expand-roa-prefixes.py
@@ -45,13 +45,14 @@ for prefix_set in prefix_sets:
step = (1L << (prefix_type.bits - prefixlen))
mask = step - 1
- for addr in xrange(prefix_min, prefix_max, step):
-
- addr = prefix_type(addr)
+ # xrange(prefix_min, prefix_max, step) throws OverflowError,
+ # so do this the non-Pythonic way
+ addr = prefix_min
+ while addr < prefix_max:
if (addr & mask) != 0:
raise RuntimeError, "%s is not a /%d prefix" % (addr, prefixlen)
-
sys.stdout.write(" %s/%d\n" % (addr, prefixlen))
+ addr = prefix_type(addr + step)
sys.stdout.write("\n")