summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@io.vyatta.com>2009-02-13 15:24:01 -0800
committerStig Thormodsrud <stig@io.vyatta.com>2009-02-13 15:24:01 -0800
commit95aa4b58d430551ec0087f1951f4a2d7e18a2497 (patch)
treeae9c048c37fc7f558396d0420899d7454997eb8a
parent4d030e8c3c0f289de8471b91bc6b789592254b46 (diff)
downloadvyatta-cfg-firewall-95aa4b58d430551ec0087f1951f4a2d7e18a2497.tar.gz
vyatta-cfg-firewall-95aa4b58d430551ec0087f1951f4a2d7e18a2497.zip
Add show-set to display all sets.
-rwxr-xr-xscripts/firewall/vyatta-ipset.pl15
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;