diff options
-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) |