@@ -133,6 +133,26 @@ config SECURITY_SELINUX_PDB_FILE_TR_HASH_BITS
used for File Transitions hash table. Smaller value reduces memory
footprint at price of hash table lookup efficiency.
+config SECURITY_SELINUX_NETPORT_HASH_BITS
+ int "Number of slots (buckets) for Netport hash table, expressed as number of bits (i.e. 2^n)"
+ depends on SECURITY_SELINUX
+ range 1 16
+ default "8"
+ help
+ This is a power of 2 representing the number of slots (buckets)
+ used for Netport hash table. Smaller value reduces memory
+ footprint at price of hash table lookup efficiency.
+
+config SECURITY_SELINUX_NETPORT_HASH_BLIMIT
+ int "Bucket size limit for Netport hash table."
+ depends on SECURITY_SELINUX
+ range 1 131072
+ default "16"
+ help
+ This is a an upper limit on number of entries a bucket can hold
+ within Netport hash. Lower values conserve memory at price of
+ more expensive lookups when a Netport cache miss occurs.
+
config SECURITY_SELINUX_CHECKREQPROT_VALUE
int "NSA SELinux checkreqprot default value"
depends on SECURITY_SELINUX
@@ -32,8 +32,8 @@
#include "netport.h"
#include "objsec.h"
-#define SEL_NETPORT_HASH_SIZE 256
-#define SEL_NETPORT_HASH_BKT_LIMIT 16
+#define SEL_NETPORT_HASH_SIZE (1 << CONFIG_SECURITY_SELINUX_NETPORT_HASH_BITS)
+#define SEL_NETPORT_HASH_BKT_LIMIT CONFIG_SECURITY_SELINUX_NETPORT_HASH_BLIMIT
struct sel_netport_bkt {
int size;