]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ipblocklist-functions.pl: Add helper function to proper calculate the
authorTim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Fri, 4 Mar 2022 21:11:48 +0000 (22:11 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 7 May 2022 09:31:14 +0000 (11:31 +0200)
hashsize.

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

index 9420fc948ce6a9e35ae07bc64ff79e2e24e69445..6da371a004e8f1d830c471e59ec653217835b0ae 100644 (file)
@@ -314,4 +314,18 @@ sub parse_dshield( $ ) {
        # Return the obtained network.
        return "$1/$2";
 }
+
+#
+## Helper function to proper calculate the hashsize.
+#
+sub _calculate_hashsize($) {
+       my ($list_entries) = @_;
+
+       my $hashsize = 1;
+       $hashsize  <<= 1 while ($hashsize < $list_entries);
+
+       # Return the calculated hashsize.
+       return $hashsize;
+}
+
 1;