[CRIU] [PATCH] net: virtualize sock unix and inet diag
Andrew Vagin
avagin at openvz.org
Sun Jul 15 16:48:08 EDT 2012
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
net/ipv4/inet_diag.c | 4 ++++
net/unix/diag.c | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 444e787..4d33fa7 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -726,6 +726,7 @@ void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
{
int i, num;
int s_i, s_num;
+ struct net *net = sock_net(skb->sk);
s_i = cb->args[1];
s_num = num = cb->args[2];
@@ -745,6 +746,9 @@ void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
sk_nulls_for_each(sk, node, &ilb->head) {
struct inet_sock *inet = inet_sk(sk);
+ if (!net_eq(sock_net(sk), net))
+ continue;
+
if (num < s_num) {
num++;
continue;
diff --git a/net/unix/diag.c b/net/unix/diag.c
index f621746..040c999 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -188,6 +188,7 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
struct unix_diag_req *req;
int num, s_num, slot, s_slot;
+ struct net *net = sock_net(skb->sk);
req = NLMSG_DATA(cb->nlh);
@@ -201,6 +202,8 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
num = 0;
sk_for_each(sk, node, &unix_socket_table[slot]) {
+ if (!net_eq(sock_net(sk), net))
+ continue;
if (num < s_num)
goto next;
if (!(req->udiag_states & (1 << sk->sk_state)))
--
1.7.1
More information about the CRIU
mailing list