diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-01-29 18:47:50 -0800 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-01-29 18:47:50 -0800 |
commit | c232d373f0783d850a5cf844a6d9b76e50c7a85f (patch) | |
tree | e8c7466074b9615606b7793cc9efee8498d505c5 /lib/Vyatta/IpTables | |
parent | e4146d5e14a8f63ec454b39c6a069e151b54ab1b (diff) | |
download | vyatta-cfg-firewall-c232d373f0783d850a5cf844a6d9b76e50c7a85f.tar.gz vyatta-cfg-firewall-c232d373f0783d850a5cf844a6d9b76e50c7a85f.zip |
Use iptables comment to identify CLI rule numbers in iptables output
Diffstat (limited to 'lib/Vyatta/IpTables')
-rw-r--r-- | lib/Vyatta/IpTables/Rule.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Vyatta/IpTables/Rule.pm b/lib/Vyatta/IpTables/Rule.pm index a7f1ebb..ff645b2 100644 --- a/lib/Vyatta/IpTables/Rule.pm +++ b/lib/Vyatta/IpTables/Rule.pm @@ -53,6 +53,7 @@ my %fields = ( }, _disable => undef, _ip_version => undef, + _comment => undef ); my %dummy_rule = ( @@ -101,6 +102,7 @@ my %dummy_rule = ( }, _disable => undef, _ip_version => undef, + _comment => undef ); sub new { @@ -125,6 +127,7 @@ sub setup { my ( $self, $level ) = @_; my $config = new Vyatta::Config; + $self->{_comment} = $level; $config->setLevel("$level"); # for documentation sake. nodes returns an array so must transform @@ -185,6 +188,7 @@ sub setupOrig { my ( $self, $level ) = @_; my $config = new Vyatta::Config; + $self->{_comment} = $level; $config->setLevel("$level"); # for documentation sake. nodes returns an array so must transform @@ -328,6 +332,10 @@ sub rule { my $srcrule = $dstrule = undef; my $err_str = undef; + # set CLI rule num as comment + my @level_nodes = split (' ', $self->{_comment}); + $rule .= "-m comment --comment \"$level_nodes[2]-$level_nodes[4]\" "; + # set the protocol if (defined($self->{_protocol})) { my $str = $self->{_protocol}; |