summaryrefslogtreecommitdiff
path: root/scripts/firewall/vyatta-ipset.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/firewall/vyatta-ipset.pl')
-rwxr-xr-xscripts/firewall/vyatta-ipset.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/firewall/vyatta-ipset.pl b/scripts/firewall/vyatta-ipset.pl
index 3ccd4c3..d1baabb 100755
--- a/scripts/firewall/vyatta-ipset.pl
+++ b/scripts/firewall/vyatta-ipset.pl
@@ -93,6 +93,20 @@ sub ipset_check_set_type {
return;
}
+sub ipset_show_members {
+ my ($set_name) = @_;
+
+ 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 @members = $group->get_members();
+ print "Name : $set_name\n";
+ print "Type : $type\n";
+ print "Members:\n";
+ print @members;
+ return;
+}
#
# main
@@ -121,6 +135,8 @@ $rc = ipset_delete_member($set_name, $member) if $action eq 'delete-member';
$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';
+
if (defined $rc) {
print $rc;
exit 1;