summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-08-02 20:42:30 -0700
committerStig Thormodsrud <stig@vyatta.com>2008-08-02 20:42:30 -0700
commitf14b8d3ece4de61f8f0de0f2ef4dd4e2512527b2 (patch)
tree49850d014bd21f778c5677fa99566e6994d6ae46
parentb4453ca528607b6bf9871c17c23048465de3768c (diff)
downloadvyatta-nat-f14b8d3ece4de61f8f0de0f2ef4dd4e2512527b2.tar.gz
vyatta-nat-f14b8d3ece4de61f8f0de0f2ef4dd4e2512527b2.zip
Tweak "show nat translations" headings.
-rwxr-xr-xscripts/vyatta-nat-translations.pl32
1 files changed, 13 insertions, 19 deletions
diff --git a/scripts/vyatta-nat-translations.pl b/scripts/vyatta-nat-translations.pl
index e5e9e64..681845f 100755
--- a/scripts/vyatta-nat-translations.pl
+++ b/scripts/vyatta-nat-translations.pl
@@ -189,6 +189,19 @@ if (! -f $conntrack) {
my $xs = XML::Simple->new(ForceArray => 1, KeepRoot => 0);
my ($xml, $data);
+if (defined $verbose) {
+ printf($verbose_format, 'Pre-NAT src', 'Pre-NAT dst',
+ 'Post-NAT src', 'Post-NAT dst');
+} else {
+ printf($format, 'Pre-NAT', 'Post-NAT', 'Type', 'Prot', 'Timeout');
+ if (defined $pipe) {
+ # flush stdout after every write
+ $| = 1;
+ print " Type";
+ }
+ print "\n";
+}
+
if (defined $xml_file) {
$xml = read_xml_file($xml_file);
$data = $xs->XMLin($xml);
@@ -196,39 +209,20 @@ if (defined $xml_file) {
print_xml($data);
exit;
}
- if (defined $verbose) {
- printf($verbose_format, 'Inside src', 'Inside dst',
- 'Outside src', 'Outside dst');
- } else {
- printf($format, 'Pre-NAT', 'Post-NAT', 'Type', 'Prot', 'Timeout');
- print "\n";
- }
nat_print_xml($data, 'snat');
} elsif (defined $pipe) {
- # flush stdout after every write
- $| = 1;
- printf($format, 'Pre-NAT', 'Post-NAT', 'Type', 'Prot', 'Timeout');
- print " Type\n";
while ($xml = <STDIN>) {
$xml = add_xml_root($xml);
$data = $xs->XMLin($xml);
nat_print_xml($data, $mode);
}
} else {
-
if (defined $proto) {
$proto = "-p $proto"
} else {
$proto = "";
}
- if (defined $verbose) {
- printf($verbose_format, 'Inside src', 'Inside dst',
- 'Outside src', 'Outside dst');
- } else {
- printf($format, 'Pre-NAT', 'Post-NAT', 'Type', 'Prot', 'Timeout');
- print "\n";
- }
if ($mode eq 'both' or $mode eq 'snat') {
my $ipopt = "";
if (defined $ipaddr) {