aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-01-09 03:33:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:10 -0500
commit3d7cc2ba628dcc6b55a2bafc7eaf35019fdcc201 (patch)
tree0b709ed4a97e048058d374401b50a3a1dbdce516
parentc6995bdff0fc9f97621922a7f857fa640537a7e2 (diff)
[NETFILTER]: Switch to using ctl_paths in nf_queue and conntrack modules
This includes the most simple cases for netfilter. The first part is tne queue modules for ipv4 and ipv6, on which the net/ipv4/ and net/ipv6/ paths are reused from the appropriate ipv4 and ipv6 code. The conntrack module is also patched, but this hunk is very small and simple. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ipv6.h2
-rw-r--r--net/ipv4/netfilter/ip_queue.c23
-rw-r--r--net/ipv4/sysctl_net_ipv4.c5
-rw-r--r--net/ipv6/netfilter/ip6_queue.c22
-rw-r--r--net/ipv6/sysctl_net_ipv6.c6
-rw-r--r--net/netfilter/nf_conntrack_standalone.c15
7 files changed, 20 insertions, 55 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index cbeb97d38860..6850a80a6886 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -177,6 +177,8 @@ extern void inet_get_local_port_range(int *low, int *high);
177extern int sysctl_ip_default_ttl; 177extern int sysctl_ip_default_ttl;
178extern int sysctl_ip_nonlocal_bind; 178extern int sysctl_ip_nonlocal_bind;
179 179
180extern struct ctl_path net_ipv4_ctl_path[];
181
180/* From ip_fragment.c */ 182/* From ip_fragment.c */
181struct inet_frags_ctl; 183struct inet_frags_ctl;
182extern struct inet_frags_ctl ip4_frags_ctl; 184extern struct inet_frags_ctl ip4_frags_ctl;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f2adedff927f..e371f322017d 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -112,6 +112,8 @@ struct frag_hdr {
112extern int sysctl_ipv6_bindv6only; 112extern int sysctl_ipv6_bindv6only;
113extern int sysctl_mld_max_msf; 113extern int sysctl_mld_max_msf;
114 114
115extern struct ctl_path net_ipv6_ctl_path[];
116
115#define _DEVINC(statname, modifier, idev, field) \ 117#define _DEVINC(statname, modifier, idev, field) \
116({ \ 118({ \
117 struct inet6_dev *_idev = (idev); \ 119 struct inet6_dev *_idev = (idev); \
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 68b12ce8ba55..7361315f20c6 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -29,6 +29,7 @@
29#include <net/sock.h> 29#include <net/sock.h>
30#include <net/route.h> 30#include <net/route.h>
31#include <net/netfilter/nf_queue.h> 31#include <net/netfilter/nf_queue.h>
32#include <net/ip.h>
32 33
33#define IPQ_QMAX_DEFAULT 1024 34#define IPQ_QMAX_DEFAULT 1024
34#define IPQ_PROC_FS_NAME "ip_queue" 35#define IPQ_PROC_FS_NAME "ip_queue"
@@ -525,26 +526,6 @@ static ctl_table ipq_table[] = {
525 { .ctl_name = 0 } 526 { .ctl_name = 0 }
526}; 527};
527 528
528static ctl_table ipq_dir_table[] = {
529 {
530 .ctl_name = NET_IPV4,
531 .procname = "ipv4",
532 .mode = 0555,
533 .child = ipq_table
534 },
535 { .ctl_name = 0 }
536};
537
538static ctl_table ipq_root_table[] = {
539 {
540 .ctl_name = CTL_NET,
541 .procname = "net",
542 .mode = 0555,
543 .child = ipq_dir_table
544 },
545 { .ctl_name = 0 }
546};
547
548static int ip_queue_show(struct seq_file *m, void *v) 529static int ip_queue_show(struct seq_file *m, void *v)
549{ 530{
550 read_lock_bh(&queue_lock); 531 read_lock_bh(&queue_lock);
@@ -610,7 +591,7 @@ static int __init ip_queue_init(void)
610 } 591 }
611 592
612 register_netdevice_notifier(&ipq_dev_notifier); 593 register_netdevice_notifier(&ipq_dev_notifier);
613 ipq_sysctl_header = register_sysctl_table(ipq_root_table); 594 ipq_sysctl_header = register_sysctl_paths(net_ipv4_ctl_path, ipq_table);
614 595
615 status = nf_register_queue_handler(PF_INET, &nfqh); 596 status = nf_register_queue_handler(PF_INET, &nfqh);
616 if (status < 0) { 597 if (status < 0) {
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index a5a9f8e3bb25..45536a91266a 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -846,17 +846,18 @@ static struct ctl_table ipv4_table[] = {
846 { .ctl_name = 0 } 846 { .ctl_name = 0 }
847}; 847};
848 848
849static __initdata struct ctl_path net_ipv4_path[] = { 849struct ctl_path net_ipv4_ctl_path[] = {
850 { .procname = "net", .ctl_name = CTL_NET, }, 850 { .procname = "net", .ctl_name = CTL_NET, },
851 { .procname = "ipv4", .ctl_name = NET_IPV4, }, 851 { .procname = "ipv4", .ctl_name = NET_IPV4, },
852 { }, 852 { },
853}; 853};
854EXPORT_SYMBOL_GPL(net_ipv4_ctl_path);
854 855
855static __init int sysctl_ipv4_init(void) 856static __init int sysctl_ipv4_init(void)
856{ 857{
857 struct ctl_table_header *hdr; 858 struct ctl_table_header *hdr;
858 859
859 hdr = register_sysctl_paths(net_ipv4_path, ipv4_table); 860 hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table);
860 return hdr == NULL ? -ENOMEM : 0; 861 return hdr == NULL ? -ENOMEM : 0;
861} 862}
862 863
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index e5b0059582f5..a20db0bb5a1f 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -529,26 +529,6 @@ static ctl_table ipq_table[] = {
529 { .ctl_name = 0 } 529 { .ctl_name = 0 }
530}; 530};
531 531
532static ctl_table ipq_dir_table[] = {
533 {
534 .ctl_name = NET_IPV6,
535 .procname = "ipv6",
536 .mode = 0555,
537 .child = ipq_table
538 },
539 { .ctl_name = 0 }
540};
541
542static ctl_table ipq_root_table[] = {
543 {
544 .ctl_name = CTL_NET,
545 .procname = "net",
546 .mode = 0555,
547 .child = ipq_dir_table
548 },
549 { .ctl_name = 0 }
550};
551
552static int ip6_queue_show(struct seq_file *m, void *v) 532static int ip6_queue_show(struct seq_file *m, void *v)
553{ 533{
554 read_lock_bh(&queue_lock); 534 read_lock_bh(&queue_lock);
@@ -614,7 +594,7 @@ static int __init ip6_queue_init(void)
614 } 594 }
615 595
616 register_netdevice_notifier(&ipq_dev_notifier); 596 register_netdevice_notifier(&ipq_dev_notifier);
617 ipq_sysctl_header = register_sysctl_table(ipq_root_table); 597 ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table);
618 598
619 status = nf_register_queue_handler(PF_INET6, &nfqh); 599 status = nf_register_queue_handler(PF_INET6, &nfqh);
620 if (status < 0) { 600 if (status < 0) {
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 0b5bec3cb797..4ad8d9d3cb7a 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -82,17 +82,19 @@ static ctl_table ipv6_table[] = {
82 { .ctl_name = 0 } 82 { .ctl_name = 0 }
83}; 83};
84 84
85static struct ctl_path ipv6_ctl_path[] = { 85struct ctl_path net_ipv6_ctl_path[] = {
86 { .procname = "net", .ctl_name = CTL_NET, }, 86 { .procname = "net", .ctl_name = CTL_NET, },
87 { .procname = "ipv6", .ctl_name = NET_IPV6, }, 87 { .procname = "ipv6", .ctl_name = NET_IPV6, },
88 { }, 88 { },
89}; 89};
90EXPORT_SYMBOL_GPL(net_ipv6_ctl_path);
90 91
91static struct ctl_table_header *ipv6_sysctl_header; 92static struct ctl_table_header *ipv6_sysctl_header;
92 93
93void ipv6_sysctl_register(void) 94void ipv6_sysctl_register(void)
94{ 95{
95 ipv6_sysctl_header = register_sysctl_paths(ipv6_ctl_path, ipv6_table); 96 ipv6_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path,
97 ipv6_table);
96} 98}
97 99
98void ipv6_sysctl_unregister(void) 100void ipv6_sysctl_unregister(void)
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 9efdd37fc195..2ad49331302b 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -383,15 +383,11 @@ static ctl_table nf_ct_netfilter_table[] = {
383 { .ctl_name = 0 } 383 { .ctl_name = 0 }
384}; 384};
385 385
386static ctl_table nf_ct_net_table[] = { 386struct ctl_path nf_ct_path[] = {
387 { 387 { .procname = "net", .ctl_name = CTL_NET, },
388 .ctl_name = CTL_NET, 388 { }
389 .procname = "net",
390 .mode = 0555,
391 .child = nf_ct_netfilter_table,
392 },
393 { .ctl_name = 0 }
394}; 389};
390
395EXPORT_SYMBOL_GPL(nf_ct_log_invalid); 391EXPORT_SYMBOL_GPL(nf_ct_log_invalid);
396#endif /* CONFIG_SYSCTL */ 392#endif /* CONFIG_SYSCTL */
397 393
@@ -418,7 +414,8 @@ static int __init nf_conntrack_standalone_init(void)
418 proc_stat->owner = THIS_MODULE; 414 proc_stat->owner = THIS_MODULE;
419#endif 415#endif
420#ifdef CONFIG_SYSCTL 416#ifdef CONFIG_SYSCTL
421 nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table); 417 nf_ct_sysctl_header = register_sysctl_paths(nf_ct_path,
418 nf_ct_netfilter_table);
422 if (nf_ct_sysctl_header == NULL) { 419 if (nf_ct_sysctl_header == NULL) {
423 printk("nf_conntrack: can't register to sysctl.\n"); 420 printk("nf_conntrack: can't register to sysctl.\n");
424 ret = -ENOMEM; 421 ret = -ENOMEM;