]> git.ipfire.org Git - people/stevee/guardian.git/commitdiff
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 2d2c776b144248d54b9963a4402547fe56990044..f8437deedbf594d13dd1a34d4367b2dd23e33d61 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.
 #