diff options
-rwxr-xr-x | scripts/firewall/vyatta-show-firewall-summary.pl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/scripts/firewall/vyatta-show-firewall-summary.pl b/scripts/firewall/vyatta-show-firewall-summary.pl index fc0b5c9..dfcf776 100755 --- a/scripts/firewall/vyatta-show-firewall-summary.pl +++ b/scripts/firewall/vyatta-show-firewall-summary.pl @@ -1,7 +1,6 @@ #!/usr/bin/env perl use lib '/opt/vyatta/share/perl5/'; use Vyatta::FirewallOpMode::Summary; -use Data::Dumper; my %description_hash = ( 'name' => 'IPv4', 'ipv6-name' => 'IPv6', @@ -19,21 +18,20 @@ sub print_global_fw_header { } sub print_fw_ruleset_header { - print "\n" . "-" x 29 . "\n"; + print "\n" . "-" x 24 . "\n"; print "Firewall Rulesets\n"; - print "-" x 29 . "\n"; + print "-" x 24 . "\n"; } sub print_fw_group_header { - print "\n" . "-" x 29 . "\n"; + print "\n" . "-" x 24 . "\n"; print "Firewall Groups\n"; - print "-" x 29 . "\n"; + print "-" x 24 . "\n"; } - my $hash = Vyatta::FirewallOpMode::Summary::get_firewall_summary(); -if (defined $hash->{'global'}){ - print_global_fw_header; +print_global_fw_header; +if (scalar(keys(%{$hash->{'global'}})) > 0){ my $state_format = " %-15s %-8s %-8s\n"; print "\nFirewall state-policy for all IPv4 and Ipv6 traffic\n\n"; printf($state_format, 'state', 'action', 'log'); @@ -48,6 +46,7 @@ print_fw_ruleset_header; my $format = " %-26s%-15s%-s\n"; for my $tree (keys(%{$hash})){ next if ($tree eq 'global'); + next if (scalar(keys(%{$hash->{$tree}})) == 0); print "\n$description_hash{$tree} name:\n\n"; printf $format, 'Rule-set name', 'Description', 'References'; printf $format, '-------------', '-----------', '----------'; @@ -161,4 +160,3 @@ foreach my $type (keys(%{$gr_hash})){ } print "\n"; } -#print Dumper $gr_hash; |