netns: move /proc/net/dev_snmp6 to struct net
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4a7e56098f
commit
835bcc0497
|
@ -11,6 +11,10 @@ struct netns_mib {
|
||||||
DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
|
DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
|
||||||
DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
|
DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
|
||||||
DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
|
DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
|
||||||
|
|
||||||
|
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
||||||
|
struct proc_dir_entry *proc_net_devsnmp6;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
#include <net/transp_v6.h>
|
#include <net/transp_v6.h>
|
||||||
#include <net/ipv6.h>
|
#include <net/ipv6.h>
|
||||||
|
|
||||||
static struct proc_dir_entry *proc_net_devsnmp6;
|
|
||||||
|
|
||||||
static int sockstat6_seq_show(struct seq_file *seq, void *v)
|
static int sockstat6_seq_show(struct seq_file *seq, void *v)
|
||||||
{
|
{
|
||||||
struct net *net = seq->private;
|
struct net *net = seq->private;
|
||||||
|
@ -210,18 +208,20 @@ static const struct file_operations snmp6_seq_fops = {
|
||||||
int snmp6_register_dev(struct inet6_dev *idev)
|
int snmp6_register_dev(struct inet6_dev *idev)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *p;
|
struct proc_dir_entry *p;
|
||||||
|
struct net *net;
|
||||||
|
|
||||||
if (!idev || !idev->dev)
|
if (!idev || !idev->dev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!net_eq(dev_net(idev->dev), &init_net))
|
net = dev_net(idev->dev);
|
||||||
|
if (!net_eq(net, &init_net))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!proc_net_devsnmp6)
|
if (!net->mib.proc_net_devsnmp6)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
p = proc_create_data(idev->dev->name, S_IRUGO,
|
p = proc_create_data(idev->dev->name, S_IRUGO,
|
||||||
proc_net_devsnmp6, &snmp6_seq_fops, idev);
|
net->mib.proc_net_devsnmp6, &snmp6_seq_fops, idev);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -231,12 +231,13 @@ int snmp6_register_dev(struct inet6_dev *idev)
|
||||||
|
|
||||||
int snmp6_unregister_dev(struct inet6_dev *idev)
|
int snmp6_unregister_dev(struct inet6_dev *idev)
|
||||||
{
|
{
|
||||||
if (!proc_net_devsnmp6)
|
struct net *net = dev_net(idev->dev);
|
||||||
|
if (!net->mib.proc_net_devsnmp6)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (!idev || !idev->stats.proc_dir_entry)
|
if (!idev || !idev->stats.proc_dir_entry)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
remove_proc_entry(idev->stats.proc_dir_entry->name,
|
remove_proc_entry(idev->stats.proc_dir_entry->name,
|
||||||
proc_net_devsnmp6);
|
net->mib.proc_net_devsnmp6);
|
||||||
idev->stats.proc_dir_entry = NULL;
|
idev->stats.proc_dir_entry = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -269,8 +270,9 @@ int __init ipv6_misc_proc_init(void)
|
||||||
if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops))
|
if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops))
|
||||||
goto proc_snmp6_fail;
|
goto proc_snmp6_fail;
|
||||||
|
|
||||||
proc_net_devsnmp6 = proc_mkdir("dev_snmp6", init_net.proc_net);
|
init_net.mib.proc_net_devsnmp6 =
|
||||||
if (!proc_net_devsnmp6)
|
proc_mkdir("dev_snmp6", init_net.proc_net);
|
||||||
|
if (!init_net.mib.proc_net_devsnmp6)
|
||||||
goto proc_dev_snmp6_fail;
|
goto proc_dev_snmp6_fail;
|
||||||
out:
|
out:
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue