Remove cidr merge - takes too mucm memory.
This commit is contained in:
@@ -58,13 +58,13 @@ def build_ip_set():
|
|||||||
"""
|
"""
|
||||||
Take the list of subnets, merge them and load the iptables ipset
|
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 GEO hash:net -exist')
|
||||||
os.system('sudo ipset create GEO2 hash:net -exist')
|
os.system('sudo ipset create GEO2 hash:net -exist')
|
||||||
os.system('sudo ipset flush GEO2')
|
os.system('sudo ipset flush GEO2')
|
||||||
|
|
||||||
for subnet in summary_subnets:
|
for subnet in IPSubnets:
|
||||||
os.system('sudo ipset add GEO2 ' + str(subnet))
|
os.system('sudo ipset add GEO2 ' + subnet)
|
||||||
|
|
||||||
os.system('sudo ipset swap GEO GEO2')
|
os.system('sudo ipset swap GEO GEO2')
|
||||||
os.system('sudo ipset destroy GEO2')
|
os.system('sudo ipset destroy GEO2')
|
||||||
|
|||||||
Reference in New Issue
Block a user