]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ipblocklist-functions.pl: Add get_ipset_db_file() function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 1 Mar 2022 16:35:20 +0000 (17:35 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 7 Jul 2022 15:26:13 +0000 (17:26 +0200)
This function is used to generate the filename and full path
for a given blocklist name.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ipblocklist-functions.pl

index 2072f3f3204fe428b6542a7134c12ba42e0bd028..f7ffbdbca20998aaff5488dd48e06c858b42688f 100644 (file)
@@ -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;