[2/3] initscripts/suricata: Move functions order and always useflush_fw_chain function

Message ID 20190425173148.3868-2-stefan.schantl@ipfire.org
State Accepted
Commit 5e3067cb52bdb613a193c2c0280e07d10c30f6de
Headers
Series [1/3] firewall: Use seperate firewall chains for passingtraffic to the IPS |

Commit Message

Stefan Schantl April 26, 2019, 3:31 a.m. UTC
  Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 src/initscripts/system/suricata | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suricata
index ecd693054..233cded53 100644
--- a/src/initscripts/system/suricata
+++ b/src/initscripts/system/suricata
@@ -48,12 +48,18 @@  function get_cpu_count {
 	echo $CPUCOUNT
 }
 
+# Function to flush the firewall chain.
+function flush_fw_chain {
+	# Call iptables and flush the chain
+	iptables -F "$FW_CHAIN"
+}
+
 # Function to create the firewall rules to pass the traffic to suricata.
 function generate_fw_rules {
 	cpu_count=$(get_cpu_count)
 
 	# Flush the firewall chain.
-	iptables -F "$FW_CHAIN"
+	flush_fw_chain
 
 	# Loop through the array of network zones.
 	for zone in "${network_zones[@]}"; do
@@ -103,12 +109,6 @@  function generate_fw_rules {
 	iptables -A "${FW_CHAIN}" -j MARK --set-xmark "0x0/${MASK}"
 }
 
-# Function to flush the firewall chain.
-function flush_fw_chain {
-	# Call iptables and flush the chain
-	iptables -F "$FW_CHAIN"
-}
-
 case "$1" in
         start)
 		# Get amount of CPU cores.