summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Sinha <gaurav.sinha@vyatta.com>2012-11-19 12:31:29 -0800
committerGaurav Sinha <gaurav.sinha@vyatta.com>2012-11-19 12:31:29 -0800
commit51a7cc7cb639adc2cdf8c3a4028a20f75d8d5eeb (patch)
tree9ebb6f317f858511a5f81965bc83aba9e4bcf6e2
parent8b73ec3cd927f95d0a6ac2b02a1f718e0d1ea349 (diff)
downloadvyatta-cfg-firewall-51a7cc7cb639adc2cdf8c3a4028a20f75d8d5eeb.tar.gz
vyatta-cfg-firewall-51a7cc7cb639adc2cdf8c3a4028a20f75d8d5eeb.zip
initial script for reset firewall group command
(cherry picked from commit c10ab7f443c581ffd31779f6e32b0d28f5c8366f) (cherry picked from commit 2029744d3b7cc83b7568e3fa474c8d079efece38) Conflicts: scripts/firewall/vyatta-ipset.pl
-rwxr-xr-xlib/Vyatta/IpTables/IpSet.pm16
-rwxr-xr-xscripts/firewall/vyatta-ipset.pl9
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/Vyatta/IpTables/IpSet.pm b/lib/Vyatta/IpTables/IpSet.pm
index 583085e..aa06540 100755
--- a/lib/Vyatta/IpTables/IpSet.pm
+++ b/lib/Vyatta/IpTables/IpSet.pm
@@ -211,6 +211,22 @@ sub flush {
return;
}
+sub reset_ipset {
+ # main function to do the reset operation
+
+ my ($self) = @_;
+ my $name = $self->{_name};
+ print " ipset type $self->{__type}\n";
+ # reset one rule or all?
+ if ($name eq 'all') {
+ print "reset all ipset rules\n";
+ #reset_ipset_all();
+ } else {
+ print "reset ipset rule $name\n";
+ #reset_ipset_named();
+ }
+}
+
sub delete {
my ($self) = @_;
diff --git a/scripts/firewall/vyatta-ipset.pl b/scripts/firewall/vyatta-ipset.pl
index ef964f3..99ae085 100755
--- a/scripts/firewall/vyatta-ipset.pl
+++ b/scripts/firewall/vyatta-ipset.pl
@@ -36,6 +36,13 @@ use Sort::Versions;
use warnings;
use strict;
+sub ipset_reset {
+ my ($set_name, $set_type) = @_;
+
+ my $group = new Vyatta::IpTables::IpSet($set_name, $set_type);
+
+ return $group->reset_ipset();
+}
sub ipset_create {
my ($set_name, $set_type) = @_;
@@ -310,6 +317,8 @@ GetOptions("action=s" => \$action,
die "undefined action" if ! defined $action;
my $rc;
+$rc = ipset_reset($set_name, $set_type) if $action eq 'reset-set';
+
$rc = ipset_create($set_name, $set_type) if $action eq 'create-set';
$rc = ipset_delete($set_name) if $action eq 'delete-set';