diff options
author | Stig Thormodsrud <stig@io.vyatta.com> | 2009-02-13 15:24:01 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@io.vyatta.com> | 2009-02-13 15:24:01 -0800 |
commit | 95aa4b58d430551ec0087f1951f4a2d7e18a2497 (patch) | |
tree | ae9c048c37fc7f558396d0420899d7454997eb8a /scripts | |
parent | 4d030e8c3c0f289de8471b91bc6b789592254b46 (diff) | |
download | vyatta-cfg-firewall-95aa4b58d430551ec0087f1951f4a2d7e18a2497.tar.gz vyatta-cfg-firewall-95aa4b58d430551ec0087f1951f4a2d7e18a2497.zip |
Add show-set to display all sets.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/firewall/vyatta-ipset.pl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/firewall/vyatta-ipset.pl b/scripts/firewall/vyatta-ipset.pl index d1baabb..81e3e47 100755 --- a/scripts/firewall/vyatta-ipset.pl +++ b/scripts/firewall/vyatta-ipset.pl @@ -99,7 +99,7 @@ sub ipset_show_members { die "Error: undefined set_name\n" if ! defined $set_name; my $group = new Vyatta::IpTables::IpSet($set_name); return "Group [$set_name] has not been defined\n" if ! $group->exists(); - my $type = $group->get_type(); + my $type = $group->get_type(); my @members = $group->get_members(); print "Name : $set_name\n"; print "Type : $type\n"; @@ -108,6 +108,17 @@ sub ipset_show_members { return; } +sub ipset_show_sets { + my @lines = `ipset -L -n`; + foreach my $line (@lines) { + if ($line =~ /^Name:\s+(\S+)$/ ) { + ipset_show_members($1); + print "\n"; + } + } + return; +} + # # main # @@ -137,6 +148,8 @@ $rc = ipset_check_set_type($set_name, $set_type) if $action eq 'check-set-type'; $rc = ipset_show_members($set_name) if $action eq 'show-set-members'; +$rc = ipset_show_sets() if $action eq 'show-sets'; + if (defined $rc) { print $rc; exit 1; |