diff options
-rw-r--r-- | include/net/raw.h | 3 | ||||
-rw-r--r-- | net/ipv4/raw.c | 20 | ||||
-rw-r--r-- | net/ipv6/raw.c | 4 |
3 files changed, 16 insertions, 11 deletions
diff --git a/include/net/raw.h b/include/net/raw.h index 4d1aba032bf..cca81d8b2d8 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -39,6 +39,7 @@ extern int raw_proc_init(void); | |||
39 | extern void raw_proc_exit(void); | 39 | extern void raw_proc_exit(void); |
40 | 40 | ||
41 | struct raw_iter_state { | 41 | struct raw_iter_state { |
42 | struct seq_net_private p; | ||
42 | int bucket; | 43 | int bucket; |
43 | unsigned short family; | 44 | unsigned short family; |
44 | struct raw_hashinfo *h; | 45 | struct raw_hashinfo *h; |
@@ -48,7 +49,7 @@ struct raw_iter_state { | |||
48 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); | 49 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); |
49 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 50 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
50 | void raw_seq_stop(struct seq_file *seq, void *v); | 51 | void raw_seq_stop(struct seq_file *seq, void *v); |
51 | int raw_seq_open(struct file *file, struct raw_hashinfo *h, | 52 | int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, |
52 | unsigned short family); | 53 | unsigned short family); |
53 | 54 | ||
54 | #endif | 55 | #endif |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index a490a9d5471..4e95372a78e 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -860,7 +860,8 @@ static struct sock *raw_get_first(struct seq_file *seq) | |||
860 | struct hlist_node *node; | 860 | struct hlist_node *node; |
861 | 861 | ||
862 | sk_for_each(sk, node, &state->h->ht[state->bucket]) | 862 | sk_for_each(sk, node, &state->h->ht[state->bucket]) |
863 | if (sk->sk_family == state->family) | 863 | if (sk->sk_net == state->p.net && |
864 | sk->sk_family == state->family) | ||
864 | goto found; | 865 | goto found; |
865 | } | 866 | } |
866 | sk = NULL; | 867 | sk = NULL; |
@@ -876,7 +877,8 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) | |||
876 | sk = sk_next(sk); | 877 | sk = sk_next(sk); |
877 | try_again: | 878 | try_again: |
878 | ; | 879 | ; |
879 | } while (sk && sk->sk_family != state->family); | 880 | } while (sk && sk->sk_net != state->p.net && |
881 | sk->sk_family != state->family); | ||
880 | 882 | ||
881 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { | 883 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { |
882 | sk = sk_head(&state->h->ht[state->bucket]); | 884 | sk = sk_head(&state->h->ht[state->bucket]); |
@@ -970,16 +972,18 @@ static const struct seq_operations raw_seq_ops = { | |||
970 | .show = raw_seq_show, | 972 | .show = raw_seq_show, |
971 | }; | 973 | }; |
972 | 974 | ||
973 | int raw_seq_open(struct file *file, struct raw_hashinfo *h, | 975 | int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, |
974 | unsigned short family) | 976 | unsigned short family) |
975 | { | 977 | { |
978 | int err; | ||
976 | struct raw_iter_state *i; | 979 | struct raw_iter_state *i; |
977 | 980 | ||
978 | i = __seq_open_private(file, &raw_seq_ops, | 981 | err = seq_open_net(ino, file, &raw_seq_ops, |
979 | sizeof(struct raw_iter_state)); | 982 | sizeof(struct raw_iter_state)); |
980 | if (i == NULL) | 983 | if (err < 0) |
981 | return -ENOMEM; | 984 | return err; |
982 | 985 | ||
986 | i = raw_seq_private((struct seq_file *)file->private_data); | ||
983 | i->h = h; | 987 | i->h = h; |
984 | i->family = family; | 988 | i->family = family; |
985 | return 0; | 989 | return 0; |
@@ -988,7 +992,7 @@ EXPORT_SYMBOL_GPL(raw_seq_open); | |||
988 | 992 | ||
989 | static int raw_v4_seq_open(struct inode *inode, struct file *file) | 993 | static int raw_v4_seq_open(struct inode *inode, struct file *file) |
990 | { | 994 | { |
991 | return raw_seq_open(file, &raw_v4_hashinfo, PF_INET); | 995 | return raw_seq_open(inode, file, &raw_v4_hashinfo, PF_INET); |
992 | } | 996 | } |
993 | 997 | ||
994 | static const struct file_operations raw_seq_fops = { | 998 | static const struct file_operations raw_seq_fops = { |
@@ -996,7 +1000,7 @@ static const struct file_operations raw_seq_fops = { | |||
996 | .open = raw_v4_seq_open, | 1000 | .open = raw_v4_seq_open, |
997 | .read = seq_read, | 1001 | .read = seq_read, |
998 | .llseek = seq_lseek, | 1002 | .llseek = seq_lseek, |
999 | .release = seq_release_private, | 1003 | .release = seq_release_net, |
1000 | }; | 1004 | }; |
1001 | 1005 | ||
1002 | int __init raw_proc_init(void) | 1006 | int __init raw_proc_init(void) |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 6f20086064b..026fa910cb7 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1259,7 +1259,7 @@ static const struct seq_operations raw6_seq_ops = { | |||
1259 | 1259 | ||
1260 | static int raw6_seq_open(struct inode *inode, struct file *file) | 1260 | static int raw6_seq_open(struct inode *inode, struct file *file) |
1261 | { | 1261 | { |
1262 | return raw_seq_open(file, &raw_v6_hashinfo, PF_INET6); | 1262 | return raw_seq_open(inode, file, &raw_v6_hashinfo, PF_INET6); |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | static const struct file_operations raw6_seq_fops = { | 1265 | static const struct file_operations raw6_seq_fops = { |
@@ -1267,7 +1267,7 @@ static const struct file_operations raw6_seq_fops = { | |||
1267 | .open = raw6_seq_open, | 1267 | .open = raw6_seq_open, |
1268 | .read = seq_read, | 1268 | .read = seq_read, |
1269 | .llseek = seq_lseek, | 1269 | .llseek = seq_lseek, |
1270 | .release = seq_release_private, | 1270 | .release = seq_release_net, |
1271 | }; | 1271 | }; |
1272 | 1272 | ||
1273 | int __init raw6_proc_init(void) | 1273 | int __init raw6_proc_init(void) |