9 #include <linux/sysctl.h>
10 #include <linux/in6.h>
11 #include <linux/ipv6.h>
12 #include <linux/slab.h>
13 #include <linux/export.h>
19 static ctl_table ipv6_table_template[] = {
22 .data = &
init_net.ipv6.sysctl.bindv6only,
23 .maxlen =
sizeof(
int),
34 .maxlen =
sizeof(
int),
49 ipv6_table =
kmemdup(ipv6_table_template,
sizeof(ipv6_table_template),
53 ipv6_table[0].
data = &net->ipv6.sysctl.bindv6only;
55 ipv6_route_table = ipv6_route_sysctl_init(net);
56 if (!ipv6_route_table)
59 ipv6_icmp_table = ipv6_icmp_sysctl_init(net);
61 goto out_ipv6_route_table;
64 if (!net->ipv6.sysctl.hdr)
65 goto out_ipv6_icmp_table;
67 net->ipv6.sysctl.route_hdr =
69 if (!net->ipv6.sysctl.route_hdr)
70 goto out_unregister_ipv6_table;
72 net->ipv6.sysctl.icmp_hdr =
74 if (!net->ipv6.sysctl.icmp_hdr)
75 goto out_unregister_route_table;
80 out_unregister_route_table:
82 out_unregister_ipv6_table:
85 kfree(ipv6_icmp_table);
87 kfree(ipv6_route_table);
93 static void __net_exit ipv6_sysctl_net_exit(
struct net *net)
99 ipv6_table = net->ipv6.sysctl.hdr->ctl_table_arg;
100 ipv6_route_table = net->ipv6.sysctl.route_hdr->ctl_table_arg;
101 ipv6_icmp_table = net->ipv6.sysctl.icmp_hdr->ctl_table_arg;
108 kfree(ipv6_route_table);
109 kfree(ipv6_icmp_table);
113 .init = ipv6_sysctl_net_init,
114 .exit = ipv6_sysctl_net_exit,
124 if (ip6_header ==
NULL)