From: Stefan Schantl Date: Tue, 1 Mar 2022 16:35:20 +0000 (+0100) Subject: ipblocklist-functions.pl: Add get_ipset_db_file() function. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65df900dc940558e6405068dd4e46164b44f962c;p=people%2Fstevee%2Fipfire-2.x.git ipblocklist-functions.pl: Add get_ipset_db_file() function. This function is used to generate the filename and full path for a given blocklist name. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/ipblocklist-functions.pl b/config/cfgroot/ipblocklist-functions.pl index 2072f3f320..f7ffbdbca2 100644 --- a/config/cfgroot/ipblocklist-functions.pl +++ b/config/cfgroot/ipblocklist-functions.pl @@ -23,6 +23,12 @@ package IPblocklist; require '/var/ipfire/ipblocklist/sources'; +# Location where the blocklists in ipset compatible format are stored. +our $blocklist_dir = "/var/lib/ipblocklist"; + +# File extension of the blocklist files. +our $blocklist_file_extension = ".conf"; + # ## Function to get all available blocklists. # @@ -39,4 +45,17 @@ sub get_blocklists () { return sort(@blocklists); } +# +## Tiny function to get the full path and name of a given blocklist. +# +sub get_ipset_db_file($) { + my ($set) = @_; + + # Generate the + my $file = "$blocklist_dir/$set$blocklist_file_extension"; + + # Return the file name. + return $file; +} + 1;