can't use RESERVED address in IPOption and NetworkOption
This commit is contained in:
parent
1c951558da
commit
c53d574ac2
|
@ -492,6 +492,8 @@ class IPOption(Option):
|
||||||
def _validate(self, value):
|
def _validate(self, value):
|
||||||
try:
|
try:
|
||||||
ip = IP('{0}/32'.format(value))
|
ip = IP('{0}/32'.format(value))
|
||||||
|
if ip.iptype() == 'RESERVED':
|
||||||
|
return False
|
||||||
if self._only_private:
|
if self._only_private:
|
||||||
return ip.iptype() == 'PRIVATE'
|
return ip.iptype() == 'PRIVATE'
|
||||||
return True
|
return True
|
||||||
|
@ -576,7 +578,9 @@ class NetworkOption(Option):
|
||||||
|
|
||||||
def _validate(self, value):
|
def _validate(self, value):
|
||||||
try:
|
try:
|
||||||
IP(value)
|
ip = IP(value)
|
||||||
|
if ip.iptype() == 'RESERVED':
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue