aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-04-19 09:24:33 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-20 21:21:17 -0400
commit5dd3df105b9f6cb7dd2472b59e028d0d1c878ecb (patch)
treeb12606e6e74ee6d07823eb268e09d899946279fd
parent4344475797a16ef948385780943f7a5cf09f0675 (diff)
net: Move all of the network sysctls without a namespace into init_net.
This makes it clearer which sysctls are relative to your current network namespace. This makes it a little less error prone by not exposing sysctls for the initial network namespace in other namespaces. This is the same way we handle all of our other network interfaces to userspace and I can't honestly remember why we didn't do this for sysctls right from the start. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Acked-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/infiniband/core/ucma.c4
-rw-r--r--net/802/tr.c2
-rw-r--r--net/appletalk/sysctl_net_atalk.c4
-rw-r--r--net/ax25/sysctl_net_ax25.c4
-rw-r--r--net/bridge/br_netfilter.c4
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/sysctl_net_core.c2
-rw-r--r--net/dccp/sysctl.c4
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/decnet/sysctl_net_decnet.c4
-rw-r--r--net/ipv4/netfilter/ip_queue.c6
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/sysctl_net_ipv4.c4
-rw-r--r--net/ipv6/netfilter/ip6_queue.c6
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c4
-rw-r--r--net/ipv6/sysctl_net_ipv6.c2
-rw-r--r--net/ipx/sysctl_net_ipx.c5
-rw-r--r--net/irda/irsysctl.c4
-rw-r--r--net/llc/sysctl_net_llc.c5
-rw-r--r--net/netfilter/nf_conntrack_proto.c4
-rw-r--r--net/netfilter/nf_conntrack_standalone.c6
-rw-r--r--net/netfilter/nf_log.c2
-rw-r--r--net/netrom/sysctl_net_netrom.c4
-rw-r--r--net/phonet/sysctl.c4
-rw-r--r--net/rds/ib_sysctl.c4
-rw-r--r--net/rds/iw_sysctl.c4
-rw-r--r--net/rds/sysctl.c4
-rw-r--r--net/rose/sysctl_net_rose.c4
-rw-r--r--net/sctp/sysctl.c4
-rw-r--r--net/unix/sysctl_net_unix.c2
-rw-r--r--net/x25/sysctl_net_x25.c4
31 files changed, 60 insertions, 58 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index 5861cdb22b7c..9f3e2beec91d 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -1392,7 +1392,7 @@ static int __init ucma_init(void)
1392 goto err1; 1392 goto err1;
1393 } 1393 }
1394 1394
1395 ucma_ctl_table_hdr = register_sysctl_paths(ucma_ctl_path, ucma_ctl_table); 1395 ucma_ctl_table_hdr = register_net_sysctl_table(&init_net, ucma_ctl_path, ucma_ctl_table);
1396 if (!ucma_ctl_table_hdr) { 1396 if (!ucma_ctl_table_hdr) {
1397 printk(KERN_ERR "rdma_ucm: couldn't register sysctl paths\n"); 1397 printk(KERN_ERR "rdma_ucm: couldn't register sysctl paths\n");
1398 ret = -ENOMEM; 1398 ret = -ENOMEM;
@@ -1408,7 +1408,7 @@ err1:
1408 1408
1409static void __exit ucma_cleanup(void) 1409static void __exit ucma_cleanup(void)
1410{ 1410{
1411 unregister_sysctl_table(ucma_ctl_table_hdr); 1411 unregister_net_sysctl_table(ucma_ctl_table_hdr);
1412 device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); 1412 device_remove_file(ucma_misc.this_device, &dev_attr_abi_version);
1413 misc_deregister(&ucma_misc); 1413 misc_deregister(&ucma_misc);
1414 idr_destroy(&ctx_idr); 1414 idr_destroy(&ctx_idr);
diff --git a/net/802/tr.c b/net/802/tr.c
index e65f0b8de0c4..103e0201b0ab 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -662,7 +662,7 @@ static int __init rif_init(void)
662 setup_timer(&rif_timer, rif_check_expire, 0); 662 setup_timer(&rif_timer, rif_check_expire, 0);
663 add_timer(&rif_timer); 663 add_timer(&rif_timer);
664#ifdef CONFIG_SYSCTL 664#ifdef CONFIG_SYSCTL
665 register_sysctl_paths(tr_path, tr_table); 665 register_net_sysctl_table(&init_net, tr_path, tr_table);
666#endif 666#endif
667 proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops); 667 proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops);
668 return 0; 668 return 0;
diff --git a/net/appletalk/sysctl_net_atalk.c b/net/appletalk/sysctl_net_atalk.c
index 04e9c0da7aa9..5edce8f70cb7 100644
--- a/net/appletalk/sysctl_net_atalk.c
+++ b/net/appletalk/sysctl_net_atalk.c
@@ -52,10 +52,10 @@ static struct ctl_table_header *atalk_table_header;
52 52
53void atalk_register_sysctl(void) 53void atalk_register_sysctl(void)
54{ 54{
55 atalk_table_header = register_sysctl_paths(atalk_path, atalk_table); 55 atalk_table_header = register_net_sysctl_table(&init_net, atalk_path, atalk_table);
56} 56}
57 57
58void atalk_unregister_sysctl(void) 58void atalk_unregister_sysctl(void)
59{ 59{
60 unregister_sysctl_table(atalk_table_header); 60 unregister_net_sysctl_table(atalk_table_header);
61} 61}
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index ebe0ef3f1d83..7ba381b6f074 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -196,13 +196,13 @@ void ax25_register_sysctl(void)
196 } 196 }
197 spin_unlock_bh(&ax25_dev_lock); 197 spin_unlock_bh(&ax25_dev_lock);
198 198
199 ax25_table_header = register_sysctl_paths(ax25_path, ax25_table); 199 ax25_table_header = register_net_sysctl_table(&init_net, ax25_path, ax25_table);
200} 200}
201 201
202void ax25_unregister_sysctl(void) 202void ax25_unregister_sysctl(void)
203{ 203{
204 ctl_table *p; 204 ctl_table *p;
205 unregister_sysctl_table(ax25_table_header); 205 unregister_net_sysctl_table(ax25_table_header);
206 206
207 for (p = ax25_table; p->procname; p++) 207 for (p = ax25_table; p->procname; p++)
208 kfree(p->child); 208 kfree(p->child);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index dec4f3817133..4f4c4a619f68 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -1030,7 +1030,7 @@ int __init br_netfilter_init(void)
1030 return ret; 1030 return ret;
1031 } 1031 }
1032#ifdef CONFIG_SYSCTL 1032#ifdef CONFIG_SYSCTL
1033 brnf_sysctl_header = register_sysctl_paths(brnf_path, brnf_table); 1033 brnf_sysctl_header = register_net_sysctl_table(&init_net, brnf_path, brnf_table);
1034 if (brnf_sysctl_header == NULL) { 1034 if (brnf_sysctl_header == NULL) {
1035 printk(KERN_WARNING 1035 printk(KERN_WARNING
1036 "br_netfilter: can't register to sysctl.\n"); 1036 "br_netfilter: can't register to sysctl.\n");
@@ -1047,7 +1047,7 @@ void br_netfilter_fini(void)
1047{ 1047{
1048 nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops)); 1048 nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
1049#ifdef CONFIG_SYSCTL 1049#ifdef CONFIG_SYSCTL
1050 unregister_sysctl_table(brnf_sysctl_header); 1050 unregister_net_sysctl_table(brnf_sysctl_header);
1051#endif 1051#endif
1052 dst_entries_destroy(&fake_dst_ops); 1052 dst_entries_destroy(&fake_dst_ops);
1053} 1053}
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 434eed8c6185..0c2df3d3cfbf 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -3017,7 +3017,7 @@ void neigh_sysctl_unregister(struct neigh_parms *p)
3017 if (p->sysctl_table) { 3017 if (p->sysctl_table) {
3018 struct neigh_sysctl_table *t = p->sysctl_table; 3018 struct neigh_sysctl_table *t = p->sysctl_table;
3019 p->sysctl_table = NULL; 3019 p->sysctl_table = NULL;
3020 unregister_sysctl_table(t->sysctl_header); 3020 unregister_net_sysctl_table(t->sysctl_header);
3021 kfree(t->dev_name); 3021 kfree(t->dev_name);
3022 kfree(t); 3022 kfree(t);
3023 } 3023 }
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 8f67633b484e..7d3772e0d150 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -257,7 +257,7 @@ static __init int sysctl_core_init(void)
257{ 257{
258 static struct ctl_table empty[1]; 258 static struct ctl_table empty[1];
259 259
260 kmemleak_not_leak(register_sysctl_paths(net_core_path, empty)); 260 kmemleak_not_leak(register_net_sysctl_table(&init_net, net_core_path, empty));
261 register_net_sysctl(&init_net, "net/core", net_core_table); 261 register_net_sysctl(&init_net, "net/core", net_core_table);
262 return register_pernet_subsys(&sysctl_core_ops); 262 return register_pernet_subsys(&sysctl_core_ops);
263} 263}
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
index 42348824ee31..329e1390c26d 100644
--- a/net/dccp/sysctl.c
+++ b/net/dccp/sysctl.c
@@ -109,7 +109,7 @@ static struct ctl_table_header *dccp_table_header;
109 109
110int __init dccp_sysctl_init(void) 110int __init dccp_sysctl_init(void)
111{ 111{
112 dccp_table_header = register_sysctl_paths(dccp_path, 112 dccp_table_header = register_net_sysctl_table(&init_net, dccp_path,
113 dccp_default_table); 113 dccp_default_table);
114 114
115 return dccp_table_header != NULL ? 0 : -ENOMEM; 115 return dccp_table_header != NULL ? 0 : -ENOMEM;
@@ -118,7 +118,7 @@ int __init dccp_sysctl_init(void)
118void dccp_sysctl_exit(void) 118void dccp_sysctl_exit(void)
119{ 119{
120 if (dccp_table_header != NULL) { 120 if (dccp_table_header != NULL) {
121 unregister_sysctl_table(dccp_table_header); 121 unregister_net_sysctl_table(dccp_table_header);
122 dccp_table_header = NULL; 122 dccp_table_header = NULL;
123 } 123 }
124} 124}
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index a4aecb09d12a..ce8a18471845 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -236,7 +236,7 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
236 236
237 t->dn_dev_vars[0].extra1 = (void *)dev; 237 t->dn_dev_vars[0].extra1 = (void *)dev;
238 238
239 t->sysctl_header = register_sysctl_paths(dn_ctl_path, t->dn_dev_vars); 239 t->sysctl_header = register_net_sysctl_table(&init_net, dn_ctl_path, t->dn_dev_vars);
240 if (t->sysctl_header == NULL) 240 if (t->sysctl_header == NULL)
241 kfree(t); 241 kfree(t);
242 else 242 else
@@ -248,7 +248,7 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms)
248 if (parms->sysctl) { 248 if (parms->sysctl) {
249 struct dn_dev_sysctl_table *t = parms->sysctl; 249 struct dn_dev_sysctl_table *t = parms->sysctl;
250 parms->sysctl = NULL; 250 parms->sysctl = NULL;
251 unregister_sysctl_table(t->sysctl_header); 251 unregister_net_sysctl_table(t->sysctl_header);
252 kfree(t); 252 kfree(t);
253 } 253 }
254} 254}
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 02e75d11cfbb..4380b8edea72 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -359,12 +359,12 @@ static struct ctl_path dn_path[] = {
359 359
360void dn_register_sysctl(void) 360void dn_register_sysctl(void)
361{ 361{
362 dn_table_header = register_sysctl_paths(dn_path, dn_table); 362 dn_table_header = register_net_sysctl_table(&init_net, dn_path, dn_table);
363} 363}
364 364
365void dn_unregister_sysctl(void) 365void dn_unregister_sysctl(void)
366{ 366{
367 unregister_sysctl_table(dn_table_header); 367 unregister_net_sysctl_table(dn_table_header);
368} 368}
369 369
370#else /* CONFIG_SYSCTL */ 370#else /* CONFIG_SYSCTL */
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 94d45e1f8882..766485d7d099 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -586,7 +586,7 @@ static int __init ip_queue_init(void)
586#endif 586#endif
587 register_netdevice_notifier(&ipq_dev_notifier); 587 register_netdevice_notifier(&ipq_dev_notifier);
588#ifdef CONFIG_SYSCTL 588#ifdef CONFIG_SYSCTL
589 ipq_sysctl_header = register_sysctl_paths(net_ipv4_ctl_path, ipq_table); 589 ipq_sysctl_header = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, ipq_table);
590#endif 590#endif
591 status = nf_register_queue_handler(NFPROTO_IPV4, &nfqh); 591 status = nf_register_queue_handler(NFPROTO_IPV4, &nfqh);
592 if (status < 0) { 592 if (status < 0) {
@@ -597,7 +597,7 @@ static int __init ip_queue_init(void)
597 597
598cleanup_sysctl: 598cleanup_sysctl:
599#ifdef CONFIG_SYSCTL 599#ifdef CONFIG_SYSCTL
600 unregister_sysctl_table(ipq_sysctl_header); 600 unregister_net_sysctl_table(ipq_sysctl_header);
601#endif 601#endif
602 unregister_netdevice_notifier(&ipq_dev_notifier); 602 unregister_netdevice_notifier(&ipq_dev_notifier);
603 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 603 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
@@ -618,7 +618,7 @@ static void __exit ip_queue_fini(void)
618 ipq_flush(NULL, 0); 618 ipq_flush(NULL, 0);
619 619
620#ifdef CONFIG_SYSCTL 620#ifdef CONFIG_SYSCTL
621 unregister_sysctl_table(ipq_sysctl_header); 621 unregister_net_sysctl_table(ipq_sysctl_header);
622#endif 622#endif
623 unregister_netdevice_notifier(&ipq_dev_notifier); 623 unregister_netdevice_notifier(&ipq_dev_notifier);
624 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 624 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a1c115d750e9..86866a4b537f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3515,6 +3515,6 @@ int __init ip_rt_init(void)
3515 */ 3515 */
3516void __init ip_static_sysctl_init(void) 3516void __init ip_static_sysctl_init(void)
3517{ 3517{
3518 kmemleak_not_leak(register_sysctl_paths(ipv4_path, ipv4_skeleton)); 3518 kmemleak_not_leak(register_net_sysctl_table(&init_net, ipv4_path, ipv4_skeleton));
3519} 3519}
3520#endif 3520#endif
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 34a628625d9c..e7a6fa3d70bb 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -857,12 +857,12 @@ static __init int sysctl_ipv4_init(void)
857 if (!i->procname) 857 if (!i->procname)
858 return -EINVAL; 858 return -EINVAL;
859 859
860 hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table); 860 hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, ipv4_table);
861 if (hdr == NULL) 861 if (hdr == NULL)
862 return -ENOMEM; 862 return -ENOMEM;
863 863
864 if (register_pernet_subsys(&ipv4_sysctl_ops)) { 864 if (register_pernet_subsys(&ipv4_sysctl_ops)) {
865 unregister_sysctl_table(hdr); 865 unregister_net_sysctl_table(hdr);
866 return -ENOMEM; 866 return -ENOMEM;
867 } 867 }
868 868
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index a34c9e4c792c..6785f5044acf 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -588,7 +588,7 @@ static int __init ip6_queue_init(void)
588#endif 588#endif
589 register_netdevice_notifier(&ipq_dev_notifier); 589 register_netdevice_notifier(&ipq_dev_notifier);
590#ifdef CONFIG_SYSCTL 590#ifdef CONFIG_SYSCTL
591 ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table); 591 ipq_sysctl_header = register_net_sysctl_table(&init_net, net_ipv6_ctl_path, ipq_table);
592#endif 592#endif
593 status = nf_register_queue_handler(NFPROTO_IPV6, &nfqh); 593 status = nf_register_queue_handler(NFPROTO_IPV6, &nfqh);
594 if (status < 0) { 594 if (status < 0) {
@@ -599,7 +599,7 @@ static int __init ip6_queue_init(void)
599 599
600cleanup_sysctl: 600cleanup_sysctl:
601#ifdef CONFIG_SYSCTL 601#ifdef CONFIG_SYSCTL
602 unregister_sysctl_table(ipq_sysctl_header); 602 unregister_net_sysctl_table(ipq_sysctl_header);
603#endif 603#endif
604 unregister_netdevice_notifier(&ipq_dev_notifier); 604 unregister_netdevice_notifier(&ipq_dev_notifier);
605 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 605 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
@@ -621,7 +621,7 @@ static void __exit ip6_queue_fini(void)
621 ipq_flush(NULL, 0); 621 ipq_flush(NULL, 0);
622 622
623#ifdef CONFIG_SYSCTL 623#ifdef CONFIG_SYSCTL
624 unregister_sysctl_table(ipq_sysctl_header); 624 unregister_net_sysctl_table(ipq_sysctl_header);
625#endif 625#endif
626 unregister_netdevice_notifier(&ipq_dev_notifier); 626 unregister_netdevice_notifier(&ipq_dev_notifier);
627 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 627 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 38f00b0298d3..754814462950 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -626,7 +626,7 @@ int nf_ct_frag6_init(void)
626 inet_frags_init(&nf_frags); 626 inet_frags_init(&nf_frags);
627 627
628#ifdef CONFIG_SYSCTL 628#ifdef CONFIG_SYSCTL
629 nf_ct_frag6_sysctl_header = register_sysctl_paths(nf_net_netfilter_sysctl_path, 629 nf_ct_frag6_sysctl_header = register_net_sysctl_table(&init_net, nf_net_netfilter_sysctl_path,
630 nf_ct_frag6_sysctl_table); 630 nf_ct_frag6_sysctl_table);
631 if (!nf_ct_frag6_sysctl_header) { 631 if (!nf_ct_frag6_sysctl_header) {
632 inet_frags_fini(&nf_frags); 632 inet_frags_fini(&nf_frags);
@@ -640,7 +640,7 @@ int nf_ct_frag6_init(void)
640void nf_ct_frag6_cleanup(void) 640void nf_ct_frag6_cleanup(void)
641{ 641{
642#ifdef CONFIG_SYSCTL 642#ifdef CONFIG_SYSCTL
643 unregister_sysctl_table(nf_ct_frag6_sysctl_header); 643 unregister_net_sysctl_table(nf_ct_frag6_sysctl_header);
644 nf_ct_frag6_sysctl_header = NULL; 644 nf_ct_frag6_sysctl_header = NULL;
645#endif 645#endif
646 inet_frags_fini(&nf_frags); 646 inet_frags_fini(&nf_frags);
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 06f21e5ad361..99279c8aaf29 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -165,7 +165,7 @@ static struct ctl_table_header *ip6_base;
165 165
166int ipv6_static_sysctl_register(void) 166int ipv6_static_sysctl_register(void)
167{ 167{
168 ip6_base = register_sysctl_paths(net_ipv6_ctl_path, ipv6_static_skeleton); 168 ip6_base = register_net_sysctl_table(&init_net, net_ipv6_ctl_path, ipv6_static_skeleton);
169 if (ip6_base == NULL) 169 if (ip6_base == NULL)
170 return -ENOMEM; 170 return -ENOMEM;
171 return 0; 171 return 0;
diff --git a/net/ipx/sysctl_net_ipx.c b/net/ipx/sysctl_net_ipx.c
index bd6dca00fb85..035880709e84 100644
--- a/net/ipx/sysctl_net_ipx.c
+++ b/net/ipx/sysctl_net_ipx.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/sysctl.h> 10#include <linux/sysctl.h>
11#include <net/net_namespace.h>
11 12
12#ifndef CONFIG_SYSCTL 13#ifndef CONFIG_SYSCTL
13#error This file should not be compiled without CONFIG_SYSCTL defined 14#error This file should not be compiled without CONFIG_SYSCTL defined
@@ -37,10 +38,10 @@ static struct ctl_table_header *ipx_table_header;
37 38
38void ipx_register_sysctl(void) 39void ipx_register_sysctl(void)
39{ 40{
40 ipx_table_header = register_sysctl_paths(ipx_path, ipx_table); 41 ipx_table_header = register_net_sysctl_table(&init_net, ipx_path, ipx_table);
41} 42}
42 43
43void ipx_unregister_sysctl(void) 44void ipx_unregister_sysctl(void)
44{ 45{
45 unregister_sysctl_table(ipx_table_header); 46 unregister_net_sysctl_table(ipx_table_header);
46} 47}
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index 2615ffc8e785..20ced38fc371 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -251,7 +251,7 @@ static struct ctl_table_header *irda_table_header;
251 */ 251 */
252int __init irda_sysctl_register(void) 252int __init irda_sysctl_register(void)
253{ 253{
254 irda_table_header = register_sysctl_paths(irda_path, irda_table); 254 irda_table_header = register_net_sysctl_table(&init_net, irda_path, irda_table);
255 if (!irda_table_header) 255 if (!irda_table_header)
256 return -ENOMEM; 256 return -ENOMEM;
257 257
@@ -266,7 +266,7 @@ int __init irda_sysctl_register(void)
266 */ 266 */
267void irda_sysctl_unregister(void) 267void irda_sysctl_unregister(void)
268{ 268{
269 unregister_sysctl_table(irda_table_header); 269 unregister_net_sysctl_table(irda_table_header);
270} 270}
271 271
272 272
diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c
index e2ebe3586263..9a6a65f2104b 100644
--- a/net/llc/sysctl_net_llc.c
+++ b/net/llc/sysctl_net_llc.c
@@ -7,6 +7,7 @@
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/sysctl.h> 9#include <linux/sysctl.h>
10#include <net/net_namespace.h>
10#include <net/llc.h> 11#include <net/llc.h>
11 12
12#ifndef CONFIG_SYSCTL 13#ifndef CONFIG_SYSCTL
@@ -89,7 +90,7 @@ static struct ctl_table_header *llc_table_header;
89 90
90int __init llc_sysctl_init(void) 91int __init llc_sysctl_init(void)
91{ 92{
92 llc_table_header = register_sysctl_paths(llc_path, llc_table); 93 llc_table_header = register_net_sysctl_table(&init_net, llc_path, llc_table);
93 94
94 return llc_table_header ? 0 : -ENOMEM; 95 return llc_table_header ? 0 : -ENOMEM;
95} 96}
@@ -97,7 +98,7 @@ int __init llc_sysctl_init(void)
97void llc_sysctl_exit(void) 98void llc_sysctl_exit(void)
98{ 99{
99 if (llc_table_header) { 100 if (llc_table_header) {
100 unregister_sysctl_table(llc_table_header); 101 unregister_net_sysctl_table(llc_table_header);
101 llc_table_header = NULL; 102 llc_table_header = NULL;
102 } 103 }
103} 104}
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c
index be3da2c8cdc5..bbc753fd4fe0 100644
--- a/net/netfilter/nf_conntrack_proto.c
+++ b/net/netfilter/nf_conntrack_proto.c
@@ -40,7 +40,7 @@ nf_ct_register_sysctl(struct ctl_table_header **header, struct ctl_path *path,
40 struct ctl_table *table, unsigned int *users) 40 struct ctl_table *table, unsigned int *users)
41{ 41{
42 if (*header == NULL) { 42 if (*header == NULL) {
43 *header = register_sysctl_paths(path, table); 43 *header = register_net_sysctl_table(&init_net, path, table);
44 if (*header == NULL) 44 if (*header == NULL)
45 return -ENOMEM; 45 return -ENOMEM;
46 } 46 }
@@ -56,7 +56,7 @@ nf_ct_unregister_sysctl(struct ctl_table_header **header,
56 if (users != NULL && --*users > 0) 56 if (users != NULL && --*users > 0)
57 return; 57 return;
58 58
59 unregister_sysctl_table(*header); 59 unregister_net_sysctl_table(*header);
60 *header = NULL; 60 *header = NULL;
61} 61}
62#endif 62#endif
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 885f5ab9bc28..0c3888de0f55 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -479,7 +479,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
479 479
480 if (net_eq(net, &init_net)) { 480 if (net_eq(net, &init_net)) {
481 nf_ct_netfilter_header = 481 nf_ct_netfilter_header =
482 register_sysctl_paths(nf_ct_path, nf_ct_netfilter_table); 482 register_net_sysctl_table(&init_net, nf_ct_path, nf_ct_netfilter_table);
483 if (!nf_ct_netfilter_header) 483 if (!nf_ct_netfilter_header)
484 goto out; 484 goto out;
485 } 485 }
@@ -505,7 +505,7 @@ out_unregister_netfilter:
505 kfree(table); 505 kfree(table);
506out_kmemdup: 506out_kmemdup:
507 if (net_eq(net, &init_net)) 507 if (net_eq(net, &init_net))
508 unregister_sysctl_table(nf_ct_netfilter_header); 508 unregister_net_sysctl_table(nf_ct_netfilter_header);
509out: 509out:
510 printk(KERN_ERR "nf_conntrack: can't register to sysctl.\n"); 510 printk(KERN_ERR "nf_conntrack: can't register to sysctl.\n");
511 return -ENOMEM; 511 return -ENOMEM;
@@ -516,7 +516,7 @@ static void nf_conntrack_standalone_fini_sysctl(struct net *net)
516 struct ctl_table *table; 516 struct ctl_table *table;
517 517
518 if (net_eq(net, &init_net)) 518 if (net_eq(net, &init_net))
519 unregister_sysctl_table(nf_ct_netfilter_header); 519 unregister_net_sysctl_table(nf_ct_netfilter_header);
520 table = net->ct.sysctl_header->ctl_table_arg; 520 table = net->ct.sysctl_header->ctl_table_arg;
521 unregister_net_sysctl_table(net->ct.sysctl_header); 521 unregister_net_sysctl_table(net->ct.sysctl_header);
522 kfree(table); 522 kfree(table);
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 957374a234d4..04fca48d901a 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -283,7 +283,7 @@ static __init int netfilter_log_sysctl_init(void)
283 nf_log_sysctl_table[i].extra1 = (void *)(unsigned long) i; 283 nf_log_sysctl_table[i].extra1 = (void *)(unsigned long) i;
284 } 284 }
285 285
286 nf_log_dir_header = register_sysctl_paths(nf_log_sysctl_path, 286 nf_log_dir_header = register_net_sysctl_table(&init_net, nf_log_sysctl_path,
287 nf_log_sysctl_table); 287 nf_log_sysctl_table);
288 if (!nf_log_dir_header) 288 if (!nf_log_dir_header)
289 return -ENOMEM; 289 return -ENOMEM;
diff --git a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c
index 1e0fa9e57aac..4ed149e265bf 100644
--- a/net/netrom/sysctl_net_netrom.c
+++ b/net/netrom/sysctl_net_netrom.c
@@ -154,10 +154,10 @@ static struct ctl_path nr_path[] = {
154 154
155void __init nr_register_sysctl(void) 155void __init nr_register_sysctl(void)
156{ 156{
157 nr_table_header = register_sysctl_paths(nr_path, nr_table); 157 nr_table_header = register_net_sysctl_table(&init_net, nr_path, nr_table);
158} 158}
159 159
160void nr_unregister_sysctl(void) 160void nr_unregister_sysctl(void)
161{ 161{
162 unregister_sysctl_table(nr_table_header); 162 unregister_net_sysctl_table(nr_table_header);
163} 163}
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c
index 8bed7675b3f4..aa55db5f383b 100644
--- a/net/phonet/sysctl.c
+++ b/net/phonet/sysctl.c
@@ -106,11 +106,11 @@ static struct ctl_path phonet_ctl_path[] = {
106 106
107int __init phonet_sysctl_init(void) 107int __init phonet_sysctl_init(void)
108{ 108{
109 phonet_table_hrd = register_sysctl_paths(phonet_ctl_path, phonet_table); 109 phonet_table_hrd = register_net_sysctl_table(&init_net, phonet_ctl_path, phonet_table);
110 return phonet_table_hrd == NULL ? -ENOMEM : 0; 110 return phonet_table_hrd == NULL ? -ENOMEM : 0;
111} 111}
112 112
113void phonet_sysctl_exit(void) 113void phonet_sysctl_exit(void)
114{ 114{
115 unregister_sysctl_table(phonet_table_hrd); 115 unregister_net_sysctl_table(phonet_table_hrd);
116} 116}
diff --git a/net/rds/ib_sysctl.c b/net/rds/ib_sysctl.c
index 1253b006efdb..0fef3e15777b 100644
--- a/net/rds/ib_sysctl.c
+++ b/net/rds/ib_sysctl.c
@@ -116,12 +116,12 @@ static struct ctl_path rds_ib_sysctl_path[] = {
116void rds_ib_sysctl_exit(void) 116void rds_ib_sysctl_exit(void)
117{ 117{
118 if (rds_ib_sysctl_hdr) 118 if (rds_ib_sysctl_hdr)
119 unregister_sysctl_table(rds_ib_sysctl_hdr); 119 unregister_net_sysctl_table(rds_ib_sysctl_hdr);
120} 120}
121 121
122int rds_ib_sysctl_init(void) 122int rds_ib_sysctl_init(void)
123{ 123{
124 rds_ib_sysctl_hdr = register_sysctl_paths(rds_ib_sysctl_path, rds_ib_sysctl_table); 124 rds_ib_sysctl_hdr = register_net_sysctl_table(&init_net, rds_ib_sysctl_path, rds_ib_sysctl_table);
125 if (!rds_ib_sysctl_hdr) 125 if (!rds_ib_sysctl_hdr)
126 return -ENOMEM; 126 return -ENOMEM;
127 return 0; 127 return 0;
diff --git a/net/rds/iw_sysctl.c b/net/rds/iw_sysctl.c
index e2e47176e729..bcfe36dc55a7 100644
--- a/net/rds/iw_sysctl.c
+++ b/net/rds/iw_sysctl.c
@@ -119,12 +119,12 @@ static struct ctl_path rds_iw_sysctl_path[] = {
119void rds_iw_sysctl_exit(void) 119void rds_iw_sysctl_exit(void)
120{ 120{
121 if (rds_iw_sysctl_hdr) 121 if (rds_iw_sysctl_hdr)
122 unregister_sysctl_table(rds_iw_sysctl_hdr); 122 unregister_net_sysctl_table(rds_iw_sysctl_hdr);
123} 123}
124 124
125int rds_iw_sysctl_init(void) 125int rds_iw_sysctl_init(void)
126{ 126{
127 rds_iw_sysctl_hdr = register_sysctl_paths(rds_iw_sysctl_path, rds_iw_sysctl_table); 127 rds_iw_sysctl_hdr = register_net_sysctl_table(&init_net, rds_iw_sysctl_path, rds_iw_sysctl_table);
128 if (!rds_iw_sysctl_hdr) 128 if (!rds_iw_sysctl_hdr)
129 return -ENOMEM; 129 return -ENOMEM;
130 return 0; 130 return 0;
diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
index 25ad0c77a26c..30354b8cd584 100644
--- a/net/rds/sysctl.c
+++ b/net/rds/sysctl.c
@@ -102,7 +102,7 @@ static struct ctl_path rds_sysctl_path[] = {
102void rds_sysctl_exit(void) 102void rds_sysctl_exit(void)
103{ 103{
104 if (rds_sysctl_reg_table) 104 if (rds_sysctl_reg_table)
105 unregister_sysctl_table(rds_sysctl_reg_table); 105 unregister_net_sysctl_table(rds_sysctl_reg_table);
106} 106}
107 107
108int rds_sysctl_init(void) 108int rds_sysctl_init(void)
@@ -110,7 +110,7 @@ int rds_sysctl_init(void)
110 rds_sysctl_reconnect_min = msecs_to_jiffies(1); 110 rds_sysctl_reconnect_min = msecs_to_jiffies(1);
111 rds_sysctl_reconnect_min_jiffies = rds_sysctl_reconnect_min; 111 rds_sysctl_reconnect_min_jiffies = rds_sysctl_reconnect_min;
112 112
113 rds_sysctl_reg_table = register_sysctl_paths(rds_sysctl_path, rds_sysctl_rds_table); 113 rds_sysctl_reg_table = register_net_sysctl_table(&init_net, rds_sysctl_path, rds_sysctl_rds_table);
114 if (!rds_sysctl_reg_table) 114 if (!rds_sysctl_reg_table)
115 return -ENOMEM; 115 return -ENOMEM;
116 return 0; 116 return 0;
diff --git a/net/rose/sysctl_net_rose.c b/net/rose/sysctl_net_rose.c
index df6d9dac2186..02b73979535b 100644
--- a/net/rose/sysctl_net_rose.c
+++ b/net/rose/sysctl_net_rose.c
@@ -126,10 +126,10 @@ static struct ctl_path rose_path[] = {
126 126
127void __init rose_register_sysctl(void) 127void __init rose_register_sysctl(void)
128{ 128{
129 rose_table_header = register_sysctl_paths(rose_path, rose_table); 129 rose_table_header = register_net_sysctl_table(&init_net, rose_path, rose_table);
130} 130}
131 131
132void rose_unregister_sysctl(void) 132void rose_unregister_sysctl(void)
133{ 133{
134 unregister_sysctl_table(rose_table_header); 134 unregister_net_sysctl_table(rose_table_header);
135} 135}
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 60ffbd067ff7..1e385b452047 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -286,11 +286,11 @@ static struct ctl_table_header * sctp_sysctl_header;
286/* Sysctl registration. */ 286/* Sysctl registration. */
287void sctp_sysctl_register(void) 287void sctp_sysctl_register(void)
288{ 288{
289 sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table); 289 sctp_sysctl_header = register_net_sysctl_table(&init_net, sctp_path, sctp_table);
290} 290}
291 291
292/* Sysctl deregistration. */ 292/* Sysctl deregistration. */
293void sctp_sysctl_unregister(void) 293void sctp_sysctl_unregister(void)
294{ 294{
295 unregister_sysctl_table(sctp_sysctl_header); 295 unregister_net_sysctl_table(sctp_sysctl_header);
296} 296}
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index 397cffebb3b6..4f6979c06f84 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -58,6 +58,6 @@ void unix_sysctl_unregister(struct net *net)
58 struct ctl_table *table; 58 struct ctl_table *table;
59 59
60 table = net->unx.ctl->ctl_table_arg; 60 table = net->unx.ctl->ctl_table_arg;
61 unregister_sysctl_table(net->unx.ctl); 61 unregister_net_sysctl_table(net->unx.ctl);
62 kfree(table); 62 kfree(table);
63} 63}
diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c
index d2efd29f434e..08337cb488d4 100644
--- a/net/x25/sysctl_net_x25.c
+++ b/net/x25/sysctl_net_x25.c
@@ -81,10 +81,10 @@ static struct ctl_path x25_path[] = {
81 81
82void __init x25_register_sysctl(void) 82void __init x25_register_sysctl(void)
83{ 83{
84 x25_table_header = register_sysctl_paths(x25_path, x25_table); 84 x25_table_header = register_net_sysctl_table(&init_net, x25_path, x25_table);
85} 85}
86 86
87void x25_unregister_sysctl(void) 87void x25_unregister_sysctl(void)
88{ 88{
89 unregister_sysctl_table(x25_table_header); 89 unregister_net_sysctl_table(x25_table_header);
90} 90}