aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-09-12 06:01:34 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:06 -0400
commit457c4cbc5a3dde259d2a1f15d5f9785290397267 (patch)
treea2ceee88780cbce27433b9a4434b3e9251efd81a /net/ipv4/fib_trie.c
parent07feaebfcc10cd35e745c7073667935246494bee (diff)
[NET]: Make /proc/net per network namespace
This patch makes /proc/net per network namespace. It modifies the global variables proc_net and proc_net_stat to be per network namespace. The proc_net file helpers are modified to take a network namespace argument, and all of their callers are fixed to pass &init_net for that argument. This ensures that all of the /proc/net files are only visible and usable in the initial network namespace until the code behind them has been updated to be handle multiple network namespaces. Making /proc/net per namespace is necessary as at least some files in /proc/net depend upon the set of network devices which is per network namespace, and even more files in /proc/net have contents that are relevant to a single network namespace. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 52b2891c63b7..be34bd556d58 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -73,6 +73,7 @@
73#include <linux/netlink.h> 73#include <linux/netlink.h>
74#include <linux/init.h> 74#include <linux/init.h>
75#include <linux/list.h> 75#include <linux/list.h>
76#include <net/net_namespace.h>
76#include <net/ip.h> 77#include <net/ip.h>
77#include <net/protocol.h> 78#include <net/protocol.h>
78#include <net/route.h> 79#include <net/route.h>
@@ -2530,30 +2531,30 @@ static const struct file_operations fib_route_fops = {
2530 2531
2531int __init fib_proc_init(void) 2532int __init fib_proc_init(void)
2532{ 2533{
2533 if (!proc_net_fops_create("fib_trie", S_IRUGO, &fib_trie_fops)) 2534 if (!proc_net_fops_create(&init_net, "fib_trie", S_IRUGO, &fib_trie_fops))
2534 goto out1; 2535 goto out1;
2535 2536
2536 if (!proc_net_fops_create("fib_triestat", S_IRUGO, &fib_triestat_fops)) 2537 if (!proc_net_fops_create(&init_net, "fib_triestat", S_IRUGO, &fib_triestat_fops))
2537 goto out2; 2538 goto out2;
2538 2539
2539 if (!proc_net_fops_create("route", S_IRUGO, &fib_route_fops)) 2540 if (!proc_net_fops_create(&init_net, "route", S_IRUGO, &fib_route_fops))
2540 goto out3; 2541 goto out3;
2541 2542
2542 return 0; 2543 return 0;
2543 2544
2544out3: 2545out3:
2545 proc_net_remove("fib_triestat"); 2546 proc_net_remove(&init_net, "fib_triestat");
2546out2: 2547out2:
2547 proc_net_remove("fib_trie"); 2548 proc_net_remove(&init_net, "fib_trie");
2548out1: 2549out1:
2549 return -ENOMEM; 2550 return -ENOMEM;
2550} 2551}
2551 2552
2552void __init fib_proc_exit(void) 2553void __init fib_proc_exit(void)
2553{ 2554{
2554 proc_net_remove("fib_trie"); 2555 proc_net_remove(&init_net, "fib_trie");
2555 proc_net_remove("fib_triestat"); 2556 proc_net_remove(&init_net, "fib_triestat");
2556 proc_net_remove("route"); 2557 proc_net_remove(&init_net, "route");
2557} 2558}
2558 2559
2559#endif /* CONFIG_PROC_FS */ 2560#endif /* CONFIG_PROC_FS */