summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;