From 48abdef97b582c8d857fe338d69492f55dfffdf2 Mon Sep 17 00:00:00 2001 From: Gaurav Sinha Date: Sat, 17 Nov 2012 01:33:33 -0800 Subject: Add show functions for allowed scripts for firewall groups (cherry picked from commit 8a2bc83dff27b99a6cde3c396936741d96dc915c) --- scripts/firewall/vyatta-ipset.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/firewall/vyatta-ipset.pl b/scripts/firewall/vyatta-ipset.pl index 0f8c27e..ddac0b9 100755 --- a/scripts/firewall/vyatta-ipset.pl +++ b/scripts/firewall/vyatta-ipset.pl @@ -313,6 +313,30 @@ sub prune_deleted_sets { exit 0; } +sub show_network_groups { + my $config = new Vyatta::Config; + my @port_groups = $config->listOrigNodes("firewall group network-group"); + my $group; + foreach $group (@port_groups) { + print "$group\n"; + } +} +sub show_address_groups { + my $config = new Vyatta::Config; + my @port_groups = $config->listOrigNodes("firewall group address-group"); + my $group; + foreach $group (@port_groups) { + print "$group\n"; + } +} +sub show_port_groups { + my $config = new Vyatta::Config; + my @port_groups = $config->listOrigNodes("firewall group port-group"); + my $group; + foreach $group (@port_groups) { + print "$group\n"; + } +} # # main # @@ -329,6 +353,10 @@ GetOptions("action=s" => \$action, die "undefined action" if ! defined $action; my $rc; +show_port_groups() if $action eq 'show-port-groups'; +show_address_groups() if $action eq 'show-address-groups'; +show_network_groups() if $action eq 'show-network-groups'; + $rc = ipset_reset($set_name, $set_type) if $action eq 'reset-set'; $rc = ipset_create($set_name, $set_type) if $action eq 'create-set'; -- cgit v1.2.3