[NETNS][ICMP]: Register pernet subsys to make ICMP sysctls per-net.
This includes adding pernet_operations, empty init and exit hooks and a bit of changes in sysctl_ipv4_init just not to have this part in next patches. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f5aa23fd49
commit
1577519d6b
1 changed files with 23 additions and 1 deletions
|
@ -811,12 +811,34 @@ struct ctl_path net_ipv4_ctl_path[] = {
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(net_ipv4_ctl_path);
|
EXPORT_SYMBOL_GPL(net_ipv4_ctl_path);
|
||||||
|
|
||||||
|
static __net_init int ipv4_sysctl_init_net(struct net *net)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __net_exit void ipv4_sysctl_exit_net(struct net *net)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
|
||||||
|
.init = ipv4_sysctl_init_net,
|
||||||
|
.exit = ipv4_sysctl_exit_net,
|
||||||
|
};
|
||||||
|
|
||||||
static __init int sysctl_ipv4_init(void)
|
static __init int sysctl_ipv4_init(void)
|
||||||
{
|
{
|
||||||
struct ctl_table_header *hdr;
|
struct ctl_table_header *hdr;
|
||||||
|
|
||||||
hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table);
|
hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table);
|
||||||
return hdr == NULL ? -ENOMEM : 0;
|
if (hdr == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
if (register_pernet_subsys(&ipv4_sysctl_ops)) {
|
||||||
|
unregister_sysctl_table(hdr);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__initcall(sysctl_ipv4_init);
|
__initcall(sysctl_ipv4_init);
|
||||||
|
|
Loading…
Reference in a new issue