From 7c96d150ed5e0a9d05a03a5271e10fe5d6e94ab0 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 4 Jul 2016 10:14:21 +0200 Subject: [PATCH] Add support for flushing the used firewall chain. Signed-off-by: Stefan Schantl --- modules/Events.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/modules/Events.pm b/modules/Events.pm index 2d2c776..f8437de 100644 --- a/modules/Events.pm +++ b/modules/Events.pm @@ -296,6 +296,38 @@ sub CallUnblock ($) { return undef; } +# +## CallFlush function. +# +## This function is responsible for calling the used firewall +## engine to do a flush of the used firewall chain. This will +## clean the entire firewall chain. +# +sub CallFlush ($) { + my $self = shift; + + # Log the call for flushing. + $logger->Log("info", "Flush has been called..."); + + # Call flush. + my $error = &DoFlush(); + + # If an error message is returned, something went wrong. + if ($error) { + # Exit function and return the error message. + return $error; + } else { + # Flush successfully has been performed. + $logger->Log("debug", "Flush successfully has been performed..."); + } + + # Flush blockhash. + %blockhash = (); + + # Everything worked well, return nothing. + return undef; +} + # ## GenerateIgnoreList function. # -- 2.39.2