Signed-off-by: Alexandre Derumier <[email protected]>
---
 src/PVE/Firewall.pm |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index d378c4f..630e5c4 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -1999,8 +1999,6 @@ sub compile {
 
     enable_host_firewall($ruleset, $hostfw_conf, $groups_conf) if 
$hostfw_enable;
 
-    my $ips_enable = undef;
-
     # generate firewall rules for QEMU VMs
     foreach my $vmid (keys %{$vmdata->{qemu}}) {
        my $conf = $vmdata->{qemu}->{$vmid};
@@ -2008,8 +2006,6 @@ sub compile {
        next if !$vmfw_conf;
        next if defined($vmfw_conf->{options}->{enable}) && 
($vmfw_conf->{options}->{enable} == 0);
 
-       $ips_enable = 1 if $vmfw_conf->{options}->{ips};
-
        foreach my $netid (keys %$conf) {
            next if $netid !~ m/^net(\d+)$/;
            my $net = PVE::QemuServer::parse_net($conf->{$netid});
@@ -2039,8 +2035,6 @@ sub compile {
        next if !$vmfw_conf;
        next if defined($vmfw_conf->{options}->{enable}) && 
($vmfw_conf->{options}->{enable} == 0);
 
-       $ips_enable = 1 if $vmfw_conf->{options}->{ips};
-
        if ($conf->{ip_address} && $conf->{ip_address}->{value}) {
            my $ip = $conf->{ip_address}->{value};
            generate_venet_rules_direction($ruleset, $groups_conf, $vmfw_conf, 
$vmid, $ip, 'IN');
@@ -2071,7 +2065,7 @@ sub compile {
 
     if($hostfw_options->{optimize}){
 
-       my $accept = $ips_enable ? "PVEFW-IPS" : "ACCEPT";
+       my $accept = ruleset_chain_exist($ruleset, "PVEFW-IPS") ? "PVEFW-IPS" : 
"ACCEPT";
        ruleset_insertrule($ruleset, "PVEFW-FORWARD", "-m conntrack --ctstate 
RELATED,ESTABLISHED -j $accept");
        ruleset_insertrule($ruleset, "PVEFW-FORWARD", "-m conntrack --ctstate 
INVALID -j DROP");
     }
-- 
1.7.10.4

_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to