diff --git a/main.py b/main.py index 8b6896c..294ccc2 100755 --- a/main.py +++ b/main.py @@ -285,7 +285,8 @@ class iptables: def add_specific_rule(ports, ip_type, chain, interface, subnet, protocol, direction): """Règles spécifique, fonction de factorisation""" if ip_type == '4': - self.add_in_subtable(chain, subtable, """-%s %s -p %s -m multiport --dports %s -j RETURN""" % (direction[0], interface['ipv4'], protocol, ports)) + if interface['ipv4']: + self.add_in_subtable(chain, subtable, """-%s %s -p %s -m multiport --dports %s -j RETURN""" % (direction[0], interface['ipv4'], protocol, ports)) if ip_type == '6': for ipv6_addr in interface['ipv6']: self.add_in_subtable(chain, subtable, """-%s %s -p %s -m multiport --dports %s -j RETURN""" % (direction[0], ipv6_addr['ipv6'], protocol, ports))