Commit 2206a3f5 authored by Sven Wegener's avatar Sven Wegener Committed by Simon Horman

ipvs: Restrict connection table size via Kconfig

Instead of checking the value in include/net/ip_vs.h, we can just
restrict the range in our Kconfig file. This will prevent values outside
of the range early.
Signed-off-by: default avatarSven Wegener <sven.wegener@stealer.net>
Reviewed-by: default avatarJulius Volz <juliusv@google.com>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 9d7f2a2b
...@@ -621,16 +621,8 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows); ...@@ -621,16 +621,8 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
#ifndef CONFIG_IP_VS_TAB_BITS #ifndef CONFIG_IP_VS_TAB_BITS
#define CONFIG_IP_VS_TAB_BITS 12 #define CONFIG_IP_VS_TAB_BITS 12
#endif #endif
/* make sure that IP_VS_CONN_TAB_BITS is located in [8, 20] */
#if CONFIG_IP_VS_TAB_BITS < 8
#define IP_VS_CONN_TAB_BITS 8
#endif
#if CONFIG_IP_VS_TAB_BITS > 20
#define IP_VS_CONN_TAB_BITS 20
#endif
#if 8 <= CONFIG_IP_VS_TAB_BITS && CONFIG_IP_VS_TAB_BITS <= 20
#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS #define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS
#endif
#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS) #define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1) #define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
......
...@@ -41,7 +41,8 @@ config IP_VS_DEBUG ...@@ -41,7 +41,8 @@ config IP_VS_DEBUG
config IP_VS_TAB_BITS config IP_VS_TAB_BITS
int "IPVS connection table size (the Nth power of 2)" int "IPVS connection table size (the Nth power of 2)"
default "12" range 8 20
default 12
---help--- ---help---
The IPVS connection hash table uses the chaining scheme to handle The IPVS connection hash table uses the chaining scheme to handle
hash collisions. Using a big IPVS connection hash table will greatly hash collisions. Using a big IPVS connection hash table will greatly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment