Remove cidr merge - takes too mucm memory.

This commit is contained in:
Adrian Woodley
2021-10-08 12:31:43 +08:00
parent 654b7fc054
commit ff82b3249b

View File

@@ -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')