From 3d27efba8b9b99f343c85218c3405e2a69687e8c Mon Sep 17 00:00:00 2001 From: "R. Miles McCain" Date: Tue, 7 Jul 2020 00:22:29 +0000 Subject: [PATCH] Check IP versions before comparing (fixes #57) --- shynet/analytics/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shynet/analytics/tasks.py b/shynet/analytics/tasks.py index 7b80762..4e1606c 100644 --- a/shynet/analytics/tasks.py +++ b/shynet/analytics/tasks.py @@ -64,7 +64,10 @@ def ingress_request( try: remote_ip = ipaddress.ip_network(ip) 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 except ValueError as e: log.exception(e)