diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-10 06:26:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:29 -0500 |
commit | 6e04d01dfa6fe81d6bcae1e85de695285086cee2 (patch) | |
tree | 9464077859ea65a6747e9540f5978c72f48b113e /net/ipv4 | |
parent | 4d1169c1e781e5853317c6b75620d678b2c4854e (diff) |
[NETNS]: Show routing information from correct namespace (fib_hash.c)
This is the second part (for the CONFIG_IP_FIB_HASH case) of the patch
#4, where we have created proc files in namespaces.
Now we can dump correct info in them.
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fib_hash.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index d20ae2e28ab5..a07300404e82 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -783,6 +783,7 @@ struct fib_table *fib_hash_init(u32 id) | |||
783 | #ifdef CONFIG_PROC_FS | 783 | #ifdef CONFIG_PROC_FS |
784 | 784 | ||
785 | struct fib_iter_state { | 785 | struct fib_iter_state { |
786 | struct seq_net_private p; | ||
786 | struct fn_zone *zone; | 787 | struct fn_zone *zone; |
787 | int bucket; | 788 | int bucket; |
788 | struct hlist_head *hash_head; | 789 | struct hlist_head *hash_head; |
@@ -796,8 +797,11 @@ struct fib_iter_state { | |||
796 | static struct fib_alias *fib_get_first(struct seq_file *seq) | 797 | static struct fib_alias *fib_get_first(struct seq_file *seq) |
797 | { | 798 | { |
798 | struct fib_iter_state *iter = seq->private; | 799 | struct fib_iter_state *iter = seq->private; |
799 | struct fib_table *main_table = fib_get_table(&init_net, RT_TABLE_MAIN); | 800 | struct fib_table *main_table; |
800 | struct fn_hash *table = (struct fn_hash *)main_table->tb_data; | 801 | struct fn_hash *table; |
802 | |||
803 | main_table = fib_get_table(iter->p.net, RT_TABLE_MAIN); | ||
804 | table = (struct fn_hash *)main_table->tb_data; | ||
801 | 805 | ||
802 | iter->bucket = 0; | 806 | iter->bucket = 0; |
803 | iter->hash_head = NULL; | 807 | iter->hash_head = NULL; |
@@ -934,10 +938,11 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos) | |||
934 | static void *fib_seq_start(struct seq_file *seq, loff_t *pos) | 938 | static void *fib_seq_start(struct seq_file *seq, loff_t *pos) |
935 | __acquires(fib_hash_lock) | 939 | __acquires(fib_hash_lock) |
936 | { | 940 | { |
941 | struct fib_iter_state *iter = seq->private; | ||
937 | void *v = NULL; | 942 | void *v = NULL; |
938 | 943 | ||
939 | read_lock(&fib_hash_lock); | 944 | read_lock(&fib_hash_lock); |
940 | if (fib_get_table(&init_net, RT_TABLE_MAIN)) | 945 | if (fib_get_table(iter->p.net, RT_TABLE_MAIN)) |
941 | v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 946 | v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
942 | return v; | 947 | return v; |
943 | } | 948 | } |
@@ -1025,8 +1030,8 @@ static const struct seq_operations fib_seq_ops = { | |||
1025 | 1030 | ||
1026 | static int fib_seq_open(struct inode *inode, struct file *file) | 1031 | static int fib_seq_open(struct inode *inode, struct file *file) |
1027 | { | 1032 | { |
1028 | return seq_open_private(file, &fib_seq_ops, | 1033 | return seq_open_net(inode, file, &fib_seq_ops, |
1029 | sizeof(struct fib_iter_state)); | 1034 | sizeof(struct fib_iter_state)); |
1030 | } | 1035 | } |
1031 | 1036 | ||
1032 | static const struct file_operations fib_seq_fops = { | 1037 | static const struct file_operations fib_seq_fops = { |
@@ -1034,7 +1039,7 @@ static const struct file_operations fib_seq_fops = { | |||
1034 | .open = fib_seq_open, | 1039 | .open = fib_seq_open, |
1035 | .read = seq_read, | 1040 | .read = seq_read, |
1036 | .llseek = seq_lseek, | 1041 | .llseek = seq_lseek, |
1037 | .release = seq_release_private, | 1042 | .release = seq_release_net, |
1038 | }; | 1043 | }; |
1039 | 1044 | ||
1040 | int __net_init fib_proc_init(struct net *net) | 1045 | int __net_init fib_proc_init(struct net *net) |