From ff82b3249bcf64cde458447fdeb8010f83bfeb6a Mon Sep 17 00:00:00 2001 From: Adrian Woodley Date: Fri, 8 Oct 2021 12:31:43 +0800 Subject: [PATCH] Remove cidr merge - takes too mucm memory. --- geofirewall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geofirewall.py b/geofirewall.py index 02543f4..3882465 100755 --- a/geofirewall.py +++ b/geofirewall.py @@ -58,13 +58,13 @@ def build_ip_set(): """ Take the list of subnets, merge them and load the iptables ipset """ - summary_subnets = netaddr.cidr_merge(IPSubnets) + # summary_subnets = netaddr.cidr_merge(IPSubnets) os.system('sudo ipset create GEO hash:net -exist') os.system('sudo ipset create GEO2 hash:net -exist') os.system('sudo ipset flush GEO2') - for subnet in summary_subnets: - os.system('sudo ipset add GEO2 ' + str(subnet)) + for subnet in IPSubnets: + os.system('sudo ipset add GEO2 ' + subnet) os.system('sudo ipset swap GEO GEO2') os.system('sudo ipset destroy GEO2')