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.pl14
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/firewall/vyatta-ipset.pl b/scripts/firewall/vyatta-ipset.pl
index 99ae085..0f8c27e 100755
--- a/scripts/firewall/vyatta-ipset.pl
+++ b/scripts/firewall/vyatta-ipset.pl
@@ -32,13 +32,25 @@ use Vyatta::TypeChecker;
use Vyatta::Misc;
use Vyatta::IpTables::IpSet;
use Sort::Versions;
+use IO::Prompt;
use warnings;
use strict;
+
+sub warn_before_reset {
+ if (prompt("This can be temporarily disruptive: Proceed with reset? (Yes/No) [No] ", -ynd=>"n")) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
sub ipset_reset {
my ($set_name, $set_type) = @_;
-
+ if (!warn_before_reset()) {
+ die "Cancelling reset\n";
+ }
my $group = new Vyatta::IpTables::IpSet($set_name, $set_type);
return $group->reset_ipset();