diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-02-07 16:38:54 -0800 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-02-07 16:38:54 -0800 |
commit | edd65831e7edbcefec1a48c13e5a0b6260dc04ca (patch) | |
tree | 4d167099dd51e10f351db529c4ab7efcf6fb927c /scripts | |
parent | 962d8092b35bfa067639a66d8e08fef4b021be5e (diff) | |
download | vyatta-op-firewall-edd65831e7edbcefec1a48c13e5a0b6260dc04ca.tar.gz vyatta-op-firewall-edd65831e7edbcefec1a48c13e5a0b6260dc04ca.zip |
format 'show firewall' output
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/firewall/vyatta-show-firewall.pl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/scripts/firewall/vyatta-show-firewall.pl b/scripts/firewall/vyatta-show-firewall.pl index f103dfc..81d97de 100755 --- a/scripts/firewall/vyatta-show-firewall.pl +++ b/scripts/firewall/vyatta-show-firewall.pl @@ -64,9 +64,9 @@ sub show_interfaces { } } if (scalar(@int_strs) > 0) { - print "\nActive on " . (join ' ', @int_strs) . "\n"; + print " Active on " . (join ' ', @int_strs) . "\n"; } else { - print "\nInactive: Not applied to any interfaces.\n"; + print " Inactive - Not applied to any interfaces.\n"; } } @@ -182,13 +182,16 @@ if ($tree_name eq "all") { my $description = $description_hash{$tree}; $config->setLevel("firewall $tree"); @chains = $config->listOrigNodes(); + my $chain_cnt=0; + print "-" x 80 . "\n" if (scalar(@chains) > 0); foreach (sort @chains) { - print "$description Firewall \"$_\":\n"; + $chain_cnt++; + print "$description Firewall \"$_\":"; show_interfaces($_); open(RENDER, "| /opt/vyatta/sbin/render_xml $xsl_file") or exit 1; show_chain($_, *RENDER{IO}, $tree); close RENDER; - print "-" x 80 . "\n"; + print "-" x 80 . "\n" if ($chain_cnt < scalar(@chains)); } } } elsif ($chain_name eq "all") { @@ -197,13 +200,16 @@ if ($tree_name eq "all") { my $description = $description_hash{$tree}; $config->setLevel("firewall $tree"); @chains = $config->listOrigNodes(); + my $chain_cnt=0; + print "-" x 80 . "\n" if (scalar(@chains) > 0); foreach (sort @chains) { - print "$description Firewall \"$_\":\n"; + $chain_cnt++; + print "$description Firewall \"$_\":"; show_interfaces($_); open(RENDER, "| /opt/vyatta/sbin/render_xml $xsl_file") or exit 1; show_chain($_, *RENDER{IO}, $tree); + print "-" x 80 . "\n" if ($chain_cnt < scalar(@chains)); close RENDER; - print "-" x 80 . "\n"; } } else { # Print given rule set in specified tree @@ -225,12 +231,11 @@ if ($tree_name eq "all") { } } my $description = $description_hash{$tree}; - print "$description Firewall \"$chain_name\":\n"; + print "\n$description Firewall \"$chain_name\":"; show_interfaces($chain_name); open(RENDER, "| /opt/vyatta/sbin/render_xml $xsl_file") or exit 1; show_chain($chain_name, *RENDER{IO}, $tree); close RENDER; - print "-" x 80 . "\n"; } exit 0; |