diff options
author | Daniil Baturin <daniil.baturin@vyatta.com> | 2011-12-10 01:29:33 +0700 |
---|---|---|
committer | Daniil Baturin <daniil.baturin@vyatta.com> | 2011-12-10 01:29:33 +0700 |
commit | 7adc67d8d060f269b8eb90d4f0d8f381a11b7cd5 (patch) | |
tree | 0fb07651477892cf97a364a0a2be1fb1482c8f75 | |
parent | f6656b5383fc8c18d258d3795746b346ec99dfb2 (diff) | |
download | vyatta-nat-7adc67d8d060f269b8eb90d4f0d8f381a11b7cd5.tar.gz vyatta-nat-7adc67d8d060f269b8eb90d4f0d8f381a11b7cd5.zip |
Bug #6365: Display rule description in "show nat * rules" output.
-rwxr-xr-x | scripts/vyatta-show-nat-rules.pl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/vyatta-show-nat-rules.pl b/scripts/vyatta-show-nat-rules.pl index ed21020..554670c 100755 --- a/scripts/vyatta-show-nat-rules.pl +++ b/scripts/vyatta-show-nat-rules.pl @@ -18,13 +18,14 @@ # # Author: Mohit Mehta # Date: January 2009 -# Description: Script to generate output for "show nat rules" command +# Description: Script to generate output for "show nat <source|destination> rules" commands # # **** End License **** # use strict; use Getopt::Long; +use Text::Wrap qw(wrap 80 wrap); use lib "/opt/vyatta/share/perl5"; use Vyatta::Config; use Vyatta::NatRuleCommon; @@ -191,7 +192,7 @@ print_constants(); for $rule (@rules) { my ($rulenum, $protocol, $interface, $source_addr, $source_port, $destination_addr, $destination_port, $translation_addr, $translation_port, - $translation_addr_str, $translation_port_str, $condition); + $translation_addr_str, $translation_port_str, $condition, $description); $rulenum = $rule; $protocol = "all"; @@ -216,6 +217,8 @@ for $rule (@rules) { $source_port = get_srcdst_port("$level $rule source"); $destination_port = get_srcdst_port("$level $rule destination"); + $description = $config->returnOrigValue("$rule description"); + if ($type eq 'source') { my $raw_translation_addr = get_inout_address("$level $rule", "_outside_addr"); if ($raw_translation_addr eq "masquerade") { @@ -247,7 +250,9 @@ for $rule (@rules) { print "\n"; printf ($format2, $protocol, $translation_port_str); print "\n"; - printf ($format1, "", "", "$condition\n") if $condition; + printf ($format1, "", "", "$condition") if $condition; + print "\n" if $condition; + print wrap("", "", "Desc: $description\n") if $description; } print "\n"; |