Check IP versions before comparing (fixes #57)

This commit is contained in:
R. Miles McCain 2020-07-07 00:22:29 +00:00
parent 80c66ceb8e
commit 3d27efba8b
No known key found for this signature in database
GPG Key ID: F1053629E2905557

View File

@ -64,7 +64,10 @@ def ingress_request(
try: try:
remote_ip = ipaddress.ip_network(ip) remote_ip = ipaddress.ip_network(ip)
for ignored_network in service.get_ignored_networks(): for ignored_network in service.get_ignored_networks():
if ignored_network.supernet_of(remote_ip): if (
ignored_network.version == remote_ip.version
and ignored_network.supernet_of(remote_ip)
):
return return
except ValueError as e: except ValueError as e:
log.exception(e) log.exception(e)