diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-14 05:36:50 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:02:07 -0800 |
commit | a308da1627d711fd0c7542bfe892abc78d65d215 (patch) | |
tree | 58dd91e39eea89a8a635f3d264f012fa2fcb624c /net/ipv4/raw.c | |
parent | e5ba31f11f6cae785e893d5d10abd612fef0b6bc (diff) | |
download | blackbird-op-linux-a308da1627d711fd0c7542bfe892abc78d65d215.tar.gz blackbird-op-linux-a308da1627d711fd0c7542bfe892abc78d65d215.zip |
[NETNS][RAW]: Create the /proc/net/raw(6) in each namespace.
To do so, just register the proper subsystem and create files in
->init callbacks.
No other special per-namespace handling for raw sockets is required.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 206c869db921..91a52184351d 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -1003,15 +1003,31 @@ static const struct file_operations raw_seq_fops = { .release = seq_release_net, }; -int __init raw_proc_init(void) +static __net_init int raw_init_net(struct net *net) { - if (!proc_net_fops_create(&init_net, "raw", S_IRUGO, &raw_seq_fops)) + if (!proc_net_fops_create(net, "raw", S_IRUGO, &raw_seq_fops)) return -ENOMEM; + return 0; } +static __net_exit void raw_exit_net(struct net *net) +{ + proc_net_remove(net, "raw"); +} + +static __net_initdata struct pernet_operations raw_net_ops = { + .init = raw_init_net, + .exit = raw_exit_net, +}; + +int __init raw_proc_init(void) +{ + return register_pernet_subsys(&raw_net_ops); +} + void __init raw_proc_exit(void) { - proc_net_remove(&init_net, "raw"); + unregister_pernet_subsys(&raw_net_ops); } #endif /* CONFIG_PROC_FS */ |