Skip to content

Commit 30741a3

Browse files
author
Boris Schrijver
committed
Split the cidr lists so we won't hit the iptables-resture limits
1 parent 709be45 commit 30741a3

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

systemvm/patches/debian/config/opt/cloud/bin/configure.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,23 @@ def create(self):
217217

218218
def process(self, direction, rule_list, base):
219219
count = base
220-
for i in rule_list:
220+
rule_list_splitted = []
221+
for rule in rule_list:
222+
if ',' in rule['cidr']:
223+
cidrs = rule['cidr'].split(',')
224+
for cidr in cidrs:
225+
new_rule = {
226+
'cidr': cidr,
227+
'last_port': rule['last_port'],
228+
'type': rule['type'],
229+
'first_port': rule['first_port'],
230+
'allowed': rule['allowed']
231+
}
232+
rule_list_splitted.append(new_rule)
233+
else:
234+
rule_list_splitted.append(rule)
235+
236+
for i in rule_list_splitted:
221237
r = self.AclRule(direction, self, i, self.config, count)
222238
r.create()
223239
count += 1

0 commit comments

Comments
 (0)