diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-07-27 07:40:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-27 07:40:51 -0400 |
commit | 6f9f489a4eeaa3c8a8618e078a5270d2c4872b67 (patch) | |
tree | be3348d282a5ac20275710afaaedc2a45adbb8d6 /net/ipv6 | |
parent | 15d3b4a26291c170563e2b25ded5de1324f93959 (diff) |
net: 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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/af_inet6.c | 12 | ||||
-rw-r--r-- | net/ipv6/sysctl_net_ipv6.c | 16 |
2 files changed, 28 insertions, 0 deletions
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: | |||
1058 | icmp_fail: | 1063 | icmp_fail: |
1059 | unregister_pernet_subsys(&inet6_net_ops); | 1064 | unregister_pernet_subsys(&inet6_net_ops); |
1060 | register_pernet_fail: | 1065 | register_pernet_fail: |
1066 | #ifdef CONFIG_SYSCTL | ||
1067 | ipv6_static_sysctl_unregister(); | ||
1068 | static_sysctl_fail: | ||
1069 | #endif | ||
1061 | cleanup_ipv6_mibs(); | 1070 | cleanup_ipv6_mibs(); |
1062 | out_unregister_sock: | 1071 | out_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 | |||
154 | static struct ctl_table_header *ip6_base; | ||
155 | |||
156 | int 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 | |||
165 | void ipv6_static_sysctl_unregister(void) | ||
166 | { | ||
167 | unregister_net_sysctl_table(ip6_base); | ||
168 | } | ||