netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility
@ 2007-12-22  8:42 Patrick McHardy
  2007-12-25  5:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick McHardy @ 2007-12-22  8:42 UTC (permalink / raw)
  To: David S. Miller; +Cc: Netfilter Development Mailinglist

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: x --]
[-- Type: text/plain, Size: 2926 bytes --]

commit 0d5dbdc9b0d5168efc29b6261ad6d2ce7c4bbaae
Author: Patrick McHardy <kaber@trash.net>
Date:   Sat Dec 22 09:41:31 2007 +0100

    [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility
    
    Some users do "modprobe ip_conntrack hashsize=...". Since we have the
    module aliases this loads nf_conntrack_ipv4 and nf_conntrack, the
    hashsize parameter is unknown for nf_conntrack_ipv4 however and makes
    it fail.
    
    Allow to specify hashsize= for both nf_conntrack and nf_conntrack_ipv4.
    
    Note: the nf_conntrack message in the ringbuffer will display an
    incorrect hashsize since nf_conntrack is first pulled in as a
    dependency and calculates the size itself, then it gets changed
    through a call to nf_conntrack_set_hashsize().
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 90fb66d..4ac5ab1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
 	return (skb->nfct == &nf_conntrack_untracked.ct_general);
 }
 
+extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
 extern unsigned int nf_conntrack_htable_size;
 extern int nf_conntrack_checksum;
 extern atomic_t nf_conntrack_count;
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 831e9b2..910dae7 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
 	.me		 = THIS_MODULE,
 };
 
+module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
+		  &nf_conntrack_htable_size, 0600);
+
 MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
 MODULE_ALIAS("ip_conntrack");
 MODULE_LICENSE("GPL");
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 000c2fb..a4d5cde 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
 }
 EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
-int set_hashsize(const char *val, struct kernel_param *kp)
+int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
 	int i, bucket, hashsize, vmalloced;
 	int old_vmalloced, old_size;
@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp)
 	nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize);
 
-module_param_call(hashsize, set_hashsize, param_get_uint,
+module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
 		  &nf_conntrack_htable_size, 0600);
 
 int __init nf_conntrack_init(void)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility
  2007-12-22  8:42 [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility Patrick McHardy
@ 2007-12-25  5:09 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-12-25  5:09 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel

From: Patrick McHardy <kaber@trash.net>
Date: Sat, 22 Dec 2007 09:42:54 +0100

> [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility
> 
> Some users do "modprobe ip_conntrack hashsize=...". Since we have the
> module aliases this loads nf_conntrack_ipv4 and nf_conntrack, the
> hashsize parameter is unknown for nf_conntrack_ipv4 however and makes
> it fail.
> 
> Allow to specify hashsize= for both nf_conntrack and nf_conntrack_ipv4.
> 
> Note: the nf_conntrack message in the ringbuffer will display an
> incorrect hashsize since nf_conntrack is first pulled in as a
> dependency and calculates the size itself, then it gets changed
> through a call to nf_conntrack_set_hashsize().
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied to net-2.6, thanks Patrick.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-25  5:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-22  8:42 [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility Patrick McHardy
2007-12-25  5:09 ` David Miller

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).