diff options
author | Denis V. Lunev <den@openvz.org> | 2008-03-24 15:28:43 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-24 15:28:43 -0700 |
commit | ffc31d3d7719555cd784ecaf82e9c237f3a747ab (patch) | |
tree | 19a911043bcc15be7fb321f41a5c492f30021c52 /net/ipv4/arp.c | |
parent | 49e8a279a1b79e14b51aa6d4102b3a3de39e7a5e (diff) |
[NETNS]: /proc/net/arp namespacing.
Seqfile operation showing /proc/net/arp are already namespace
aware. All we need is to register this file for each namespace.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r-- | net/ipv4/arp.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 6d90ec52421..832473e30b3 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1377,13 +1377,29 @@ static const struct file_operations arp_seq_fops = { .release = seq_release_net, }; -static int __init arp_proc_init(void) + +static int __net_init arp_net_init(struct net *net) { - if (!proc_net_fops_create(&init_net, "arp", S_IRUGO, &arp_seq_fops)) + if (!proc_net_fops_create(net, "arp", S_IRUGO, &arp_seq_fops)) return -ENOMEM; return 0; } +static void __net_exit arp_net_exit(struct net *net) +{ + proc_net_remove(net, "arp"); +} + +static struct pernet_operations arp_net_ops = { + .init = arp_net_init, + .exit = arp_net_exit, +}; + +static int __init arp_proc_init(void) +{ + return register_pernet_subsys(&arp_net_ops); +} + #else /* CONFIG_PROC_FS */ static int __init arp_proc_init(void) |