From: Dietmar Maurer Date: Fri, 30 May 2014 11:06:55 +0000 (+0200) Subject: pass ipset errors to GUI X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=commitdiff_plain;h=d46b1ef6fb3ba5628a27ea26e7cda011ed588b91 pass ipset errors to GUI --- diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm index 8407e3c..b2bcc32 100644 --- a/src/PVE/Firewall.pm +++ b/src/PVE/Firewall.pm @@ -2269,23 +2269,28 @@ sub generic_fw_config_parser { $line =~ m/^(\!)?\s*(\S+)\s*$/; my $nomatch = $1; my $cidr = $2; + my $errors; + + if ($nomatch && !$feature_ipset_nomatch) { + $errors->{nomatch} = "nomatch not supported by kernel"; + } eval { if ($cidr =~ m/^${ip_alias_pattern}$/) { resolve_alias($cluster_conf, $res, $cidr); # make sure alias exists } else { $cidr =~ s|/32$||; - pve_verify_ipv4_or_cidr($cidr); + pve_verify_ipv4_or_cidr_or_alias($cidr); } }; if (my $err = $@) { - warn "$prefix: $cidr - $err"; - next; + $errors->{cidr} = $err; } my $entry = { cidr => $cidr }; $entry->{nomatch} = 1 if $nomatch; $entry->{comment} = $comment if $comment; + $entry->{errors} = $errors if $errors; push @{$res->{$section}->{$group}}, $entry; } else {