aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2008-07-27 03:59:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-27 12:45:34 -0400
commiteeb61f719c00c626115852bbc91189dc3011a844 (patch)
treeb52cddf222ee55082c0aeee5627049aa0d12afa4
parentbfbcf034798b2ca45338cee5049b5694b7ddc865 (diff)
missing bits of net-namespace / sysctl
Piss-poor sysctl registration API strikes again, film at 11... What we really need is _pathname_ required to be present in already registered table, so that kernel could warn about bad order. That's the next target for sysctl stuff (and generally saner and more explicit order of initialization of ipv[46] internals wouldn't hurt either). For the time being, here are full fixups required by ..._rotable() stuff; we make per-net sysctl sets descendents of "ro" one and make sure that sufficient skeleton is there before we start registering per-net sysctls. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/route.h2
-rw-r--r--net/ipv4/route.c11
-rw-r--r--net/ipv4/sysctl_net_ipv4.c14
-rw-r--r--net/ipv6/af_inet6.c12
-rw-r--r--net/ipv6/sysctl_net_ipv6.c16
-rw-r--r--net/sysctl_net.c4
7 files changed, 43 insertions, 18 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 2d5c18514a2d..113028fb8f66 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -608,6 +608,8 @@ extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
608extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 608extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
609extern int ipv6_sysctl_register(void); 609extern int ipv6_sysctl_register(void);
610extern void ipv6_sysctl_unregister(void); 610extern void ipv6_sysctl_unregister(void);
611extern int ipv6_static_sysctl_register(void);
612extern void ipv6_static_sysctl_unregister(void);
611#endif 613#endif
612 614
613#endif /* __KERNEL__ */ 615#endif /* __KERNEL__ */
diff --git a/include/net/route.h b/include/net/route.h
index 3140cc500854..4f0d8c14736c 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -204,6 +204,4 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt)
204 return rt->peer; 204 return rt->peer;
205} 205}
206 206
207extern ctl_table ipv4_route_table[];
208
209#endif /* _ROUTE_H */ 207#endif /* _ROUTE_H */
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a507c5e27d0e..380d6474cf66 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2914,7 +2914,7 @@ static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
2914 return 0; 2914 return 0;
2915} 2915}
2916 2916
2917ctl_table ipv4_route_table[] = { 2917static ctl_table ipv4_route_table[] = {
2918 { 2918 {
2919 .ctl_name = NET_IPV4_ROUTE_GC_THRESH, 2919 .ctl_name = NET_IPV4_ROUTE_GC_THRESH,
2920 .procname = "gc_thresh", 2920 .procname = "gc_thresh",
@@ -3216,6 +3216,15 @@ int __init ip_rt_init(void)
3216 return rc; 3216 return rc;
3217} 3217}
3218 3218
3219/*
3220 * We really need to sanitize the damn ipv4 init order, then all
3221 * this nonsense will go away.
3222 */
3223void __init ip_static_sysctl_init(void)
3224{
3225 register_sysctl_paths(ipv4_route_path, ipv4_route_table);
3226}
3227
3219EXPORT_SYMBOL(__ip_select_ident); 3228EXPORT_SYMBOL(__ip_select_ident);
3220EXPORT_SYMBOL(ip_route_input); 3229EXPORT_SYMBOL(ip_route_input);
3221EXPORT_SYMBOL(ip_route_output_key); 3230EXPORT_SYMBOL(ip_route_output_key);
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index d63e9388d92d..770d827f5ab8 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -401,13 +401,6 @@ static struct ctl_table ipv4_table[] = {
401 .proc_handler = &ipv4_local_port_range, 401 .proc_handler = &ipv4_local_port_range,
402 .strategy = &ipv4_sysctl_local_port_range, 402 .strategy = &ipv4_sysctl_local_port_range,
403 }, 403 },
404 {
405 .ctl_name = NET_IPV4_ROUTE,
406 .procname = "route",
407 .maxlen = 0,
408 .mode = 0555,
409 .child = ipv4_route_table
410 },
411#ifdef CONFIG_IP_MULTICAST 404#ifdef CONFIG_IP_MULTICAST
412 { 405 {
413 .ctl_name = NET_IPV4_IGMP_MAX_MEMBERSHIPS, 406 .ctl_name = NET_IPV4_IGMP_MAX_MEMBERSHIPS,
@@ -882,11 +875,4 @@ static __init int sysctl_ipv4_init(void)
882 return 0; 875 return 0;
883} 876}
884 877
885/* set enough of tree skeleton to get rid of ordering problems */
886void __init ip_static_sysctl_init(void)
887{
888 static ctl_table table[1];
889 register_sysctl_paths(net_ipv4_ctl_path, table);
890}
891
892__initcall(sysctl_ipv4_init); 878__initcall(sysctl_ipv4_init);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index c708ca842298..95055f8c3f35 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -934,6 +934,11 @@ static int __init inet6_init(void)
934 if (err) 934 if (err)
935 goto out_unregister_sock; 935 goto out_unregister_sock;
936 936
937#ifdef CONFIG_SYSCTL
938 err = ipv6_static_sysctl_register();
939 if (err)
940 goto static_sysctl_fail;
941#endif
937 /* 942 /*
938 * ipngwg API draft makes clear that the correct semantics 943 * ipngwg API draft makes clear that the correct semantics
939 * for TCP and UDP is to consider one TCP and UDP instance 944 * for TCP and UDP is to consider one TCP and UDP instance
@@ -1058,6 +1063,10 @@ ipmr_fail:
1058icmp_fail: 1063icmp_fail:
1059 unregister_pernet_subsys(&inet6_net_ops); 1064 unregister_pernet_subsys(&inet6_net_ops);
1060register_pernet_fail: 1065register_pernet_fail:
1066#ifdef CONFIG_SYSCTL
1067 ipv6_static_sysctl_unregister();
1068static_sysctl_fail:
1069#endif
1061 cleanup_ipv6_mibs(); 1070 cleanup_ipv6_mibs();
1062out_unregister_sock: 1071out_unregister_sock:
1063 sock_unregister(PF_INET6); 1072 sock_unregister(PF_INET6);
@@ -1113,6 +1122,9 @@ static void __exit inet6_exit(void)
1113 rawv6_exit(); 1122 rawv6_exit();
1114 1123
1115 unregister_pernet_subsys(&inet6_net_ops); 1124 unregister_pernet_subsys(&inet6_net_ops);
1125#ifdef CONFIG_SYSCTL
1126 ipv6_static_sysctl_unregister();
1127#endif
1116 cleanup_ipv6_mibs(); 1128 cleanup_ipv6_mibs();
1117 proto_unregister(&rawv6_prot); 1129 proto_unregister(&rawv6_prot);
1118 proto_unregister(&udplitev6_prot); 1130 proto_unregister(&udplitev6_prot);
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 5c99274558bf..e6dfaeac6be3 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -150,3 +150,19 @@ void ipv6_sysctl_unregister(void)
150 unregister_net_sysctl_table(ip6_header); 150 unregister_net_sysctl_table(ip6_header);
151 unregister_pernet_subsys(&ipv6_sysctl_net_ops); 151 unregister_pernet_subsys(&ipv6_sysctl_net_ops);
152} 152}
153
154static struct ctl_table_header *ip6_base;
155
156int ipv6_static_sysctl_register(void)
157{
158 static struct ctl_table empty[1];
159 ip6_base = register_net_sysctl_rotable(net_ipv6_ctl_path, empty);
160 if (ip6_base == NULL)
161 return -ENOMEM;
162 return 0;
163}
164
165void ipv6_static_sysctl_unregister(void)
166{
167 unregister_net_sysctl_table(ip6_base);
168}
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index cefbc367d8be..972201cd5fa7 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -73,7 +73,9 @@ static struct ctl_table_root net_sysctl_ro_root = {
73 73
74static int sysctl_net_init(struct net *net) 74static int sysctl_net_init(struct net *net)
75{ 75{
76 setup_sysctl_set(&net->sysctls, NULL, is_seen); 76 setup_sysctl_set(&net->sysctls,
77 &net_sysctl_ro_root.default_set,
78 is_seen);
77 return 0; 79 return 0;
78} 80}
79 81