diff options
author | Patrick McHardy <kaber@trash.net> | 2007-12-25 00:09:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-12-26 22:36:33 -0500 |
commit | fae718ddaf2b00e222dddec6717aca023376723c (patch) | |
tree | a3ea0668f21555cca021f4d19ce5b22e6eca5c49 | |
parent | 81100eb80add328c4d2a377326f15aa0e7236398 (diff) |
[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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 1 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 90fb66d99d0c..4ac5ab187c2a 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) | |||
249 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | 249 | return (skb->nfct == &nf_conntrack_untracked.ct_general); |
250 | } | 250 | } |
251 | 251 | ||
252 | extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); | ||
252 | extern unsigned int nf_conntrack_htable_size; | 253 | extern unsigned int nf_conntrack_htable_size; |
253 | extern int nf_conntrack_checksum; | 254 | extern int nf_conntrack_checksum; |
254 | extern atomic_t nf_conntrack_count; | 255 | 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 831e9b29806d..910dae732a0f 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 = { | |||
419 | .me = THIS_MODULE, | 419 | .me = THIS_MODULE, |
420 | }; | 420 | }; |
421 | 421 | ||
422 | module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint, | ||
423 | &nf_conntrack_htable_size, 0600); | ||
424 | |||
422 | MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); | 425 | MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); |
423 | MODULE_ALIAS("ip_conntrack"); | 426 | MODULE_ALIAS("ip_conntrack"); |
424 | MODULE_LICENSE("GPL"); | 427 | MODULE_LICENSE("GPL"); |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 000c2fb462d0..a4d5cdeb0110 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) | |||
1016 | } | 1016 | } |
1017 | EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable); | 1017 | EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable); |
1018 | 1018 | ||
1019 | int set_hashsize(const char *val, struct kernel_param *kp) | 1019 | int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp) |
1020 | { | 1020 | { |
1021 | int i, bucket, hashsize, vmalloced; | 1021 | int i, bucket, hashsize, vmalloced; |
1022 | int old_vmalloced, old_size; | 1022 | int old_vmalloced, old_size; |
@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp) | |||
1063 | nf_ct_free_hashtable(old_hash, old_vmalloced, old_size); | 1063 | nf_ct_free_hashtable(old_hash, old_vmalloced, old_size); |
1064 | return 0; | 1064 | return 0; |
1065 | } | 1065 | } |
1066 | EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize); | ||
1066 | 1067 | ||
1067 | module_param_call(hashsize, set_hashsize, param_get_uint, | 1068 | module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint, |
1068 | &nf_conntrack_htable_size, 0600); | 1069 | &nf_conntrack_htable_size, 0600); |
1069 | 1070 | ||
1070 | int __init nf_conntrack_init(void) | 1071 | int __init nf_conntrack_init(void) |