From 4a5a65f74a43ff33a0c4d54eec377502a6d05fdf Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Tue, 21 Sep 2010 17:35:37 -0700 Subject: * move count_iptables_rule to MISC module --- lib/Vyatta/Misc.pm | 13 ++++++++++++- lib/Vyatta/Zone.pm | 10 ---------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm index 5373f7f..b774f72 100755 --- a/lib/Vyatta/Misc.pm +++ b/lib/Vyatta/Misc.pm @@ -26,7 +26,8 @@ require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(getInterfaces getIP getNetAddIP get_sysfs_value is_address_enabled is_dhcp_enabled - isIpAddress is_ip_v4_or_v6 interface_description); + isIpAddress is_ip_v4_or_v6 interface_description + count_iptables_rules); our @EXPORT_OK = qw(generate_dhclient_intf_files getInterfacesIPadresses getPortRuleString); @@ -417,4 +418,14 @@ sub interface_description { return $description; } +sub count_iptables_rules { + my ($command, $table, $chain) = @_; + my @lines = `sudo $command -t $table -L $chain -n --line`; + my $cnt = 0; + foreach my $line (@lines) { + $cnt++ if $line =~ /^\d/; + } + return $cnt; +} + 1; diff --git a/lib/Vyatta/Zone.pm b/lib/Vyatta/Zone.pm index 4b169b5..eccf8ab 100755 --- a/lib/Vyatta/Zone.pm +++ b/lib/Vyatta/Zone.pm @@ -121,16 +121,6 @@ sub get_zone_chain { return $chain; } -sub count_iptables_rules { - my ($command, $table, $chain) = @_; - my @lines = `sudo $command -t $table -L $chain -n --line`; - my $cnt = 0; - foreach my $line (@lines) { - $cnt++ if $line =~ /^\d/; - } - return $cnt; -} - sub validity_checks { my @all_zones = get_all_zones("listNodes"); my @all_interfaces = (); -- cgit v1.2.3