From 4bc558506fdcd0ddea0abcbb55f31d9b60c8f826 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Fri, 14 Apr 2023 20:26:10 +0200 Subject: [PATCH] Revert "rules.pl: Use ipset_exists() function to avoid loading the same set" We need this to avoid from loading the same set multiple times during one run but update allready loaded sets. This reverts commit 6dfa1854fb9ce74c0449b90f8475ac0fa9d87e2e. --- config/firewall/rules.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl index 932268341a..fc1be960e3 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -79,6 +79,7 @@ my %blocklistsettings= ( "ENABLE" => "off", ); +my %ipset_loaded_sets = (); my @ipset_used_sets = (); my $configfwdfw = "${General::swroot}/firewall/config"; @@ -1041,7 +1042,10 @@ sub ipset_restore ($) { my $db_file; # Check if the set already has been loaded. - return if(&IPSet::Functions::ipset_exists($set)); + if($ipset_loaded_sets{$set}) { + # It already has been loaded - so there is nothing to do. + return; + } # Check if the given set name is a country code. if($set ~~ @locations) { @@ -1071,6 +1075,9 @@ sub ipset_restore ($) { run("$IPSET rename $loc_set $set"); } } + + # Store the restored set to the hash to prevent from loading it again. + $ipset_loaded_sets{$set} = "1"; } sub ipset_call_restore ($) { -- 2.39.5