]> git.proxmox.com Git - pve-firewall.git/blobdiff - src/PVE/Firewall.pm
start API
[pve-firewall.git] / src / PVE / Firewall.pm
index 8594c9e0e47cb583bea125dd02df385a0b5af052..d4de6f6eed702f84abd264b3307cb80dc34dcc96 100644 (file)
@@ -1154,7 +1154,7 @@ sub generate_group_rules {
 
     die "no such security group '$group'\n" if !$groups_conf->{$group};
 
 
     die "no such security group '$group'\n" if !$groups_conf->{$group};
 
-    my $rules = $groups_conf->{$group}->{rules};
+    my $rules = $groups_conf->{rules}->{$group};
 
     my $chain = "GROUP-${group}-IN";
 
 
     my $chain = "GROUP-${group}-IN";
 
@@ -1476,7 +1476,7 @@ sub parse_group_fw_rules {
     my $section;
     my $group;
 
     my $section;
     my $group;
 
-    my $res = { rules => [] };
+    my $res = { rules => {} };
 
     while (defined(my $line = <$fh>)) {
        next if $line =~ m/^#/;
 
     while (defined(my $line = <$fh>)) {
        next if $line =~ m/^#/;
@@ -1502,7 +1502,7 @@ sub parse_group_fw_rules {
            next;
        }
 
            next;
        }
 
-       push @{$res->{$group}->{$section}}, @$rules;
+       push @{$res->{$section}->{$group}}, @$rules;
     }
 
     return $res;
     }
 
     return $res;
@@ -1699,7 +1699,7 @@ sub compile {
     my $hostfw_options = {};
     my $hostfw_conf = {};
 
     my $hostfw_options = {};
     my $hostfw_conf = {};
 
-    $filename = "/etc/pve/local/host.fw";
+    my $filename = "/etc/pve/local/host.fw";
     if (my $fh = IO::File->new($filename, O_RDONLY)) {
        $hostfw_conf = parse_host_fw_rules($filename, $fh);
        $hostfw_options = $hostfw_conf->{options};
     if (my $fh = IO::File->new($filename, O_RDONLY)) {
        $hostfw_conf = parse_host_fw_rules($filename, $fh);
        $hostfw_options = $hostfw_conf->{options};