New issue 49 by ipsecpl: Incorrect IP range recognition on IPs with leading
zeros
http://code.google.com/p/netaddr/issues/detail?id=49
Python 2.5.2 (r252:60911, Aug 12 2008, 11:14:20)
[GCC 3.3.5 (propolice)] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import netaddr
>>> r1='208.049.164.000'
>>> r2='208.050.066.255'
>>> netaddr.IPRange(r1,r2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/site-packages/netaddr/address.py", line
1122, in __init__
raise IndexError('start address is greater than stop address!')
IndexError: start address is greater than stop address!
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
BTW it's netaddr version 0.6.3
In 0.7.3 the message is different:
Traceback (most recent call last):
File "iblocklist2pf.py", line 16, in <module>
iprange = netaddr.IPRange(r1,r2)
File "/usr/local/lib/python2.5/site-packages/netaddr/ip/__init__.py",
line 1167, in
__init__
raise AddrFormatError('lower bound IP greater than upper bound!')
netaddr.core.AddrFormatError: lower bound IP greater than upper bound!
I'm not able to replicate your error and get a completely different error :-
>>> import netaddr
>>> netaddr.__version__
0.7.3
>>> r1 = '208.049.164.000'
>>> r2 = '208.050.066.255'
>>> netaddr.IPRange(r1, r2)
Traceback (most recent call last):
File "<string>", line 1, in ?
File "/usr/local/lib/python2.4/site-packages/netaddr/ip/__init__.py",
line 1163, in
__init__
self._start = IPAddress(start)
File "/usr/local/lib/python2.4/site-packages/netaddr/ip/__init__.py",
line 262, in
__init__
self.value = addr
File "/usr/local/lib/python2.4/site-packages/netaddr/ip/__init__.py",
line 290, in
_set_value
raise AddrFormatError('failed to detect IP version: %r'
netaddr.core.AddrFormatError: failed to detect IP version: '208.049.164.000'
This is both under Linux and Windows. From your output I take it you are
using OpenBSD?
Can you run the following and specify what the value of the OPT_IMPORTS
variable is
in your interpreter :-
>>> import netaddr
>>> netaddr.strategy.ipv4.OPT_IMPORTS