}
# 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) {
}
} 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("<INFO> Successfully updated $blocklist blocklist.");
# 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 {