error handling

This commit is contained in:
Stefan Midjich 2017-03-07 17:07:08 +01:00
parent 6214f65c0b
commit 3a0346b164

View file

@ -90,8 +90,14 @@ class Client(object):
for rule in self.chain.rules:
src_ip = rule.src
try:
_ip = str(ip_address.ip)
if src_ip.startswith(str(ip_address.ip)) and rule.protocol == protocol:
except:
# If we can't understand the argument just return None
return None
if src_ip.startswith(_ip) and rule.protocol == protocol:
return rule
else:
return None