aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sysctl_net_ipv6.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-04-19 09:37:09 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-20 21:22:29 -0400
commit6dceb03687124b6ee392eb1d9921bd463eab3190 (patch)
treef7a5de779c5cc5cc1d660fabe0678de9c606b83e /net/ipv6/sysctl_net_ipv6.c
parent64fb3010400f6051261be9c5c74f29de416dad8f (diff)
net ipv6: Don't use sysctl tables with .child entries.
The sysctl core no longer natively understands sysctl tables with .child entries. Split the ipv6_table to remove the .child entries. 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>
Diffstat (limited to 'net/ipv6/sysctl_net_ipv6.c')
-rw-r--r--net/ipv6/sysctl_net_ipv6.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index cf1e96a49607..a52d8203a5de 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -18,18 +18,6 @@
18 18
19static ctl_table ipv6_table_template[] = { 19static ctl_table ipv6_table_template[] = {
20 { 20 {
21 .procname = "route",
22 .maxlen = 0,
23 .mode = 0555,
24 .child = ipv6_route_table_template
25 },
26 {
27 .procname = "icmp",
28 .maxlen = 0,
29 .mode = 0555,
30 .child = ipv6_icmp_table_template
31 },
32 {
33 .procname = "bindv6only", 21 .procname = "bindv6only",
34 .data = &init_net.ipv6.sysctl.bindv6only, 22 .data = &init_net.ipv6.sysctl.bindv6only,
35 .maxlen = sizeof(int), 23 .maxlen = sizeof(int),
@@ -69,28 +57,37 @@ static int __net_init ipv6_sysctl_net_init(struct net *net)
69 GFP_KERNEL); 57 GFP_KERNEL);
70 if (!ipv6_table) 58 if (!ipv6_table)
71 goto out; 59 goto out;
60 ipv6_table[0].data = &net->ipv6.sysctl.bindv6only;
72 61
73 ipv6_route_table = ipv6_route_sysctl_init(net); 62 ipv6_route_table = ipv6_route_sysctl_init(net);
74 if (!ipv6_route_table) 63 if (!ipv6_route_table)
75 goto out_ipv6_table; 64 goto out_ipv6_table;
76 ipv6_table[0].child = ipv6_route_table;
77 65
78 ipv6_icmp_table = ipv6_icmp_sysctl_init(net); 66 ipv6_icmp_table = ipv6_icmp_sysctl_init(net);
79 if (!ipv6_icmp_table) 67 if (!ipv6_icmp_table)
80 goto out_ipv6_route_table; 68 goto out_ipv6_route_table;
81 ipv6_table[1].child = ipv6_icmp_table;
82 69
83 ipv6_table[2].data = &net->ipv6.sysctl.bindv6only; 70 net->ipv6.sysctl.hdr = register_net_sysctl(net, "net/ipv6", ipv6_table);
84 71 if (!net->ipv6.sysctl.hdr)
85 net->ipv6.sysctl.table = register_net_sysctl_table(net, net_ipv6_ctl_path,
86 ipv6_table);
87 if (!net->ipv6.sysctl.table)
88 goto out_ipv6_icmp_table; 72 goto out_ipv6_icmp_table;
89 73
74 net->ipv6.sysctl.route_hdr =
75 register_net_sysctl(net, "net/ipv6/route", ipv6_route_table);
76 if (!net->ipv6.sysctl.route_hdr)
77 goto out_unregister_ipv6_table;
78
79 net->ipv6.sysctl.icmp_hdr =
80 register_net_sysctl(net, "net/ipv6/icmp", ipv6_icmp_table);
81 if (!net->ipv6.sysctl.icmp_hdr)
82 goto out_unregister_route_table;
83
90 err = 0; 84 err = 0;
91out: 85out:
92 return err; 86 return err;
93 87out_unregister_route_table:
88 unregister_net_sysctl_table(net->ipv6.sysctl.route_hdr);
89out_unregister_ipv6_table:
90 unregister_net_sysctl_table(net->ipv6.sysctl.hdr);
94out_ipv6_icmp_table: 91out_ipv6_icmp_table:
95 kfree(ipv6_icmp_table); 92 kfree(ipv6_icmp_table);
96out_ipv6_route_table: 93out_ipv6_route_table:
@@ -106,11 +103,13 @@ static void __net_exit ipv6_sysctl_net_exit(struct net *net)
106 struct ctl_table *ipv6_route_table; 103 struct ctl_table *ipv6_route_table;
107 struct ctl_table *ipv6_icmp_table; 104 struct ctl_table *ipv6_icmp_table;
108 105
109 ipv6_table = net->ipv6.sysctl.table->ctl_table_arg; 106 ipv6_table = net->ipv6.sysctl.hdr->ctl_table_arg;
110 ipv6_route_table = ipv6_table[0].child; 107 ipv6_route_table = net->ipv6.sysctl.route_hdr->ctl_table_arg;
111 ipv6_icmp_table = ipv6_table[1].child; 108 ipv6_icmp_table = net->ipv6.sysctl.icmp_hdr->ctl_table_arg;
112 109
113 unregister_net_sysctl_table(net->ipv6.sysctl.table); 110 unregister_net_sysctl_table(net->ipv6.sysctl.icmp_hdr);
111 unregister_net_sysctl_table(net->ipv6.sysctl.route_hdr);
112 unregister_net_sysctl_table(net->ipv6.sysctl.hdr);
114 113
115 kfree(ipv6_table); 114 kfree(ipv6_table);
116 kfree(ipv6_route_table); 115 kfree(ipv6_route_table);