aboutsummaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/af_inet6.c12
-rw-r--r--net/ipv6/sysctl_net_ipv6.c16
2 files changed, 28 insertions, 0 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index c708ca84229..95055f8c3f3 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -934,6 +934,11 @@ static int __init inet6_init(void)
if (err)
goto out_unregister_sock;
+#ifdef CONFIG_SYSCTL
+ err = ipv6_static_sysctl_register();
+ if (err)
+ goto static_sysctl_fail;
+#endif
/*
* ipngwg API draft makes clear that the correct semantics
* for TCP and UDP is to consider one TCP and UDP instance
@@ -1058,6 +1063,10 @@ ipmr_fail:
icmp_fail:
unregister_pernet_subsys(&inet6_net_ops);
register_pernet_fail:
+#ifdef CONFIG_SYSCTL
+ ipv6_static_sysctl_unregister();
+static_sysctl_fail:
+#endif
cleanup_ipv6_mibs();
out_unregister_sock:
sock_unregister(PF_INET6);
@@ -1113,6 +1122,9 @@ static void __exit inet6_exit(void)
rawv6_exit();
unregister_pernet_subsys(&inet6_net_ops);
+#ifdef CONFIG_SYSCTL
+ ipv6_static_sysctl_unregister();
+#endif
cleanup_ipv6_mibs();
proto_unregister(&rawv6_prot);
proto_unregister(&udplitev6_prot);
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 5c99274558b..e6dfaeac6be 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -150,3 +150,19 @@ void ipv6_sysctl_unregister(void)
unregister_net_sysctl_table(ip6_header);
unregister_pernet_subsys(&ipv6_sysctl_net_ops);
}
+
+static struct ctl_table_header *ip6_base;
+
+int ipv6_static_sysctl_register(void)
+{
+ static struct ctl_table empty[1];
+ ip6_base = register_net_sysctl_rotable(net_ipv6_ctl_path, empty);
+ if (ip6_base == NULL)
+ return -ENOMEM;
+ return 0;
+}
+
+void ipv6_static_sysctl_unregister(void)
+{
+ unregister_net_sysctl_table(ip6_base);
+}