]> git.ipfire.org Git - location/libloc.git/commitdiff
ipset: The minimum hashsize is 64
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Mar 2022 10:58:51 +0000 (10:58 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Mar 2022 10:58:51 +0000 (10:58 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/export.py

index 1c6743c205ab33df094de07f06dd2aebf634503e..3ee22946bccd09f48805a8f4943e6b27d945c41e 100644 (file)
@@ -152,8 +152,8 @@ class IpsetOutputWriter(OutputWriter):
                # divided by the hashsize factor.
                exponent = math.log(self.networks / self.HASHSIZE_FACTOR, 2)
 
-               # Return the size of the hash
-               return 2 ** math.ceil(exponent)
+               # Return the size of the hash (the minimum is 64)
+               return max(2 ** math.ceil(exponent), 64)
 
        def _write_header(self):
                # This must have a fixed size, because we will write the header again in the end