summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2009-02-07 16:38:54 -0800
committerMohit Mehta <mohit.mehta@vyatta.com>2009-02-07 16:38:54 -0800
commitedd65831e7edbcefec1a48c13e5a0b6260dc04ca (patch)
tree4d167099dd51e10f351db529c4ab7efcf6fb927c
parent962d8092b35bfa067639a66d8e08fef4b021be5e (diff)
downloadvyatta-op-firewall-edd65831e7edbcefec1a48c13e5a0b6260dc04ca.tar.gz
vyatta-op-firewall-edd65831e7edbcefec1a48c13e5a0b6260dc04ca.zip
format 'show firewall' output
-rwxr-xr-xscripts/firewall/vyatta-show-firewall.pl21
-rw-r--r--src/xsl/show_firewall.xsl3
2 files changed, 14 insertions, 10 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;
diff --git a/src/xsl/show_firewall.xsl b/src/xsl/show_firewall.xsl
index 58ed045..273c88f 100644
--- a/src/xsl/show_firewall.xsl
+++ b/src/xsl/show_firewall.xsl
@@ -46,8 +46,7 @@
<xsl:template match="opcommand">
<xsl:text>&newln;</xsl:text>
-<xsl:text>&newln;</xsl:text>
-<xsl:text>State Codes: E - Established, I - Invalid, N - New, R - Related&newln;</xsl:text>
+<xsl:text>(State Codes: E - Established, I - Invalid, N - New, R - Related)&newln;</xsl:text>
<xsl:text>&newln;</xsl:text>
<xsl:text>rule action source destination proto state</xsl:text>
<xsl:text>&newln;</xsl:text>