From b0da3ed7b064ec6a209220c369bb34113e3f37f2 Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Thu, 22 Dec 2016 16:01:15 +0100 Subject: [PATCH] also check protocol for duplicate rules. --- tools/add_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/add_client.py b/tools/add_client.py index feebc6c..b1dc8f3 100644 --- a/tools/add_client.py +++ b/tools/add_client.py @@ -19,7 +19,7 @@ chain = iptc.Chain(table, args.chain) # Check if rule exists for rule in chain.rules: src_ip = rule.src - if src_ip.startswith(args.src_ip): + if src_ip.startswith(args.src_ip) and rule.protocol == args.protocol: print('Rule exists') break else: