Skip to content

Commit 94911fe

Browse files
btherydavem330
authored andcommitted
[NETNS][IPV6] Move sysctl initialization later on in the IPv6 init sequence
This patch moves initialization of IPv6 sysctl stuff at the end of IPv6 initialization. This will be helpful for network namespaces where some sysctl entries depend on per-namespace variables, that need to be allocated and initialized before they are referenced by sysctl. Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6b3d626 commit 94911fe

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

net/ipv6/af_inet6.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -934,12 +934,6 @@ static int __init inet6_init(void)
934934
err = register_pernet_subsys(&inet6_net_ops);
935935
if (err)
936936
goto register_pernet_fail;
937-
938-
#ifdef CONFIG_SYSCTL
939-
err = ipv6_sysctl_register();
940-
if (err)
941-
goto sysctl_fail;
942-
#endif
943937
err = icmpv6_init();
944938
if (err)
945939
goto icmp_fail;
@@ -1006,9 +1000,19 @@ static int __init inet6_init(void)
10061000
err = ipv6_packet_init();
10071001
if (err)
10081002
goto ipv6_packet_fail;
1003+
1004+
#ifdef CONFIG_SYSCTL
1005+
err = ipv6_sysctl_register();
1006+
if (err)
1007+
goto sysctl_fail;
1008+
#endif
10091009
out:
10101010
return err;
10111011

1012+
#ifdef CONFIG_SYSCTL
1013+
sysctl_fail:
1014+
ipv6_packet_cleanup();
1015+
#endif
10121016
ipv6_packet_fail:
10131017
tcpv6_exit();
10141018
tcpv6_fail:
@@ -1050,10 +1054,6 @@ static int __init inet6_init(void)
10501054
ndisc_fail:
10511055
icmpv6_cleanup();
10521056
icmp_fail:
1053-
#ifdef CONFIG_SYSCTL
1054-
ipv6_sysctl_unregister();
1055-
sysctl_fail:
1056-
#endif
10571057
unregister_pernet_subsys(&inet6_net_ops);
10581058
register_pernet_fail:
10591059
cleanup_ipv6_mibs();
@@ -1083,6 +1083,9 @@ static void __exit inet6_exit(void)
10831083
/* Disallow any further netlink messages */
10841084
rtnl_unregister_all(PF_INET6);
10851085

1086+
#ifdef CONFIG_SYSCTL
1087+
ipv6_sysctl_unregister();
1088+
#endif
10861089
udpv6_exit();
10871090
#ifdef CONFIG_IP_UDPLITE
10881091
udplitev6_exit();
@@ -1112,9 +1115,7 @@ static void __exit inet6_exit(void)
11121115
ndisc_cleanup();
11131116
icmpv6_cleanup();
11141117
rawv6_exit();
1115-
#ifdef CONFIG_SYSCTL
1116-
ipv6_sysctl_unregister();
1117-
#endif
1118+
11181119
unregister_pernet_subsys(&inet6_net_ops);
11191120
cleanup_ipv6_mibs();
11201121
proto_unregister(&rawv6_prot);

0 commit comments

Comments
 (0)