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

View file

@ -19,7 +19,7 @@ chain = iptc.Chain(table, args.chain)
# Check if rule exists # Check if rule exists
for rule in chain.rules: for rule in chain.rules:
src_ip = rule.src 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') print('Rule exists')
break break
else: else: