X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftemplate-qemu%2Fiptables.py;h=8e1f92ef7e91b141ce738a10592e0ba53591043d;hb=a161111621b56df355e7473ba28d0e667105409e;hp=bd0b087af60e19f2922a424b51c3ca000940ee1b;hpb=1013341ba08b9898c5721ad25bdbff934489c692;p=tests.git diff --git a/system/template-qemu/iptables.py b/system/template-qemu/iptables.py index bd0b087..8e1f92e 100755 --- a/system/template-qemu/iptables.py +++ b/system/template-qemu/iptables.py @@ -10,14 +10,15 @@ def main (): found=False lo_matcher=re.compile("\A(?P.+)\s+-i\s+lo\s+-j\s+ACCEPT") - ip_matcher=re.compile("--(source|destination) %s"%ip) + # what comes out of iptables-save has short-options syntax + ip_matcher=re.compile(".*-(s|d) %s"%ip) for line in fin.readlines(): attempt=lo_matcher.match(line) if attempt: fou.write(line) # open-up for this IP - fou.write("%s --source %s -j ACCEPT\n"%(attempt.group('left'),ip)) - fou.write("%s --destination %s -j ACCEPT\n"%(attempt.group('left'),ip)) + fou.write("%s -s %s -j ACCEPT\n"%(attempt.group('left'),ip)) + fou.write("%s -d %s -j ACCEPT\n"%(attempt.group('left'),ip)) found=True else: attempt = ip_matcher.match(line)