From: Stefan Schantl Date: Fri, 14 Apr 2023 18:26:10 +0000 (+0200) Subject: Revert "rules.pl: Use ipset_exists() function to avoid loading the same set" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4bc558506fdcd0ddea0abcbb55f31d9b60c8f826;p=people%2Fstevee%2Fipfire-2.x.git 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. --- 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 ($) {