aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_hash.c17
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
785struct fib_iter_state { 785struct 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 {
796static struct fib_alias *fib_get_first(struct seq_file *seq) 797static 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)
934static void *fib_seq_start(struct seq_file *seq, loff_t *pos) 938static 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
1026static int fib_seq_open(struct inode *inode, struct file *file) 1031static 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
1032static const struct file_operations fib_seq_fops = { 1037static 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
1040int __net_init fib_proc_init(struct net *net) 1045int __net_init fib_proc_init(struct net *net)