Commit fae718dd authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[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: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 81100eb8
...@@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb) ...@@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
return (skb->nfct == &nf_conntrack_untracked.ct_general); 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 unsigned int nf_conntrack_htable_size;
extern int nf_conntrack_checksum; extern int nf_conntrack_checksum;
extern atomic_t nf_conntrack_count; extern atomic_t nf_conntrack_count;
......
...@@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = { ...@@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
.me = THIS_MODULE, .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("nf_conntrack-" __stringify(AF_INET));
MODULE_ALIAS("ip_conntrack"); MODULE_ALIAS("ip_conntrack");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced) ...@@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
} }
EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable); 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 i, bucket, hashsize, vmalloced;
int old_vmalloced, old_size; int old_vmalloced, old_size;
...@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp) ...@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp)
nf_ct_free_hashtable(old_hash, old_vmalloced, old_size); nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
return 0; 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); &nf_conntrack_htable_size, 0600);
int __init nf_conntrack_init(void) int __init nf_conntrack_init(void)
......
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