]> git.proxmox.com Git - pve-firewall.git/commitdiff
whitespace/indentation/line-length cleanup
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 Aug 2022 13:51:11 +0000 (15:51 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 Aug 2022 13:54:05 +0000 (15:54 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Firewall.pm
src/PVE/Service/pve_firewall.pm

index 71746d227149b1b739269e3036df037eb91143ce..e2331d865808154f9685e0cb2d678b53768215ff 100644 (file)
@@ -3156,13 +3156,13 @@ sub read_local_vm_config {
                }
            }
         } elsif ($d->{type} eq 'lxc') {
-            if ($have_lxc) {
-                my $cfspath = PVE::LXC::Config->cfs_config_path($vmid);
-                if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
-                    $lxc->{$vmid} = $conf;
-                }
-            }
-        }
+           if ($have_lxc) {
+               my $cfspath = PVE::LXC::Config->cfs_config_path($vmid);
+               if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
+                   $lxc->{$vmid} = $conf;
+               }
+           }
+       }
     }
 
     return $vmdata;
@@ -4040,7 +4040,7 @@ sub generate_tap_layer2filter {
     ruleset_create_chain($ruleset, $tapchain);
 
     if (defined($macaddr) && !(defined($options->{macfilter}) && $options->{macfilter} == 0)) {
-           ruleset_addrule($ruleset, $tapchain, "-s ! $macaddr", '-j DROP');
+       ruleset_addrule($ruleset, $tapchain, "-s ! $macaddr", '-j DROP');
     }
 
     if (@$arpfilter){
index 5a62f3dbf1710cee1f4ad90715cd3c2fa56c612e..67b7c44579fda7d85272c272d2c4e2ae7697a252 100755 (executable)
@@ -2,20 +2,22 @@ package PVE::Service::pve_firewall;
 
 use strict;
 use warnings;
-use PVE::SafeSyslog;
-use PVE::Daemon;
 
-use Time::HiRes qw (gettimeofday);
-use PVE::Tools qw(dir_glob_foreach file_read_firstline);
-use PVE::ProcFSTools;
-use PVE::INotify;
+use Data::Dumper;
+use Time::HiRes qw (gettimeofday usleep);
+
+use PVE::CLIHandler;
 use PVE::Cluster qw(cfs_read_file);
 use PVE::Corosync;
+use PVE::Daemon;
+use PVE::INotify;
+use PVE::ProcFSTools;
 use PVE::RPCEnvironment;
-use PVE::CLIHandler;
+use PVE::SafeSyslog;
+use PVE::Tools qw(dir_glob_foreach file_read_firstline);
+
 use PVE::Firewall;
 use PVE::FirewallSimulator;
-use Data::Dumper;
 
 use base qw(PVE::Daemon);
 
@@ -28,7 +30,6 @@ my $daemon = __PACKAGE__->new('pve-firewall', $cmdline, %daemon_options);
 my $nodename = PVE::INotify::nodename();
 
 sub init {
-
     PVE::Cluster::cfs_update();
 
     PVE::Firewall::init();
@@ -70,7 +71,6 @@ sub run {
     local $SIG{'__WARN__'} = 'IGNORE'; # do not fill up logs
 
     for (;;) { # forever
-
        $next_update = time() + $updatetime;
 
        my ($ccsec, $cusec) = gettimeofday ();
@@ -116,9 +116,10 @@ sub run {
 
 $daemon->register_start_command("Start the Proxmox VE firewall service.");
 $daemon->register_restart_command(1, "Restart the Proxmox VE firewall service.");
-$daemon->register_stop_command("Stop firewall. This removes all Proxmox VE " .
-                              "related iptable rules. " .
-                              "The host is unprotected afterwards.");
+$daemon->register_stop_command(
+    "Stop the Proxmox VE firewall service. Note, stopping actively removes all Proxmox VE related"
+    ." iptable rules rendering the host potentially unprotected."
+);
 
 __PACKAGE__->register_method ({
     name => 'status',
@@ -302,7 +303,8 @@ __PACKAGE__->register_method ({
     name => 'simulate',
     path => 'simulate',
     method => 'GET',
-    description => "Simulate firewall rules. This does not simulate kernel 'routing' table. Instead, this simply assumes that routing from source zone to destination zone is possible.",
+    description => "Simulate firewall rules. This does not simulates the kernel 'routing' table,"
+       ." but simply assumes that routing from source zone to destination zone is possible.",
     parameters => {
        additionalProperties => 0,
        properties => {
@@ -406,8 +408,8 @@ __PACKAGE__->register_method ({
 
        $test->{action} = 'QUERY';
 
-       my $res = PVE::FirewallSimulator::simulate_firewall($ruleset->{filter}, $ipset_ruleset,
-                                                           $host_ip, $vmdata, $test);
+       my $res = PVE::FirewallSimulator::simulate_firewall(
+           $ruleset->{filter}, $ipset_ruleset, $host_ip, $vmdata, $test);
 
        print "ACTION: $res\n";