]> git.proxmox.com Git - pve-firewall.git/commitdiff
skip tap rule generation if vmfw is disabled
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 7 Aug 2019 07:25:36 +0000 (09:25 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 7 Aug 2019 07:25:36 +0000 (09:25 +0200)
like for containers, and adapt code style to be identical.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/Firewall.pm

index 0e15090f3d7940c680fcc5aa8a6744d04d54f0e7..ff494d6cf6e031fe2e6c5ffa61e5afd081e041a2 100644 (file)
@@ -3592,7 +3592,7 @@ sub compile_iptables_filter {
        eval {
            my $conf = $vmdata->{qemu}->{$vmid};
            my $vmfw_conf = $vmfw_configs->{$vmid};
-           return if !$vmfw_conf;
+           return if !$vmfw_conf || !$vmfw_conf->{options}->{enable};
 
            foreach my $netid (sort keys %$conf) {
                next if $netid !~ m/^net(\d+)$/;
@@ -3615,9 +3615,7 @@ sub compile_iptables_filter {
         eval {
             my $conf = $vmdata->{lxc}->{$vmid};
             my $vmfw_conf = $vmfw_configs->{$vmid};
-            return if !$vmfw_conf;
-
-            if ($vmfw_conf->{options}->{enable}) {
+            return if !$vmfw_conf || !$vmfw_conf->{options}->{enable};
                foreach my $netid (sort keys %$conf) {
                     next if $netid !~ m/^net(\d+)$/;
                     my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid});
@@ -3628,7 +3626,6 @@ sub compile_iptables_filter {
                                                  $vmfw_conf, $vmid, 'IN', $ipversion);
                     generate_tap_rules_direction($ruleset, $cluster_conf, $iface, $netid, $macaddr,
                                                  $vmfw_conf, $vmid, 'OUT', $ipversion);
-               }
             }
         };
         warn $@ if $@; # just to be sure - should not happen