* [PATCH] ipvs: Restrict connection table size via Kconfig
@ 2008-09-08 11:38 Sven Wegener
2008-09-08 14:13 ` Julius Volz
0 siblings, 1 reply; 3+ messages in thread
From: Sven Wegener @ 2008-09-08 11:38 UTC (permalink / raw)
To: Julian Anastasov, lvs-devel, netdev, Simon Horman, Wensong Zhang
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: Sven Wegener <sven.wegener@stealer.net>
---
include/net/ip_vs.h | 10 +---------
net/ipv4/ipvs/Kconfig | 3 ++-
2 files changed, 3 insertions(+), 10 deletions(-)
Don't know if we really should remove the check in ip_vs.h, but to some
part we should trust our own code.
Based on lvs-next.
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 1b13cef..38f4f69 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -621,16 +621,8 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
#ifndef CONFIG_IP_VS_TAB_BITS
#define CONFIG_IP_VS_TAB_BITS 12
#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
-#endif
#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
diff --git a/net/ipv4/ipvs/Kconfig b/net/ipv4/ipvs/Kconfig
index 794cecb..de6004d 100644
--- a/net/ipv4/ipvs/Kconfig
+++ b/net/ipv4/ipvs/Kconfig
@@ -41,7 +41,8 @@ config IP_VS_DEBUG
config IP_VS_TAB_BITS
int "IPVS connection table size (the Nth power of 2)"
- default "12"
+ range 8 20
+ default 12
---help---
The IPVS connection hash table uses the chaining scheme to handle
hash collisions. Using a big IPVS connection hash table will greatly
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipvs: Restrict connection table size via Kconfig
2008-09-08 11:38 [PATCH] ipvs: Restrict connection table size via Kconfig Sven Wegener
@ 2008-09-08 14:13 ` Julius Volz
2008-09-08 23:52 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Julius Volz @ 2008-09-08 14:13 UTC (permalink / raw)
To: Sven Wegener
Cc: Julian Anastasov, lvs-devel, netdev, Simon Horman, Wensong Zhang
On Mon, Sep 8, 2008 at 1:38 PM, Sven Wegener wrote:
> 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: Sven Wegener <sven.wegener@stealer.net>
> ---
> include/net/ip_vs.h | 10 +---------
> net/ipv4/ipvs/Kconfig | 3 ++-
> 2 files changed, 3 insertions(+), 10 deletions(-)
>
> Don't know if we really should remove the check in ip_vs.h, but to some
> part we should trust our own code.
Seems ok!
> Based on lvs-next.
>
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index 1b13cef..38f4f69 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -621,16 +621,8 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
> #ifndef CONFIG_IP_VS_TAB_BITS
> #define CONFIG_IP_VS_TAB_BITS 12
> #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
> -#endif
> #define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
> #define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
>
> diff --git a/net/ipv4/ipvs/Kconfig b/net/ipv4/ipvs/Kconfig
> index 794cecb..de6004d 100644
> --- a/net/ipv4/ipvs/Kconfig
> +++ b/net/ipv4/ipvs/Kconfig
> @@ -41,7 +41,8 @@ config IP_VS_DEBUG
>
> config IP_VS_TAB_BITS
> int "IPVS connection table size (the Nth power of 2)"
> - default "12"
> + range 8 20
> + default 12
> ---help---
> The IPVS connection hash table uses the chaining scheme to handle
> hash collisions. Using a big IPVS connection hash table will greatly
Reviewed-by: Julius Volz <juliusv@google.com>
--
Julius Volz - Corporate Operations - SysOps
Google Switzerland GmbH - Identification No.: CH-020.4.028.116-1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipvs: Restrict connection table size via Kconfig
2008-09-08 14:13 ` Julius Volz
@ 2008-09-08 23:52 ` Simon Horman
0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2008-09-08 23:52 UTC (permalink / raw)
To: Julius Volz
Cc: Sven Wegener, Julian Anastasov, lvs-devel, netdev, Wensong Zhang
On Mon, Sep 08, 2008 at 04:13:54PM +0200, Julius Volz wrote:
> On Mon, Sep 8, 2008 at 1:38 PM, Sven Wegener wrote:
> > 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: Sven Wegener <sven.wegener@stealer.net>
> > ---
> > include/net/ip_vs.h | 10 +---------
> > net/ipv4/ipvs/Kconfig | 3 ++-
> > 2 files changed, 3 insertions(+), 10 deletions(-)
> >
> > Don't know if we really should remove the check in ip_vs.h, but to some
> > part we should trust our own code.
>
> Seems ok!
I agree, this sounds entirely reasonable to me.
> > Based on lvs-next.
Thanks, applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-08 23:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-08 11:38 [PATCH] ipvs: Restrict connection table size via Kconfig Sven Wegener
2008-09-08 14:13 ` Julius Volz
2008-09-08 23:52 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).