]> git.proxmox.com Git - pve-firewall.git/blobdiff - src/PVE/Firewall.pm
bugfix : ruleset_generate_cmdstr : use -d for destination
[pve-firewall.git] / src / PVE / Firewall.pm
index ba0ddae897299c20563dda989441cebe9b79a7c1..000455f554c43ae5543913a27e87a3d52438d009 100644 (file)
@@ -56,6 +56,13 @@ PVE::JSONSchema::register_standard_option('ipset-name', {
     maxLength => 20,                     
 });
 
+PVE::JSONSchema::register_standard_option('pve-fw-loglevel' => {
+    description => "Log level.",
+    type => 'string', 
+    enum => ['emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug', 'nolog'],
+    optional => 1,
+});
+
 my $security_group_pattern = '[A-Za-z][A-Za-z0-9\-\_]+';
 
 PVE::JSONSchema::register_standard_option('pve-security-group-name', {
@@ -1218,7 +1225,7 @@ sub ruleset_generate_cmdstr {
            push @cmd, "-m iprange --dst-range $dest";
 
        } else {
-           push @cmd, "-s $dest";
+           push @cmd, "-d $dest";
         }
     }
 
@@ -2277,6 +2284,7 @@ sub generate_std_chains {
 
     # same as shorewall smurflog.
     my $chain = 'PVEFW-smurflog';
+    $pve_std_chains->{$chain} = [];
 
     push @{$pve_std_chains->{$chain}}, get_log_rule_base($chain, 0, "DROP: ", $loglevel) if $loglevel;
     push @{$pve_std_chains->{$chain}}, "-j DROP";
@@ -2284,6 +2292,8 @@ sub generate_std_chains {
     # same as shorewall logflags action.
     $loglevel = get_option_log_level($options, 'tcp_flags_log_level');
     $chain = 'PVEFW-logflags';
+    $pve_std_chains->{$chain} = [];
+
     # fixme: is this correctly logged by pvewf-logger? (ther is no --log-ip-options for NFLOG)
     push @{$pve_std_chains->{$chain}}, get_log_rule_base($chain, 0, "DROP: ", $loglevel) if $loglevel;
     push @{$pve_std_chains->{$chain}}, "-j DROP";
@@ -2493,7 +2503,6 @@ sub compile {
 
     my $routing_table = read_proc_net_route();
 
-
     my $ipset_ruleset = {};
     generate_ipset_chains($ipset_ruleset, $cluster_conf);
 
@@ -2882,11 +2891,7 @@ sub update {
        die "Firewall is disabled - cannot start\n" if !$enable && $start;
 
        if (!$enable) {
-           if ($status ne 'stopped') {
-               print "trying to stop firewall (firewall is disabled)\n" if $verbose;
-               PVE::Firewall::remove_pvefw_chains();
-               PVE::Firewall::save_pvefw_status('stopped');
-           }
+           PVE::Firewall::remove_pvefw_chains();
            print "Firewall disabled\n" if $verbose;
            return;
        }