generate_ipset: skip undefined ipsets
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Apr 2014 10:43:54 +0000 (12:43 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Apr 2014 10:43:54 +0000 (12:43 +0200)
I introduced that bug when I changed die to warn.

src/PVE/API2/Firewall/IPSet.pm
src/PVE/Firewall.pm

index 45851d4..4dac1c4 100644 (file)
@@ -209,7 +209,6 @@ sub register_update_ip {
 
            my (undef, $digest) = PVE::Firewall::copy_list_with_digest($ipset);
            PVE::Tools::assert_if_modified($digest, $param->{digest});
-           warn "TEST:$digest:$param->{digest}:\n";
 
            foreach my $entry (@$ipset) {
                if($entry->{cidr} eq $param->{cidr}) {
index 8d25326..ac89966 100644 (file)
@@ -2462,11 +2462,13 @@ sub generate_ipset {
            my $alias = lc($cidr);
            if ($aliases->{$alias}) {
                $entry->{cidr} = $aliases->{$alias}->{cidr};
+               $nethash->{$entry->{cidr}} = $entry;
            } else {
                warn "no such alias '$cidr'\n" if !$aliases->{$alias};
            }
+       } else {
+           $nethash->{$entry->{cidr}} = $entry;
        }
-       $nethash->{$entry->{cidr}} = $entry;
     }
 
     foreach my $cidr (sort keys %$nethash) {