ignore empty strings in fixed address list

empty address string is used in the sample config for empty strings
touple, which shouldn't cause an exception
This commit is contained in:
itsikkes 2016-05-26 16:36:55 +03:00
parent e1cd671e0a
commit 3990806d8c
1 changed files with 6 additions and 2 deletions

View File

@ -67,5 +67,9 @@ class FixedRange(NetworkRange):
return "<FixedRange %s>" % (",".join(self._fixed_addresses))
def _get_range(self):
return [struct.unpack(">L", socket.inet_aton(address))[0]
for address in self._fixed_addresses]
address_range = []
for address in self._fixed_addresses:
if not address: # Empty string
continue
address_range.append(struct.unpack(">L", socket.inet_aton(address))[0])
return address_range