From aa418dfc0c1d307b57db86156f7c9b21543b54f5 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 d8c270229..bbd417d30 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -80,6 +80,7 @@ my %blocklistsettings= ( "ENABLE" => "off", ); +my %ipset_loaded_sets = (); my @ipset_used_sets = (); my $configfwdfw = "${General::swroot}/firewall/config"; @@ -1042,7 +1043,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) { @@ -1072,6 +1076,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