diff options
Diffstat (limited to 'net/ipv4/sysctl_net_ipv4.c')
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 88286f35d1e2..c2fca3024d2e 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -811,12 +811,34 @@ struct ctl_path net_ipv4_ctl_path[] = { | |||
811 | }; | 811 | }; |
812 | EXPORT_SYMBOL_GPL(net_ipv4_ctl_path); | 812 | EXPORT_SYMBOL_GPL(net_ipv4_ctl_path); |
813 | 813 | ||
814 | static __net_init int ipv4_sysctl_init_net(struct net *net) | ||
815 | { | ||
816 | return 0; | ||
817 | } | ||
818 | |||
819 | static __net_exit void ipv4_sysctl_exit_net(struct net *net) | ||
820 | { | ||
821 | } | ||
822 | |||
823 | static __net_initdata struct pernet_operations ipv4_sysctl_ops = { | ||
824 | .init = ipv4_sysctl_init_net, | ||
825 | .exit = ipv4_sysctl_exit_net, | ||
826 | }; | ||
827 | |||
814 | static __init int sysctl_ipv4_init(void) | 828 | static __init int sysctl_ipv4_init(void) |
815 | { | 829 | { |
816 | struct ctl_table_header *hdr; | 830 | struct ctl_table_header *hdr; |
817 | 831 | ||
818 | hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table); | 832 | hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table); |
819 | return hdr == NULL ? -ENOMEM : 0; | 833 | if (hdr == NULL) |
834 | return -ENOMEM; | ||
835 | |||
836 | if (register_pernet_subsys(&ipv4_sysctl_ops)) { | ||
837 | unregister_sysctl_table(hdr); | ||
838 | return -ENOMEM; | ||
839 | } | ||
840 | |||
841 | return 0; | ||
820 | } | 842 | } |
821 | 843 | ||
822 | __initcall(sysctl_ipv4_init); | 844 | __initcall(sysctl_ipv4_init); |