aboutsummaryrefslogtreecommitdiffstats
path: root/net/sysctl_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sysctl_net.c')
-rw-r--r--net/sysctl_net.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index e75813904f26..c3e65aebecc0 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -74,15 +74,13 @@ static struct ctl_table_root net_sysctl_ro_root = {
74 74
75static int __net_init sysctl_net_init(struct net *net) 75static int __net_init sysctl_net_init(struct net *net)
76{ 76{
77 setup_sysctl_set(&net->sysctls, 77 setup_sysctl_set(&net->sysctls, &net_sysctl_root, is_seen);
78 &net_sysctl_ro_root.default_set,
79 is_seen);
80 return 0; 78 return 0;
81} 79}
82 80
83static void __net_exit sysctl_net_exit(struct net *net) 81static void __net_exit sysctl_net_exit(struct net *net)
84{ 82{
85 WARN_ON(!list_empty(&net->sysctls.list)); 83 retire_sysctl_set(&net->sysctls);
86} 84}
87 85
88static struct pernet_operations sysctl_pernet_ops = { 86static struct pernet_operations sysctl_pernet_ops = {
@@ -90,36 +88,32 @@ static struct pernet_operations sysctl_pernet_ops = {
90 .exit = sysctl_net_exit, 88 .exit = sysctl_net_exit,
91}; 89};
92 90
93static __init int sysctl_init(void) 91static __init int net_sysctl_init(void)
94{ 92{
95 int ret; 93 int ret;
96 ret = register_pernet_subsys(&sysctl_pernet_ops); 94 ret = register_pernet_subsys(&sysctl_pernet_ops);
97 if (ret) 95 if (ret)
98 goto out; 96 goto out;
99 register_sysctl_root(&net_sysctl_root); 97 setup_sysctl_set(&net_sysctl_ro_root.default_set, &net_sysctl_ro_root, NULL);
100 setup_sysctl_set(&net_sysctl_ro_root.default_set, NULL, NULL);
101 register_sysctl_root(&net_sysctl_ro_root); 98 register_sysctl_root(&net_sysctl_ro_root);
99 register_sysctl_root(&net_sysctl_root);
102out: 100out:
103 return ret; 101 return ret;
104} 102}
105subsys_initcall(sysctl_init); 103subsys_initcall(net_sysctl_init);
106 104
107struct ctl_table_header *register_net_sysctl_table(struct net *net, 105struct ctl_table_header *register_net_sysctl_table(struct net *net,
108 const struct ctl_path *path, struct ctl_table *table) 106 const struct ctl_path *path, struct ctl_table *table)
109{ 107{
110 struct nsproxy namespaces; 108 return __register_sysctl_paths(&net->sysctls, path, table);
111 namespaces = *current->nsproxy;
112 namespaces.net_ns = net;
113 return __register_sysctl_paths(&net_sysctl_root,
114 &namespaces, path, table);
115} 109}
116EXPORT_SYMBOL_GPL(register_net_sysctl_table); 110EXPORT_SYMBOL_GPL(register_net_sysctl_table);
117 111
118struct ctl_table_header *register_net_sysctl_rotable(const 112struct ctl_table_header *register_net_sysctl_rotable(const
119 struct ctl_path *path, struct ctl_table *table) 113 struct ctl_path *path, struct ctl_table *table)
120{ 114{
121 return __register_sysctl_paths(&net_sysctl_ro_root, 115 return __register_sysctl_paths(&net_sysctl_ro_root.default_set,
122 &init_nsproxy, path, table); 116 path, table);
123} 117}
124EXPORT_SYMBOL_GPL(register_net_sysctl_rotable); 118EXPORT_SYMBOL_GPL(register_net_sysctl_rotable);
125 119