diff options
author | Patrick McHardy <kaber@trash.net> | 2006-11-28 20:35:18 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:31:18 -0500 |
commit | 933a41e7e12b773d1dd026018f02b86b5d257a22 (patch) | |
tree | 0a99f7759d2488869f93ba6a0206435bcacca85e /net/ipv4 | |
parent | d62f9ed4a490309bd9e5df0b42ba5d096e7b5902 (diff) |
[NETFILTER]: nf_conntrack: move conntrack protocol sysctls to individual modules
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 53 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 23 |
2 files changed, 22 insertions, 54 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index d1907082d7d6..786c4ce96cdf 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -266,44 +266,6 @@ static struct nf_hook_ops ipv4_conntrack_ops[] = { | |||
266 | }, | 266 | }, |
267 | }; | 267 | }; |
268 | 268 | ||
269 | #ifdef CONFIG_SYSCTL | ||
270 | /* From nf_conntrack_proto_icmp.c */ | ||
271 | extern unsigned int nf_ct_icmp_timeout; | ||
272 | static struct ctl_table_header *nf_ct_ipv4_sysctl_header; | ||
273 | |||
274 | static ctl_table nf_ct_sysctl_table[] = { | ||
275 | { | ||
276 | .ctl_name = NET_NF_CONNTRACK_ICMP_TIMEOUT, | ||
277 | .procname = "nf_conntrack_icmp_timeout", | ||
278 | .data = &nf_ct_icmp_timeout, | ||
279 | .maxlen = sizeof(unsigned int), | ||
280 | .mode = 0644, | ||
281 | .proc_handler = &proc_dointvec_jiffies, | ||
282 | }, | ||
283 | { .ctl_name = 0 } | ||
284 | }; | ||
285 | |||
286 | static ctl_table nf_ct_netfilter_table[] = { | ||
287 | { | ||
288 | .ctl_name = NET_NETFILTER, | ||
289 | .procname = "netfilter", | ||
290 | .mode = 0555, | ||
291 | .child = nf_ct_sysctl_table, | ||
292 | }, | ||
293 | { .ctl_name = 0 } | ||
294 | }; | ||
295 | |||
296 | static ctl_table nf_ct_net_table[] = { | ||
297 | { | ||
298 | .ctl_name = CTL_NET, | ||
299 | .procname = "net", | ||
300 | .mode = 0555, | ||
301 | .child = nf_ct_netfilter_table, | ||
302 | }, | ||
303 | { .ctl_name = 0 } | ||
304 | }; | ||
305 | #endif | ||
306 | |||
307 | /* Fast function for those who don't want to parse /proc (and I don't | 269 | /* Fast function for those who don't want to parse /proc (and I don't |
308 | blame them). */ | 270 | blame them). */ |
309 | /* Reversing the socket's dst/src point of view gives us the reply | 271 | /* Reversing the socket's dst/src point of view gives us the reply |
@@ -472,20 +434,8 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) | |||
472 | printk("nf_conntrack_ipv4: can't register hooks.\n"); | 434 | printk("nf_conntrack_ipv4: can't register hooks.\n"); |
473 | goto cleanup_ipv4; | 435 | goto cleanup_ipv4; |
474 | } | 436 | } |
475 | #ifdef CONFIG_SYSCTL | ||
476 | nf_ct_ipv4_sysctl_header = register_sysctl_table(nf_ct_net_table, 0); | ||
477 | if (nf_ct_ipv4_sysctl_header == NULL) { | ||
478 | printk("nf_conntrack: can't register to sysctl.\n"); | ||
479 | ret = -ENOMEM; | ||
480 | goto cleanup_hooks; | ||
481 | } | ||
482 | #endif | ||
483 | return ret; | 437 | return ret; |
484 | 438 | ||
485 | #ifdef CONFIG_SYSCTL | ||
486 | cleanup_hooks: | ||
487 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); | ||
488 | #endif | ||
489 | cleanup_ipv4: | 439 | cleanup_ipv4: |
490 | nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4); | 440 | nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4); |
491 | cleanup_icmp: | 441 | cleanup_icmp: |
@@ -502,9 +452,6 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) | |||
502 | static void __exit nf_conntrack_l3proto_ipv4_fini(void) | 452 | static void __exit nf_conntrack_l3proto_ipv4_fini(void) |
503 | { | 453 | { |
504 | synchronize_net(); | 454 | synchronize_net(); |
505 | #ifdef CONFIG_SYSCTL | ||
506 | unregister_sysctl_table(nf_ct_ipv4_sysctl_header); | ||
507 | #endif | ||
508 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); | 455 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); |
509 | nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4); | 456 | nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv4); |
510 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_icmp); | 457 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_icmp); |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 95fc22b49694..c59f28193a39 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <net/netfilter/nf_conntrack_l4proto.h> | 25 | #include <net/netfilter/nf_conntrack_l4proto.h> |
26 | #include <net/netfilter/nf_conntrack_core.h> | 26 | #include <net/netfilter/nf_conntrack_core.h> |
27 | 27 | ||
28 | unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; | 28 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; |
29 | 29 | ||
30 | #if 0 | 30 | #if 0 |
31 | #define DEBUGP printk | 31 | #define DEBUGP printk |
@@ -321,6 +321,23 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[], | |||
321 | } | 321 | } |
322 | #endif | 322 | #endif |
323 | 323 | ||
324 | #ifdef CONFIG_SYSCTL | ||
325 | static struct ctl_table_header *icmp_sysctl_header; | ||
326 | static struct ctl_table icmp_sysctl_table[] = { | ||
327 | { | ||
328 | .ctl_name = NET_NF_CONNTRACK_ICMP_TIMEOUT, | ||
329 | .procname = "nf_conntrack_icmp_timeout", | ||
330 | .data = &nf_ct_icmp_timeout, | ||
331 | .maxlen = sizeof(unsigned int), | ||
332 | .mode = 0644, | ||
333 | .proc_handler = &proc_dointvec_jiffies, | ||
334 | }, | ||
335 | { | ||
336 | .ctl_name = 0 | ||
337 | } | ||
338 | }; | ||
339 | #endif /* CONFIG_SYSCTL */ | ||
340 | |||
324 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp = | 341 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp = |
325 | { | 342 | { |
326 | .l3proto = PF_INET, | 343 | .l3proto = PF_INET, |
@@ -340,6 +357,10 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp = | |||
340 | .tuple_to_nfattr = icmp_tuple_to_nfattr, | 357 | .tuple_to_nfattr = icmp_tuple_to_nfattr, |
341 | .nfattr_to_tuple = icmp_nfattr_to_tuple, | 358 | .nfattr_to_tuple = icmp_nfattr_to_tuple, |
342 | #endif | 359 | #endif |
360 | #ifdef CONFIG_SYSCTL | ||
361 | .ctl_table_header = &icmp_sysctl_header, | ||
362 | .ctl_table = icmp_sysctl_table, | ||
363 | #endif | ||
343 | }; | 364 | }; |
344 | 365 | ||
345 | EXPORT_SYMBOL(nf_conntrack_l4proto_icmp); | 366 | EXPORT_SYMBOL(nf_conntrack_l4proto_icmp); |