also check protocol for duplicate rules.

This commit is contained in:
Stefan Midjich 2016-12-22 16:01:15 +01:00
parent 131b5f4f29
commit b0da3ed7b0
1 changed files with 1 additions and 1 deletions

View File

@ -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: