aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-04-19 09:22:55 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-20 21:21:17 -0400
commit4344475797a16ef948385780943f7a5cf09f0675 (patch)
tree1cd80eae7c46a1e3f2f5c546212d84d007a5dffa
parent2ca794e5e86c800d7f98c4ebb8bd325099c0afe8 (diff)
net: Kill register_sysctl_rotable
register_sysctl_rotable never caught on as an interesting way to register sysctls. My take on the situation is that what we want are sysctls that we can only see in the initial network namespace. What we have implemented with register_sysctl_rotable are sysctls that we can see in all of the network namespaces and can only change in the initial network namespace. That is a very silly way to go. Just register the network sysctls in the initial network namespace and we don't have any weird special cases to deal with. The sysctls affected are: /proc/sys/net/ipv4/ipfrag_secret_interval /proc/sys/net/ipv4/ipfrag_max_dist /proc/sys/net/ipv6/ip6frag_secret_interval /proc/sys/net/ipv6/mld_max_msf I really don't expect anyone will miss them if they can't read them in a child user namespace. CC: Pavel Emelyanov <xemul@openvz.org> 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--include/net/net_namespace.h2
-rw-r--r--net/core/sysctl_net_core.c2
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv6/reassembly.c2
-rw-r--r--net/ipv6/sysctl_net_ipv6.c2
-rw-r--r--net/sysctl_net.c23
6 files changed, 4 insertions, 29 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 767dcd401e57..6413fcb53cd1 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -290,8 +290,6 @@ static inline int net_sysctl_init(void) { return 0; }
290#endif 290#endif
291extern struct ctl_table_header *register_net_sysctl_table(struct net *net, 291extern struct ctl_table_header *register_net_sysctl_table(struct net *net,
292 const struct ctl_path *path, struct ctl_table *table); 292 const struct ctl_path *path, struct ctl_table *table);
293extern struct ctl_table_header *register_net_sysctl_rotable(
294 const struct ctl_path *path, struct ctl_table *table);
295extern struct ctl_table_header *register_net_sysctl(struct net *net, 293extern struct ctl_table_header *register_net_sysctl(struct net *net,
296 const char *path, struct ctl_table *table); 294 const char *path, struct ctl_table *table);
297extern void unregister_net_sysctl_table(struct ctl_table_header *header); 295extern void unregister_net_sysctl_table(struct ctl_table_header *header);
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 247c69b7cfc2..8f67633b484e 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -258,7 +258,7 @@ static __init int sysctl_core_init(void)
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_sysctl_paths(net_core_path, empty));
261 register_net_sysctl_rotable(net_core_path, 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}
264 264
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 631f596d5d70..6a2f85cd440e 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -807,7 +807,7 @@ static void __net_exit ip4_frags_ns_ctl_unregister(struct net *net)
807 807
808static void ip4_frags_ctl_register(void) 808static void ip4_frags_ctl_register(void)
809{ 809{
810 register_net_sysctl_rotable(net_ipv4_ctl_path, ip4_frags_ctl_table); 810 register_net_sysctl(&init_net, "net/ipv4", ip4_frags_ctl_table);
811} 811}
812#else 812#else
813static inline int ip4_frags_ns_ctl_register(struct net *net) 813static inline int ip4_frags_ns_ctl_register(struct net *net)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 9447bd69873a..42f4f7c0948a 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -674,7 +674,7 @@ static struct ctl_table_header *ip6_ctl_header;
674 674
675static int ip6_frags_sysctl_register(void) 675static int ip6_frags_sysctl_register(void)
676{ 676{
677 ip6_ctl_header = register_net_sysctl_rotable(net_ipv6_ctl_path, 677 ip6_ctl_header = register_net_sysctl(&init_net, "net/ipv6",
678 ip6_frags_ctl_table); 678 ip6_frags_ctl_table);
679 return ip6_ctl_header == NULL ? -ENOMEM : 0; 679 return ip6_ctl_header == NULL ? -ENOMEM : 0;
680} 680}
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 166a57c47d39..06f21e5ad361 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -140,7 +140,7 @@ int ipv6_sysctl_register(void)
140{ 140{
141 int err = -ENOMEM; 141 int err = -ENOMEM;
142 142
143 ip6_header = register_net_sysctl_rotable(net_ipv6_ctl_path, ipv6_rotable); 143 ip6_header = register_net_sysctl(&init_net, "net/ipv6", ipv6_rotable);
144 if (ip6_header == NULL) 144 if (ip6_header == NULL)
145 goto out; 145 goto out;
146 146
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index ce97237b653f..2b8d1d950987 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -59,19 +59,6 @@ static struct ctl_table_root net_sysctl_root = {
59 .permissions = net_ctl_permissions, 59 .permissions = net_ctl_permissions,
60}; 60};
61 61
62static int net_ctl_ro_header_perms(struct ctl_table_root *root,
63 struct nsproxy *namespaces, struct ctl_table *table)
64{
65 if (net_eq(namespaces->net_ns, &init_net))
66 return table->mode;
67 else
68 return table->mode & ~0222;
69}
70
71static struct ctl_table_root net_sysctl_ro_root = {
72 .permissions = net_ctl_ro_header_perms,
73};
74
75static int __net_init sysctl_net_init(struct net *net) 62static int __net_init sysctl_net_init(struct net *net)
76{ 63{
77 setup_sysctl_set(&net->sysctls, &net_sysctl_root, is_seen); 64 setup_sysctl_set(&net->sysctls, &net_sysctl_root, is_seen);
@@ -103,8 +90,6 @@ __init int net_sysctl_init(void)
103 ret = register_pernet_subsys(&sysctl_pernet_ops); 90 ret = register_pernet_subsys(&sysctl_pernet_ops);
104 if (ret) 91 if (ret)
105 goto out; 92 goto out;
106 setup_sysctl_set(&net_sysctl_ro_root.default_set, &net_sysctl_ro_root, NULL);
107 register_sysctl_root(&net_sysctl_ro_root);
108 register_sysctl_root(&net_sysctl_root); 93 register_sysctl_root(&net_sysctl_root);
109out: 94out:
110 return ret; 95 return ret;
@@ -117,14 +102,6 @@ struct ctl_table_header *register_net_sysctl_table(struct net *net,
117} 102}
118EXPORT_SYMBOL_GPL(register_net_sysctl_table); 103EXPORT_SYMBOL_GPL(register_net_sysctl_table);
119 104
120struct ctl_table_header *register_net_sysctl_rotable(const
121 struct ctl_path *path, struct ctl_table *table)
122{
123 return __register_sysctl_paths(&net_sysctl_ro_root.default_set,
124 path, table);
125}
126EXPORT_SYMBOL_GPL(register_net_sysctl_rotable);
127
128struct ctl_table_header *register_net_sysctl(struct net *net, 105struct ctl_table_header *register_net_sysctl(struct net *net,
129 const char *path, struct ctl_table *table) 106 const char *path, struct ctl_table *table)
130{ 107{