Add support for flushing the used firewall chain.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 4 Jul 2016 08:14:21 +0000 (10:14 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Mon, 4 Jul 2016 08:14:21 +0000 (10:14 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
modules/Events.pm

index 2d2c776..f8437de 100644 (file)
@@ -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.
 #