From 52335a195a68e202b03123923001e7af37c7fcbf Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Fri, 14 Apr 2023 18:15:22 +0200 Subject: [PATCH] update-ipblocklists: Adjust code to work with latest ipblocklist-function.pl changes Signed-off-by: Stefan Schantl --- src/scripts/update-ipblocklists | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/scripts/update-ipblocklists b/src/scripts/update-ipblocklists index a17b47999..4eb1edb7f 100644 --- a/src/scripts/update-ipblocklists +++ b/src/scripts/update-ipblocklists @@ -93,7 +93,7 @@ foreach my $blocklist (@blocklists) { } # Try to download and update the blocklist. - my $return = &IPblocklist::download_and_create_blocklist($blocklist); + my $return = &IPblocklist::download_blocklist($blocklist); # Check if we got a return code. if ($return) { @@ -110,10 +110,10 @@ foreach my $blocklist (@blocklists) { } } else { # Get the filename of the blocklist. - my $ipset_db_file = &IPblocklist::get_ipset_db_file($blocklist); + my $cached_file = &IPblocklist::get_cached_blocklist_file($blocklist); # Set the correct ownership. - &IPblocklist::set_ownership($ipset_db_file); + &IPblocklist::set_ownership($cached_file); # Log successfull update. &_log_to_syslog(" Successfully updated $blocklist blocklist."); @@ -128,23 +128,8 @@ if (@updated_blocklists) { # Set correct ownership to the modified file. &IPblocklist::set_ownership($IPblocklist::modified_file); - # Loop through the array. - foreach my $updated_blocklist (@updated_blocklists) { - # Get the blocklist file. - my $ipset_db_file = &IPblocklist::get_ipset_db_file($updated_blocklist); - - # Call safe system function to reload/update the blocklist. - &General::safe_system("ipset", "restore", "-f", "$ipset_db_file"); - - # The set name contains a "v4" as suffix. - my $set_name = "$updated_blocklist" . "v4"; - - # Swap the sets to use the new one. - &General::safe_system("ipset", "swap", "$set_name", "$updated_blocklist"); - - # Destroy the old blocklist. - &General::safe_system("ipset", "destroy", "$set_name"); - } + # Regenerate blocklists. + &IPblocklist::load_blocklists(); } END { -- 2.39.5