From: Stefan Schantl Date: Mon, 4 Jul 2016 08:14:21 +0000 (+0200) Subject: Add support for flushing the used firewall chain. X-Git-Tag: 2.0~12 X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fguardian.git;a=commitdiff_plain;h=7c96d150ed5e0a9d05a03a5271e10fe5d6e94ab0;hp=24bd3d1109cb280074d1a23e865a0b35257aa913 Add support for flushing the used firewall chain. Signed-off-by: Stefan Schantl --- 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. #